@dereekb/date 10.1.10 → 10.1.12
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/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/package.json +1 -1
- package/src/lib/date/date.d.ts +3 -3
package/index.cjs.js
CHANGED
|
@@ -1932,7 +1932,7 @@ function toJsDate(input) {
|
|
|
1932
1932
|
return isDate(input) ? input : (_a = parseJsDateString(input)) !== null && _a !== void 0 ? _a : new Date(input);
|
|
1933
1933
|
}
|
|
1934
1934
|
function parseJsDateString(input) {
|
|
1935
|
-
const date = util.isISO8601DateString(input) ? dateFns.parseISO(input) : new Date(input);
|
|
1935
|
+
const date = typeof input === 'string' && util.isISO8601DateString(input) ? dateFns.parseISO(input) : new Date(input);
|
|
1936
1936
|
return dateFns.isValid(date) ? date : undefined;
|
|
1937
1937
|
}
|
|
1938
1938
|
function earliestDate(dates, defaultDate = undefined) {
|
package/index.esm.js
CHANGED
|
@@ -1940,7 +1940,7 @@ function toJsDate(input) {
|
|
|
1940
1940
|
return isDate(input) ? input : (_parseJsDateString = parseJsDateString(input)) != null ? _parseJsDateString : new Date(input);
|
|
1941
1941
|
}
|
|
1942
1942
|
function parseJsDateString(input) {
|
|
1943
|
-
const date = isISO8601DateString(input) ? parseISO(input) : new Date(input);
|
|
1943
|
+
const date = typeof input === 'string' && isISO8601DateString(input) ? parseISO(input) : new Date(input);
|
|
1944
1944
|
return isValid(date) ? date : undefined;
|
|
1945
1945
|
}
|
|
1946
1946
|
|
package/package.json
CHANGED
package/src/lib/date/date.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DayOfWeekNameFunction, type DateOrDateString, type ISO8601DateString, type Maybe, type Minutes, type Seconds, type TimezoneString, type ArrayOrValue, type MapFunction, type ISO8601DateStringUTCFull, type UTCDateString, type DayOfWeek } from '@dereekb/util';
|
|
1
|
+
import { type DayOfWeekNameFunction, type DateOrDateString, type ISO8601DateString, type Maybe, type Minutes, type Seconds, type TimezoneString, type ArrayOrValue, type MapFunction, type ISO8601DateStringUTCFull, type UTCDateString, type DayOfWeek, type UnixDateTimeNumber } from '@dereekb/util';
|
|
2
2
|
export declare const MAX_FUTURE_DATE: Date;
|
|
3
3
|
/**
|
|
4
4
|
* Reads a date from the input value
|
|
@@ -43,8 +43,8 @@ export declare function safeToJsDate(input: Maybe<DateOrDateString | UTCDateStri
|
|
|
43
43
|
* @param input
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
|
-
export declare function toJsDate(input: DateOrDateString | UTCDateString): Date;
|
|
47
|
-
export declare function parseJsDateString(input: ISO8601DateString | UTCDateString): Maybe<Date>;
|
|
46
|
+
export declare function toJsDate(input: DateOrDateString | UTCDateString | UnixDateTimeNumber): Date;
|
|
47
|
+
export declare function parseJsDateString(input: ISO8601DateString | UTCDateString | UnixDateTimeNumber): Maybe<Date>;
|
|
48
48
|
/**
|
|
49
49
|
* Returns the earliest date from the input array.
|
|
50
50
|
*/
|