MCPcopy Create free account
hub / github.com/experdot/pointer / parseDateLike

Function parseDateLike

src/renderer/src/utils/dateTime.ts:6–11  ·  view source on GitHub ↗
(value: DateLike)

Source from the content-addressed store, hash-verified

4export type DateLike = number | string | Date | Dayjs | null | undefined
5
6export function parseDateLike(value: DateLike): Dayjs | null {
7 if (value == null) return null
8
9 const parsed = dayjs.isDayjs(value) ? value.locale('zh-cn') : dayjs(value).locale('zh-cn')
10 return parsed.isValid() ? parsed : null
11}
12
13export function formatSemanticDateTime(value: DateLike): string {
14 const date = parseDateLike(value)

Callers 3

DateTimeTextFunction · 0.90
formatSemanticDateTimeFunction · 0.85
formatLongDateTimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected