MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / formatTimeRange

Function formatTimeRange

packages/node-runtime/src/ai/preprocessor/format.ts:68–78  ·  view source on GitHub ↗
(
  timeFilter?: { startTs: number; endTs: number },
  locale?: string
)

Source from the content-addressed store, hash-verified

66 * 格式化时间范围用于返回结果
67 */
68export function formatTimeRange(
69 timeFilter?: { startTs: number; endTs: number },
70 locale?: string
71): string | { start: string; end: string } {
72 if (!timeFilter) return t('allTime', locale) as string
73 const localeStr = isChineseLocale(locale) ? 'zh-CN' : 'en-US'
74 return {
75 start: new Date(timeFilter.startTs * 1000).toLocaleString(localeStr),
76 end: new Date(timeFilter.endTs * 1000).toLocaleString(localeStr),
77 }
78}
79
80/**
81 * 将工具返回的结构化数据格式化为 LLM 友好的纯文本

Callers

nothing calls this directly

Calls 2

tFunction · 0.70
isChineseLocaleFunction · 0.70

Tested by

no test coverage detected