MCPcopy Index your code
hub / github.com/simstudioai/sim / toCompactTimestamp

Function toCompactTimestamp

apps/sim/tools/langsmith/utils.ts:9–21  ·  view source on GitHub ↗
(startTime?: string)

Source from the content-addressed store, hash-verified

7}
8
9const toCompactTimestamp = (startTime?: string): string => {
10 const parsed = startTime ? new Date(startTime) : new Date()
11 const date = Number.isNaN(parsed.getTime()) ? new Date() : parsed
12 const pad = (value: number, length: number) => value.toString().padStart(length, '0')
13 const year = date.getUTCFullYear()
14 const month = pad(date.getUTCMonth() + 1, 2)
15 const day = pad(date.getUTCDate(), 2)
16 const hours = pad(date.getUTCHours(), 2)
17 const minutes = pad(date.getUTCMinutes(), 2)
18 const seconds = pad(date.getUTCSeconds(), 2)
19 const micros = pad(date.getUTCMilliseconds() * 1000, 6)
20 return `${year}${month}${day}T${hours}${minutes}${seconds}${micros}`
21}
22
23export const normalizeLangsmithRunPayload = (run: LangsmithRunPayload): NormalizedRunPayload => {
24 const runId = run.id ?? generateId()

Callers 1

Calls 1

padFunction · 0.70

Tested by

no test coverage detected