@zag-js/date-utils 1.29.0 → 1.30.0
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ type DateRangePreset = "thisWeek" | "lastWeek" | "thisMonth" | "lastMonth" | "th
|
|
|
17
17
|
declare function alignDate(date: DateValue, alignment: DateAlignment, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
18
18
|
declare function alignStartDate(date: DateValue, startDate: DateValue, endDate: DateValue, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
19
19
|
|
|
20
|
-
declare function isDateEqual(dateA: DateValue, dateB?: DateValue | null): boolean;
|
|
20
|
+
declare function isDateEqual(dateA: DateValue | null | undefined, dateB?: DateValue | null): boolean;
|
|
21
21
|
declare function isDateUnavailable(date: DateValue | null, isUnavailable: DateAvailableFn | undefined, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
22
22
|
declare function isDateOutsideRange(date: DateValue, startDate?: DateValue | null, endDate?: DateValue | null): boolean;
|
|
23
23
|
declare function isPreviousRangeInvalid(startDate: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
@@ -38,7 +38,7 @@ declare function getUnitDuration(duration: DateDuration): {
|
|
|
38
38
|
declare function getEndDate(startDate: DateValue, duration: DateDuration): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
39
39
|
|
|
40
40
|
declare function formatRange(startDate: DateValue, endDate: DateValue, formatter: DateFormatter, toString: (start: string, end: string) => string, timeZone: string): string;
|
|
41
|
-
declare function formatSelectedDate(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
41
|
+
declare function formatSelectedDate(startDate: DateValue | null | undefined, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
42
42
|
declare function formatVisibleRange(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
43
43
|
|
|
44
44
|
declare function getDayFormatter(locale: string, timeZone: string): DateFormatter;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ type DateRangePreset = "thisWeek" | "lastWeek" | "thisMonth" | "lastMonth" | "th
|
|
|
17
17
|
declare function alignDate(date: DateValue, alignment: DateAlignment, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
18
18
|
declare function alignStartDate(date: DateValue, startDate: DateValue, endDate: DateValue, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
19
19
|
|
|
20
|
-
declare function isDateEqual(dateA: DateValue, dateB?: DateValue | null): boolean;
|
|
20
|
+
declare function isDateEqual(dateA: DateValue | null | undefined, dateB?: DateValue | null): boolean;
|
|
21
21
|
declare function isDateUnavailable(date: DateValue | null, isUnavailable: DateAvailableFn | undefined, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
22
22
|
declare function isDateOutsideRange(date: DateValue, startDate?: DateValue | null, endDate?: DateValue | null): boolean;
|
|
23
23
|
declare function isPreviousRangeInvalid(startDate: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
@@ -38,7 +38,7 @@ declare function getUnitDuration(duration: DateDuration): {
|
|
|
38
38
|
declare function getEndDate(startDate: DateValue, duration: DateDuration): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
39
39
|
|
|
40
40
|
declare function formatRange(startDate: DateValue, endDate: DateValue, formatter: DateFormatter, toString: (start: string, end: string) => string, timeZone: string): string;
|
|
41
|
-
declare function formatSelectedDate(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
41
|
+
declare function formatSelectedDate(startDate: DateValue | null | undefined, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
42
42
|
declare function formatVisibleRange(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
43
43
|
|
|
44
44
|
declare function getDayFormatter(locale: string, timeZone: string): DateFormatter;
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,8 @@ function alignStartDate(date, startDate, endDate, duration, locale, min, max) {
|
|
|
84
84
|
return startDate;
|
|
85
85
|
}
|
|
86
86
|
function isDateEqual(dateA, dateB) {
|
|
87
|
-
|
|
87
|
+
if (dateA == null || dateB == null) return dateA === dateB;
|
|
88
|
+
return date.isSameDay(dateA, dateB);
|
|
88
89
|
}
|
|
89
90
|
function isDateUnavailable(date, isUnavailable, locale, minValue, maxValue) {
|
|
90
91
|
if (!date) return false;
|
|
@@ -168,6 +169,7 @@ function formatRange(startDate, endDate, formatter, toString, timeZone) {
|
|
|
168
169
|
return toString(start, end);
|
|
169
170
|
}
|
|
170
171
|
function formatSelectedDate(startDate, endDate, locale, timeZone) {
|
|
172
|
+
if (!startDate) return "";
|
|
171
173
|
let start = startDate;
|
|
172
174
|
let end = endDate ?? startDate;
|
|
173
175
|
let formatter = getDayFormatter(locale, timeZone);
|
package/dist/index.mjs
CHANGED
|
@@ -82,7 +82,8 @@ function alignStartDate(date, startDate, endDate, duration, locale, min, max) {
|
|
|
82
82
|
return startDate;
|
|
83
83
|
}
|
|
84
84
|
function isDateEqual(dateA, dateB) {
|
|
85
|
-
|
|
85
|
+
if (dateA == null || dateB == null) return dateA === dateB;
|
|
86
|
+
return isSameDay(dateA, dateB);
|
|
86
87
|
}
|
|
87
88
|
function isDateUnavailable(date, isUnavailable, locale, minValue, maxValue) {
|
|
88
89
|
if (!date) return false;
|
|
@@ -166,6 +167,7 @@ function formatRange(startDate, endDate, formatter, toString, timeZone) {
|
|
|
166
167
|
return toString(start, end);
|
|
167
168
|
}
|
|
168
169
|
function formatSelectedDate(startDate, endDate, locale, timeZone) {
|
|
170
|
+
if (!startDate) return "";
|
|
169
171
|
let start = startDate;
|
|
170
172
|
let end = endDate ?? startDate;
|
|
171
173
|
let formatter = getDayFormatter(locale, timeZone);
|