@zag-js/date-utils 0.0.0-dev-20230328135440 → 0.0.0-dev-20230404094522
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/align.d.ts +3 -3
- package/dist/assertion.d.ts +6 -6
- package/dist/{chunk-LQAXQPWP.mjs → chunk-6LXTZHZP.mjs} +1 -1
- package/dist/{chunk-ZZPZ2BFS.mjs → chunk-CGHY7FCH.mjs} +2 -2
- package/dist/{chunk-ODG5YF5H.mjs → chunk-FJKH6IJZ.mjs} +2 -2
- package/dist/{chunk-CAYCTIEJ.mjs → chunk-KQVWH4YA.mjs} +1 -1
- package/dist/{chunk-KFJ757ZA.mjs → chunk-NV7UFBMY.mjs} +1 -3
- package/dist/{chunk-VTFZA34K.mjs → chunk-TD43VTZC.mjs} +1 -0
- package/dist/{chunk-U3OBXRHI.mjs → chunk-WQYMLJUJ.mjs} +3 -3
- package/dist/constrain.d.ts +6 -6
- package/dist/duration.d.ts +3 -2
- package/dist/format-date.d.ts +2 -2
- package/dist/format-range.d.ts +2 -2
- package/dist/format-selected-date.d.ts +2 -2
- package/dist/format-selected-date.js +1 -1
- package/dist/format-selected-date.mjs +2 -2
- package/dist/format-visible-range.d.ts +2 -2
- package/dist/format-visible-range.js +1 -1
- package/dist/format-visible-range.mjs +2 -2
- package/dist/get-day-formatter.js +1 -1
- package/dist/get-day-formatter.mjs +1 -1
- package/dist/get-end-of-week.d.ts +3 -2
- package/dist/get-era-format.d.ts +2 -2
- package/dist/get-month-days.d.ts +3 -3
- package/dist/get-month-days.js +1 -3
- package/dist/get-month-days.mjs +1 -1
- package/dist/get-start-of-week.d.ts +3 -2
- package/dist/get-week-days.d.ts +4 -3
- package/dist/get-weekday-formats.d.ts +2 -2
- package/dist/index.js +6 -7
- package/dist/index.mjs +7 -7
- package/dist/mutation.d.ts +10 -9
- package/dist/mutation.js +1 -1
- package/dist/mutation.mjs +1 -1
- package/dist/pagination.d.ts +40 -39
- package/dist/pagination.js +1 -0
- package/dist/pagination.mjs +1 -1
- package/dist/parse-date.d.ts +2 -2
- package/dist/parse-date.js +2 -2
- package/dist/parse-date.mjs +1 -1
- package/dist/types.d.ts +6 -6
- package/package.json +1 -1
package/dist/align.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue, DateDuration } from '@internationalized/date';
|
|
2
2
|
import { DateAlignment } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare function alignDate(date:
|
|
5
|
-
declare function alignStartDate(date:
|
|
4
|
+
declare function alignDate(date: DateValue, alignment: DateAlignment, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
5
|
+
declare function alignStartDate(date: DateValue, startDate: DateValue, endDate: DateValue, duration: DateDuration, locale: string, min?: DateValue | undefined, max?: DateValue | undefined): DateValue;
|
|
6
6
|
|
|
7
7
|
export { alignDate, alignStartDate };
|
package/dist/assertion.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
import { DateAvailableFn } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare function isTodayDate(date:
|
|
5
|
-
declare function isDateEqual(dateA:
|
|
4
|
+
declare function isTodayDate(date: DateValue, timeZone: string): boolean;
|
|
5
|
+
declare function isDateEqual(dateA: DateValue, dateB?: DateValue | null): boolean;
|
|
6
6
|
declare function isDateInvalid(date: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
7
7
|
declare function isDateDisabled(date: DateValue, startDate: DateValue, endDate: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
8
8
|
declare function isDateUnavailable(date: DateValue | null, isUnavailable: DateAvailableFn | undefined, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
9
|
-
declare function isDateOutsideVisibleRange(date:
|
|
10
|
-
declare function isPreviousVisibleRangeInvalid(startDate:
|
|
11
|
-
declare function isNextVisibleRangeInvalid(endDate:
|
|
9
|
+
declare function isDateOutsideVisibleRange(date: DateValue, startDate: DateValue, endDate: DateValue): boolean;
|
|
10
|
+
declare function isPreviousVisibleRangeInvalid(startDate: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
11
|
+
declare function isNextVisibleRangeInvalid(endDate: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean;
|
|
12
12
|
|
|
13
13
|
export { isDateDisabled, isDateEqual, isDateInvalid, isDateOutsideVisibleRange, isDateUnavailable, isNextVisibleRangeInvalid, isPreviousVisibleRangeInvalid, isTodayDate };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MGPXEJO4.mjs";
|
|
4
4
|
|
|
5
5
|
// src/mutation.ts
|
|
6
|
-
import { toCalendar,
|
|
6
|
+
import { toCalendar, toCalendarDateTime, today } from "@internationalized/date";
|
|
7
7
|
function getTodayDate(timezone) {
|
|
8
8
|
return today(timezone);
|
|
9
9
|
}
|
|
@@ -20,7 +20,7 @@ function setYear(date, year) {
|
|
|
20
20
|
return date.set({ year });
|
|
21
21
|
}
|
|
22
22
|
function setCalendar(date, calendar) {
|
|
23
|
-
return toCalendar(
|
|
23
|
+
return toCalendar(toCalendarDateTime(date), calendar);
|
|
24
24
|
}
|
|
25
25
|
function setDate(date, startDate, isDateUnavailable, minValue, maxValue) {
|
|
26
26
|
let result;
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
} from "./chunk-KN3YMOSL.mjs";
|
|
4
4
|
|
|
5
5
|
// src/get-day-formatter.ts
|
|
6
|
-
import { DateFormatter,
|
|
6
|
+
import { DateFormatter, toCalendarDateTime, today } from "@internationalized/date";
|
|
7
7
|
function getDayFormatter(locale, timeZone) {
|
|
8
|
-
const date =
|
|
8
|
+
const date = toCalendarDateTime(today(timeZone));
|
|
9
9
|
return new DateFormatter(locale, {
|
|
10
10
|
weekday: "long",
|
|
11
11
|
month: "long",
|
|
@@ -21,9 +21,7 @@ function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
|
21
21
|
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
22
22
|
const monthWeeks = getWeeksInMonth(from, locale);
|
|
23
23
|
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
24
|
-
return weeks.map((week) =>
|
|
25
|
-
return getDaysInWeek(week, from, locale, firstDayOfWeek);
|
|
26
|
-
});
|
|
24
|
+
return weeks.map((week) => getDaysInWeek(week, from, locale, firstDayOfWeek));
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
export {
|
|
@@ -126,6 +126,7 @@ function getSectionEnd(focusedDate, startDate, visibleDuration, locale, minValue
|
|
|
126
126
|
}
|
|
127
127
|
if (visibleDuration.weeks) {
|
|
128
128
|
return adjust({
|
|
129
|
+
//@ts-expect-error - endOfWeek is loosely typed
|
|
129
130
|
focusedDate: endOfWeek(focusedDate, locale),
|
|
130
131
|
startDate
|
|
131
132
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// src/parse-date.ts
|
|
2
|
-
import {
|
|
2
|
+
import { CalendarDateTime, DateFormatter } from "@internationalized/date";
|
|
3
3
|
function parseDateString(date, locale, timeZone) {
|
|
4
4
|
const regex = createRegex(locale, timeZone);
|
|
5
5
|
const { year, month, day } = extract(regex, date) ?? {};
|
|
6
6
|
if (year != null && year.length === 4 && month != null && +month <= 12 && day != null && +day <= 31) {
|
|
7
|
-
return new
|
|
7
|
+
return new CalendarDateTime(+year, +month, +day);
|
|
8
8
|
}
|
|
9
9
|
const time = Date.parse(date);
|
|
10
10
|
if (!isNaN(time)) {
|
|
11
11
|
const date2 = new Date(time);
|
|
12
|
-
return new
|
|
12
|
+
return new CalendarDateTime(date2.getFullYear(), date2.getMonth() + 1, date2.getDate());
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
function createRegex(locale, timeZone) {
|
package/dist/constrain.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue, DateDuration } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function alignCenter(date:
|
|
4
|
-
declare function alignStart(date:
|
|
5
|
-
declare function alignEnd(date:
|
|
6
|
-
declare function constrainStart(date:
|
|
7
|
-
declare function constrainValue(date:
|
|
3
|
+
declare function alignCenter(date: DateValue, duration: DateDuration, locale: string, min?: DateValue, max?: DateValue): DateValue;
|
|
4
|
+
declare function alignStart(date: DateValue, duration: DateDuration, locale: string, min?: DateValue, max?: DateValue): DateValue;
|
|
5
|
+
declare function alignEnd(date: DateValue, duration: DateDuration, locale: string, min?: DateValue, max?: DateValue): DateValue;
|
|
6
|
+
declare function constrainStart(date: DateValue, aligned: DateValue, duration: DateDuration, locale: string, min?: DateValue, max?: DateValue): DateValue;
|
|
7
|
+
declare function constrainValue(date: DateValue, minValue?: DateValue, maxValue?: DateValue): DateValue;
|
|
8
8
|
|
|
9
9
|
export { alignCenter, alignEnd, alignStart, constrainStart, constrainValue };
|
package/dist/duration.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateDuration, DateValue } from '@internationalized/date';
|
|
2
3
|
|
|
3
4
|
declare function getUnitDuration(duration: DateDuration): {
|
|
4
5
|
years?: number | undefined;
|
|
@@ -6,6 +7,6 @@ declare function getUnitDuration(duration: DateDuration): {
|
|
|
6
7
|
weeks?: number | undefined;
|
|
7
8
|
days?: number | undefined;
|
|
8
9
|
};
|
|
9
|
-
declare function getEndDate(startDate:
|
|
10
|
+
declare function getEndDate(startDate: DateValue, duration: DateDuration): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
10
11
|
|
|
11
12
|
export { getEndDate, getUnitDuration };
|
package/dist/format-date.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Formats a date using the given format string as defined in:
|
|
5
5
|
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
6
6
|
*/
|
|
7
|
-
declare function formatDate(value:
|
|
7
|
+
declare function formatDate(value: DateValue, formatString: string, locale: string, timeZone?: string): string;
|
|
8
8
|
|
|
9
9
|
export { formatDate };
|
package/dist/format-range.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue, DateFormatter } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function formatRange(startDate:
|
|
3
|
+
declare function formatRange(startDate: DateValue, endDate: DateValue, formatter: DateFormatter, toString: (start: string, end: string) => string, timeZone: string): string;
|
|
4
4
|
|
|
5
5
|
export { formatRange };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function formatSelectedDate(startDate:
|
|
3
|
+
declare function formatSelectedDate(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
4
4
|
|
|
5
5
|
export { formatSelectedDate };
|
|
@@ -59,7 +59,7 @@ function getEraFormat(date) {
|
|
|
59
59
|
|
|
60
60
|
// src/get-day-formatter.ts
|
|
61
61
|
function getDayFormatter(locale, timeZone) {
|
|
62
|
-
const date = (0, import_date.
|
|
62
|
+
const date = (0, import_date.toCalendarDateTime)((0, import_date.today)(timeZone));
|
|
63
63
|
return new import_date.DateFormatter(locale, {
|
|
64
64
|
weekday: "long",
|
|
65
65
|
month: "long",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function formatVisibleRange(startDate:
|
|
3
|
+
declare function formatVisibleRange(startDate: DateValue, endDate: DateValue | null, locale: string, timeZone: string): string;
|
|
4
4
|
|
|
5
5
|
export { formatVisibleRange };
|
|
@@ -35,7 +35,7 @@ function getEraFormat(date) {
|
|
|
35
35
|
|
|
36
36
|
// src/get-day-formatter.ts
|
|
37
37
|
function getDayFormatter(locale, timeZone) {
|
|
38
|
-
const date = (0, import_date.
|
|
38
|
+
const date = (0, import_date.toCalendarDateTime)((0, import_date.today)(timeZone));
|
|
39
39
|
return new import_date.DateFormatter(locale, {
|
|
40
40
|
weekday: "long",
|
|
41
41
|
month: "long",
|
|
@@ -32,7 +32,7 @@ function getEraFormat(date) {
|
|
|
32
32
|
|
|
33
33
|
// src/get-day-formatter.ts
|
|
34
34
|
function getDayFormatter(locale, timeZone) {
|
|
35
|
-
const date = (0, import_date.
|
|
35
|
+
const date = (0, import_date.toCalendarDateTime)((0, import_date.today)(timeZone));
|
|
36
36
|
return new import_date.DateFormatter(locale, {
|
|
37
37
|
weekday: "long",
|
|
38
38
|
month: "long",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateValue } from '@internationalized/date';
|
|
2
3
|
|
|
3
|
-
declare function getEndOfWeek(date:
|
|
4
|
+
declare function getEndOfWeek(date: DateValue, locale: string, firstDayOfWeek?: number): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
4
5
|
|
|
5
6
|
export { getEndOfWeek };
|
package/dist/get-era-format.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function getEraFormat(date:
|
|
3
|
+
declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
|
4
4
|
|
|
5
5
|
export { getEraFormat };
|
package/dist/get-month-days.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function getDaysInWeek(weekIndex: number, from:
|
|
4
|
-
declare function getMonthDays(from:
|
|
3
|
+
declare function getDaysInWeek(weekIndex: number, from: DateValue, locale: string, firstDayOfWeek?: number): (DateValue | null)[];
|
|
4
|
+
declare function getMonthDays(from: DateValue, locale: string, numOfWeeks?: number, firstDayOfWeek?: number): (DateValue | null)[][];
|
|
5
5
|
|
|
6
6
|
export { getDaysInWeek, getMonthDays };
|
package/dist/get-month-days.js
CHANGED
|
@@ -52,9 +52,7 @@ function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
|
52
52
|
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
53
53
|
const monthWeeks = (0, import_date2.getWeeksInMonth)(from, locale);
|
|
54
54
|
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
55
|
-
return weeks.map((week) =>
|
|
56
|
-
return getDaysInWeek(week, from, locale, firstDayOfWeek);
|
|
57
|
-
});
|
|
55
|
+
return weeks.map((week) => getDaysInWeek(week, from, locale, firstDayOfWeek));
|
|
58
56
|
}
|
|
59
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60
58
|
0 && (module.exports = {
|
package/dist/get-month-days.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateValue } from '@internationalized/date';
|
|
2
3
|
|
|
3
|
-
declare function getStartOfWeek(date:
|
|
4
|
+
declare function getStartOfWeek(date: DateValue, locale: string, firstDayOfWeek?: number): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
4
5
|
|
|
5
6
|
export { getStartOfWeek };
|
package/dist/get-week-days.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateValue } from '@internationalized/date';
|
|
2
3
|
|
|
3
|
-
declare function getWeekDays(date:
|
|
4
|
-
value: CalendarDate;
|
|
4
|
+
declare function getWeekDays(date: DateValue, startOfWeekProp: number | undefined, timeZone: string, locale: string): {
|
|
5
|
+
value: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
5
6
|
short: string;
|
|
6
7
|
long: string;
|
|
7
8
|
narrow: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function getWeekdayFormats(locale: string, timeZone: string): <T extends
|
|
3
|
+
declare function getWeekdayFormats(locale: string, timeZone: string): <T extends DateValue | Date>(value: T) => {
|
|
4
4
|
value: T;
|
|
5
5
|
short: string;
|
|
6
6
|
long: string;
|
package/dist/index.js
CHANGED
|
@@ -292,7 +292,7 @@ function getEraFormat(date) {
|
|
|
292
292
|
|
|
293
293
|
// src/get-day-formatter.ts
|
|
294
294
|
function getDayFormatter(locale, timeZone) {
|
|
295
|
-
const date = (0, import_date4.
|
|
295
|
+
const date = (0, import_date4.toCalendarDateTime)((0, import_date4.today)(timeZone));
|
|
296
296
|
return new import_date4.DateFormatter(locale, {
|
|
297
297
|
weekday: "long",
|
|
298
298
|
month: "long",
|
|
@@ -388,9 +388,7 @@ function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
|
388
388
|
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
389
389
|
const monthWeeks = (0, import_date9.getWeeksInMonth)(from, locale);
|
|
390
390
|
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
391
|
-
return weeks.map((week) =>
|
|
392
|
-
return getDaysInWeek(week, from, locale, firstDayOfWeek);
|
|
393
|
-
});
|
|
391
|
+
return weeks.map((week) => getDaysInWeek(week, from, locale, firstDayOfWeek));
|
|
394
392
|
}
|
|
395
393
|
|
|
396
394
|
// src/get-month-names.ts
|
|
@@ -456,7 +454,7 @@ function setYear(date, year) {
|
|
|
456
454
|
return date.set({ year });
|
|
457
455
|
}
|
|
458
456
|
function setCalendar(date, calendar) {
|
|
459
|
-
return (0, import_date11.toCalendar)((0, import_date11.
|
|
457
|
+
return (0, import_date11.toCalendar)((0, import_date11.toCalendarDateTime)(date), calendar);
|
|
460
458
|
}
|
|
461
459
|
function setDate(date, startDate, isDateUnavailable2, minValue, maxValue) {
|
|
462
460
|
let result;
|
|
@@ -590,6 +588,7 @@ function getSectionEnd(focusedDate, startDate, visibleDuration, locale, minValue
|
|
|
590
588
|
}
|
|
591
589
|
if (visibleDuration.weeks) {
|
|
592
590
|
return adjust({
|
|
591
|
+
//@ts-expect-error - endOfWeek is loosely typed
|
|
593
592
|
focusedDate: (0, import_date12.endOfWeek)(focusedDate, locale),
|
|
594
593
|
startDate
|
|
595
594
|
});
|
|
@@ -656,12 +655,12 @@ function parseDateString(date, locale, timeZone) {
|
|
|
656
655
|
const regex = createRegex(locale, timeZone);
|
|
657
656
|
const { year, month, day } = extract(regex, date) ?? {};
|
|
658
657
|
if (year != null && year.length === 4 && month != null && +month <= 12 && day != null && +day <= 31) {
|
|
659
|
-
return new import_date13.
|
|
658
|
+
return new import_date13.CalendarDateTime(+year, +month, +day);
|
|
660
659
|
}
|
|
661
660
|
const time = Date.parse(date);
|
|
662
661
|
if (!isNaN(time)) {
|
|
663
662
|
const date2 = new Date(time);
|
|
664
|
-
return new import_date13.
|
|
663
|
+
return new import_date13.CalendarDateTime(date2.getFullYear(), date2.getMonth() + 1, date2.getDate());
|
|
665
664
|
}
|
|
666
665
|
}
|
|
667
666
|
function createRegex(locale, timeZone) {
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
setDate,
|
|
17
17
|
setMonth,
|
|
18
18
|
setYear
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CGHY7FCH.mjs";
|
|
20
20
|
import {
|
|
21
21
|
getAdjustedDateFn,
|
|
22
22
|
getNextPage,
|
|
@@ -27,17 +27,17 @@ import {
|
|
|
27
27
|
getPreviousSection,
|
|
28
28
|
getSectionEnd,
|
|
29
29
|
getSectionStart
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-TD43VTZC.mjs";
|
|
31
31
|
import {
|
|
32
32
|
parseDateString
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WQYMLJUJ.mjs";
|
|
34
34
|
import {
|
|
35
35
|
getDecadeRange
|
|
36
36
|
} from "./chunk-G4VVKINZ.mjs";
|
|
37
37
|
import {
|
|
38
38
|
getDaysInWeek,
|
|
39
39
|
getMonthDays
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-NV7UFBMY.mjs";
|
|
41
41
|
import {
|
|
42
42
|
getMonthNames
|
|
43
43
|
} from "./chunk-5HGHDJ3L.mjs";
|
|
@@ -72,19 +72,19 @@ import {
|
|
|
72
72
|
} from "./chunk-KBGJA6NB.mjs";
|
|
73
73
|
import {
|
|
74
74
|
formatSelectedDate
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-6LXTZHZP.mjs";
|
|
76
76
|
import {
|
|
77
77
|
formatRange
|
|
78
78
|
} from "./chunk-HKHGJ6WS.mjs";
|
|
79
79
|
import {
|
|
80
80
|
formatVisibleRange
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-KQVWH4YA.mjs";
|
|
82
82
|
import {
|
|
83
83
|
getMonthFormatter
|
|
84
84
|
} from "./chunk-LGEGBP3O.mjs";
|
|
85
85
|
import {
|
|
86
86
|
getDayFormatter
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-FJKH6IJZ.mjs";
|
|
88
88
|
import "./chunk-KN3YMOSL.mjs";
|
|
89
89
|
export {
|
|
90
90
|
alignCenter,
|
package/dist/mutation.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateValue, Calendar } from '@internationalized/date';
|
|
2
3
|
import { DateAvailableFn } from './types.js';
|
|
3
4
|
|
|
4
|
-
declare function getTodayDate(timezone: string): CalendarDate;
|
|
5
|
-
declare function getNextDay(date:
|
|
6
|
-
declare function getPreviousDay(date:
|
|
7
|
-
declare function setMonth(date:
|
|
8
|
-
declare function setYear(date:
|
|
9
|
-
declare function setCalendar(date:
|
|
10
|
-
declare function setDate(date:
|
|
11
|
-
declare function getPreviousAvailableDate(date:
|
|
5
|
+
declare function getTodayDate(timezone: string): _internationalized_date.CalendarDate;
|
|
6
|
+
declare function getNextDay(date: DateValue): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
7
|
+
declare function getPreviousDay(date: DateValue): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
8
|
+
declare function setMonth(date: DateValue, month: number): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
9
|
+
declare function setYear(date: DateValue, year: number): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
10
|
+
declare function setCalendar(date: DateValue, calendar: Calendar): _internationalized_date.CalendarDateTime;
|
|
11
|
+
declare function setDate(date: DateValue, startDate: DateValue, isDateUnavailable: DateAvailableFn, minValue: DateValue, maxValue: DateValue): DateValue | undefined;
|
|
12
|
+
declare function getPreviousAvailableDate(date: DateValue, minValue: DateValue, isDateUnavailable?: DateAvailableFn): DateValue | undefined;
|
|
12
13
|
|
|
13
14
|
export { getNextDay, getPreviousAvailableDate, getPreviousDay, getTodayDate, setCalendar, setDate, setMonth, setYear };
|
package/dist/mutation.js
CHANGED
|
@@ -61,7 +61,7 @@ function setYear(date, year) {
|
|
|
61
61
|
return date.set({ year });
|
|
62
62
|
}
|
|
63
63
|
function setCalendar(date, calendar) {
|
|
64
|
-
return (0, import_date2.toCalendar)((0, import_date2.
|
|
64
|
+
return (0, import_date2.toCalendar)((0, import_date2.toCalendarDateTime)(date), calendar);
|
|
65
65
|
}
|
|
66
66
|
function setDate(date, startDate, isDateUnavailable, minValue, maxValue) {
|
|
67
67
|
let result;
|
package/dist/mutation.mjs
CHANGED
package/dist/pagination.d.ts
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _internationalized_date from '@internationalized/date';
|
|
2
|
+
import { DateDuration, DateValue } from '@internationalized/date';
|
|
2
3
|
|
|
3
|
-
declare function getAdjustedDateFn(visibleDuration: DateDuration, locale: string, minValue?:
|
|
4
|
-
startDate:
|
|
5
|
-
focusedDate:
|
|
4
|
+
declare function getAdjustedDateFn(visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): (options: {
|
|
5
|
+
startDate: DateValue;
|
|
6
|
+
focusedDate: DateValue;
|
|
6
7
|
}) => {
|
|
7
|
-
startDate:
|
|
8
|
-
focusedDate:
|
|
9
|
-
endDate: CalendarDate;
|
|
8
|
+
startDate: DateValue;
|
|
9
|
+
focusedDate: DateValue;
|
|
10
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
10
11
|
};
|
|
11
|
-
declare function getNextPage(focusedDate:
|
|
12
|
-
startDate:
|
|
13
|
-
focusedDate:
|
|
14
|
-
endDate: CalendarDate;
|
|
12
|
+
declare function getNextPage(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
13
|
+
startDate: DateValue;
|
|
14
|
+
focusedDate: DateValue;
|
|
15
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
15
16
|
};
|
|
16
|
-
declare function getPreviousPage(focusedDate:
|
|
17
|
-
startDate:
|
|
18
|
-
focusedDate:
|
|
19
|
-
endDate: CalendarDate;
|
|
17
|
+
declare function getPreviousPage(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
18
|
+
startDate: DateValue;
|
|
19
|
+
focusedDate: DateValue;
|
|
20
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
20
21
|
};
|
|
21
|
-
declare function getNextRow(focusedDate:
|
|
22
|
-
startDate:
|
|
23
|
-
focusedDate:
|
|
24
|
-
endDate: CalendarDate;
|
|
22
|
+
declare function getNextRow(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
23
|
+
startDate: DateValue;
|
|
24
|
+
focusedDate: DateValue;
|
|
25
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
25
26
|
} | undefined;
|
|
26
|
-
declare function getPreviousRow(focusedDate:
|
|
27
|
-
startDate:
|
|
28
|
-
focusedDate:
|
|
29
|
-
endDate: CalendarDate;
|
|
27
|
+
declare function getPreviousRow(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
28
|
+
startDate: DateValue;
|
|
29
|
+
focusedDate: DateValue;
|
|
30
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
30
31
|
} | undefined;
|
|
31
|
-
declare function getSectionStart(focusedDate:
|
|
32
|
-
startDate:
|
|
33
|
-
focusedDate:
|
|
34
|
-
endDate: CalendarDate;
|
|
32
|
+
declare function getSectionStart(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
33
|
+
startDate: DateValue;
|
|
34
|
+
focusedDate: DateValue;
|
|
35
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
35
36
|
} | undefined;
|
|
36
|
-
declare function getSectionEnd(focusedDate:
|
|
37
|
-
startDate:
|
|
38
|
-
focusedDate:
|
|
39
|
-
endDate: CalendarDate;
|
|
37
|
+
declare function getSectionEnd(focusedDate: DateValue, startDate: DateValue, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
38
|
+
startDate: DateValue;
|
|
39
|
+
focusedDate: DateValue;
|
|
40
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
40
41
|
} | undefined;
|
|
41
|
-
declare function getNextSection(focusedDate:
|
|
42
|
-
startDate:
|
|
43
|
-
focusedDate:
|
|
44
|
-
endDate: CalendarDate;
|
|
42
|
+
declare function getNextSection(focusedDate: DateValue, startDate: DateValue, larger: boolean, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
43
|
+
startDate: DateValue;
|
|
44
|
+
focusedDate: DateValue;
|
|
45
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
45
46
|
} | undefined;
|
|
46
|
-
declare function getPreviousSection(focusedDate:
|
|
47
|
-
startDate:
|
|
48
|
-
focusedDate:
|
|
49
|
-
endDate: CalendarDate;
|
|
47
|
+
declare function getPreviousSection(focusedDate: DateValue, startDate: DateValue, larger: boolean, visibleDuration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue): {
|
|
48
|
+
startDate: DateValue;
|
|
49
|
+
focusedDate: DateValue;
|
|
50
|
+
endDate: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
50
51
|
} | undefined;
|
|
51
52
|
|
|
52
53
|
export { getAdjustedDateFn, getNextPage, getNextRow, getNextSection, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart };
|
package/dist/pagination.js
CHANGED
|
@@ -216,6 +216,7 @@ function getSectionEnd(focusedDate, startDate, visibleDuration, locale, minValue
|
|
|
216
216
|
}
|
|
217
217
|
if (visibleDuration.weeks) {
|
|
218
218
|
return adjust({
|
|
219
|
+
//@ts-expect-error - endOfWeek is loosely typed
|
|
219
220
|
focusedDate: (0, import_date3.endOfWeek)(focusedDate, locale),
|
|
220
221
|
startDate
|
|
221
222
|
});
|
package/dist/pagination.mjs
CHANGED
package/dist/parse-date.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalendarDateTime } from '@internationalized/date';
|
|
2
2
|
|
|
3
|
-
declare function parseDateString(date: string, locale: string, timeZone: string):
|
|
3
|
+
declare function parseDateString(date: string, locale: string, timeZone: string): CalendarDateTime | undefined;
|
|
4
4
|
|
|
5
5
|
export { parseDateString };
|
package/dist/parse-date.js
CHANGED
|
@@ -28,12 +28,12 @@ function parseDateString(date, locale, timeZone) {
|
|
|
28
28
|
const regex = createRegex(locale, timeZone);
|
|
29
29
|
const { year, month, day } = extract(regex, date) ?? {};
|
|
30
30
|
if (year != null && year.length === 4 && month != null && +month <= 12 && day != null && +day <= 31) {
|
|
31
|
-
return new import_date.
|
|
31
|
+
return new import_date.CalendarDateTime(+year, +month, +day);
|
|
32
32
|
}
|
|
33
33
|
const time = Date.parse(date);
|
|
34
34
|
if (!isNaN(time)) {
|
|
35
35
|
const date2 = new Date(time);
|
|
36
|
-
return new import_date.
|
|
36
|
+
return new import_date.CalendarDateTime(date2.getFullYear(), date2.getMonth() + 1, date2.getDate());
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function createRegex(locale, timeZone) {
|
package/dist/parse-date.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateFormatter, DateValue
|
|
1
|
+
import { DateFormatter, DateValue } from '@internationalized/date';
|
|
2
2
|
|
|
3
3
|
type DateGranularity = "day" | "hour" | "minute" | "second" | "year" | "month";
|
|
4
4
|
type DateAlignment = "start" | "end" | "center";
|
|
@@ -9,12 +9,12 @@ type GetPlaceholderFn = (options: {
|
|
|
9
9
|
locale: string;
|
|
10
10
|
}) => string;
|
|
11
11
|
type DateAdjustFn = (options: {
|
|
12
|
-
startDate:
|
|
13
|
-
focusedDate:
|
|
12
|
+
startDate: DateValue;
|
|
13
|
+
focusedDate: DateValue;
|
|
14
14
|
}) => {
|
|
15
|
-
startDate:
|
|
16
|
-
focusedDate:
|
|
17
|
-
endDate:
|
|
15
|
+
startDate: DateValue;
|
|
16
|
+
focusedDate: DateValue;
|
|
17
|
+
endDate: DateValue;
|
|
18
18
|
};
|
|
19
19
|
type DateFormatOptions = Intl.ResolvedDateTimeFormatOptions;
|
|
20
20
|
|