MCPcopy Index your code
hub / github.com/bytebase/bytebase / formatAbsoluteDate

Function formatAbsoluteDate

frontend/src/utils/datetime.ts:54–70  ·  view source on GitHub ↗
(timestampMs: number)

Source from the content-addressed store, hash-verified

52}
53
54export function formatAbsoluteDate(timestampMs: number): string {
55 const date = new Date(timestampMs);
56 const now = new Date();
57
58 if (date.getFullYear() === now.getFullYear()) {
59 return new Intl.DateTimeFormat(getActiveLocale(), {
60 month: "short",
61 day: "numeric",
62 }).format(date);
63 }
64
65 return new Intl.DateTimeFormat(getActiveLocale(), {
66 month: "short",
67 day: "numeric",
68 year: "numeric",
69 }).format(date);
70}

Callers 2

humanizeTsFunction · 0.90
datetime.test.tsFile · 0.90

Calls 1

getActiveLocaleFunction · 0.85

Tested by

no test coverage detected