MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getRelativeTimeFormat

Function getRelativeTimeFormat

src/utils/intl.ts:56–67  ·  view source on GitHub ↗
(
  style: 'long' | 'short' | 'narrow',
  numeric: 'always' | 'auto',
)

Source from the content-addressed store, hash-verified

54const rtfCache = new Map<string, Intl.RelativeTimeFormat>()
55
56export function getRelativeTimeFormat(
57 style: 'long' | 'short' | 'narrow',
58 numeric: 'always' | 'auto',
59): Intl.RelativeTimeFormat {
60 const key = `${style}:${numeric}`
61 let rtf = rtfCache.get(key)
62 if (!rtf) {
63 rtf = new Intl.RelativeTimeFormat('en', { style, numeric })
64 rtfCache.set(key, rtf)
65 }
66 return rtf
67}
68
69// Timezone is constant for the process lifetime
70let cachedTimeZone: string | null = null

Callers 1

formatRelativeTimeFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected