@gobing-ai/ts-utils 0.5.17 → 0.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/date.js +1 -1
- package/package.json +1 -1
- package/src/date.ts +1 -1
package/dist/date.js
CHANGED
|
@@ -7,7 +7,7 @@ export function toMs(input) {
|
|
|
7
7
|
if (input === null || input === undefined)
|
|
8
8
|
return null;
|
|
9
9
|
if (input instanceof Date)
|
|
10
|
-
return input.getTime();
|
|
10
|
+
return toMs(input.getTime());
|
|
11
11
|
if (typeof input === 'string') {
|
|
12
12
|
const parsed = new Date(input).getTime();
|
|
13
13
|
return Number.isNaN(parsed) ? null : parsed;
|
package/package.json
CHANGED
package/src/date.ts
CHANGED
|
@@ -6,7 +6,7 @@ export function nowMs(): number {
|
|
|
6
6
|
/** Normalize a date/time input to milliseconds since the Unix epoch. Returns `null` for unparseable or invalid values. */
|
|
7
7
|
export function toMs(input: Date | number | string | null | undefined): number | null {
|
|
8
8
|
if (input === null || input === undefined) return null;
|
|
9
|
-
if (input instanceof Date) return input.getTime();
|
|
9
|
+
if (input instanceof Date) return toMs(input.getTime());
|
|
10
10
|
if (typeof input === 'string') {
|
|
11
11
|
const parsed = new Date(input).getTime();
|
|
12
12
|
return Number.isNaN(parsed) ? null : parsed;
|