MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / formatTimeRange

Function formatTimeRange

packages/tools/src/utils/format.ts:33–43  ·  view source on GitHub ↗
(
  timeFilter?: { startTs: number; endTs: number },
  locale?: string
)

Source from the content-addressed store, hash-verified

31}
32
33export function formatTimeRange(
34 timeFilter?: { startTs: number; endTs: number },
35 locale?: string
36): string | { start: string; end: string } {
37 if (!timeFilter) return t('allTime', locale)
38 const localeStr = isChineseLocale(locale) ? 'zh-CN' : 'en-US'
39 return {
40 start: new Date(timeFilter.startTs * 1000).toLocaleString(localeStr),
41 end: new Date(timeFilter.endTs * 1000).toLocaleString(localeStr),
42 }
43}
44
45export function formatMessageCompact(
46 msg: {

Callers 5

handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90

Calls 2

tFunction · 0.70
isChineseLocaleFunction · 0.70

Tested by

no test coverage detected