MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / fmtRelative

Function fmtRelative

frontend/src/utils/format.ts:31–38  ·  view source on GitHub ↗
(
  ts: number | string | Date | undefined | null,
)

Source from the content-addressed store, hash-verified

29 * 相对时间(2 小时前)
30 */
31export function fmtRelative(
32 ts: number | string | Date | undefined | null,
33): string {
34 if (!ts) return '-';
35 const d = dayjs(ts);
36 if (!d.isValid()) return '-';
37 return d.fromNow();
38}
39
40/**
41 * 订单号截断显示(a1b2c3...)

Callers 2

MessageListFunction · 0.90
OrderCardFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected