MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / parseDate

Method parseDate

packages/pglite/src/PglitePlatform.ts:46–66  ·  view source on GitHub ↗

* @inheritDoc

(value: string | number)

Source from the content-addressed store, hash-verified

44 * @inheritDoc
45 */
46 override parseDate(value: string | number): Date {
47 // postgres-date returns `null` for a JS ISO string which has the `T` separator
48 if (typeof value === 'string' && value.charAt(10) === 'T') {
49 return new Date(value);
50 }
51
52 /* v8 ignore next */
53 if (typeof value === 'number') {
54 return new Date(value);
55 }
56
57 // @ts-ignore fix wrong type resolution during build
58 const parsed = parseDate(value);
59
60 /* v8 ignore next */
61 if (parsed === null) {
62 return value as unknown as Date;
63 }
64
65 return parsed as Date;
66 }
67}

Callers 3

mapJoinedPropFunction · 0.45
prepareOutputValueMethod · 0.45

Calls 1

parseDateFunction · 0.85

Tested by

no test coverage detected