MCPcopy Create free account
hub / github.com/bytebase/bytebase / humanizeTs

Function humanizeTs

frontend/src/utils/util.ts:29–36  ·  view source on GitHub ↗
(ts: number)

Source from the content-addressed store, hash-verified

27}
28
29export function humanizeTs(ts: number): string {
30 const timestampMs = ts * 1000;
31 const diff = Math.abs(Date.now() - timestampMs);
32 if (diff > RELATIVE_THRESHOLD_MS) {
33 return formatAbsoluteDate(timestampMs);
34 }
35 return formatRelativeTime(timestampMs);
36}
37
38export const humanizeDurationV1 = (duration: Duration | undefined) => {
39 if (!duration) return "-";

Callers 3

DeployTaskDetailPanelFunction · 0.90
humanizeDateFunction · 0.90
datetime.test.tsFile · 0.85

Calls 2

formatAbsoluteDateFunction · 0.90
formatRelativeTimeFunction · 0.90

Tested by

no test coverage detected