@zag-js/date-utils 0.1.2 → 0.1.4
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/chunk-5HGHDJ3L.mjs +14 -0
- package/dist/chunk-AMZ7CJ5F.mjs +18 -0
- package/dist/chunk-CAYCTIEJ.mjs +29 -0
- package/dist/chunk-G4VVKINZ.mjs +14 -0
- package/dist/chunk-KBGJA6NB.mjs +55 -0
- package/dist/chunk-KFJ757ZA.mjs +32 -0
- package/dist/chunk-KLHRN7WS.mjs +20 -0
- package/dist/chunk-KN3YMOSL.mjs +8 -0
- package/dist/chunk-LGEGBP3O.mjs +20 -0
- package/dist/{chunk-NXMEZINO.mjs → chunk-LQAXQPWP.mjs} +4 -7
- package/dist/chunk-ODG5YF5H.mjs +21 -0
- package/dist/chunk-SI75FOJ2.mjs +11 -0
- package/dist/chunk-U3OBXRHI.mjs +42 -0
- package/dist/format-date.d.ts +9 -0
- package/dist/format-date.js +79 -0
- package/dist/format-date.mjs +6 -0
- package/dist/format-selected-date.d.ts +1 -2
- package/dist/format-selected-date.js +14 -14
- package/dist/format-selected-date.mjs +3 -2
- package/dist/format-visible-range.d.ts +1 -2
- package/dist/format-visible-range.js +29 -50
- package/dist/format-visible-range.mjs +4 -3
- package/dist/get-day-formatter.d.ts +5 -0
- package/dist/{placeholder.js → get-day-formatter.js} +22 -21
- package/dist/get-day-formatter.mjs +7 -0
- package/dist/get-decade-range.d.ts +3 -0
- package/dist/get-decade-range.js +38 -0
- package/dist/get-decade-range.mjs +6 -0
- package/dist/get-end-of-week.d.ts +5 -0
- package/dist/{segment-constants.js → get-end-of-week.js} +17 -32
- package/dist/get-end-of-week.mjs +11 -0
- package/dist/get-era-format.d.ts +5 -0
- package/dist/get-era-format.js +32 -0
- package/dist/get-era-format.mjs +6 -0
- package/dist/get-month-days.d.ts +6 -0
- package/dist/{get-month-dates.js → get-month-days.js} +26 -27
- package/dist/get-month-days.mjs +9 -0
- package/dist/get-month-formatter.d.ts +5 -0
- package/dist/{get-formatter.js → get-month-formatter.js} +14 -26
- package/dist/get-month-formatter.mjs +7 -0
- package/dist/get-month-names.d.ts +3 -0
- package/dist/get-month-names.js +38 -0
- package/dist/get-month-names.mjs +6 -0
- package/dist/get-start-of-week.d.ts +5 -0
- package/dist/get-start-of-week.js +35 -0
- package/dist/get-start-of-week.mjs +6 -0
- package/dist/get-week-days.d.ts +10 -0
- package/dist/get-week-days.js +62 -0
- package/dist/get-week-days.mjs +8 -0
- package/dist/get-weekday-formats.d.ts +10 -0
- package/dist/get-weekday-formats.js +44 -0
- package/dist/get-weekday-formats.mjs +6 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +223 -307
- package/dist/index.mjs +40 -41
- package/dist/parse-date.d.ts +5 -0
- package/dist/parse-date.js +66 -0
- package/dist/parse-date.mjs +6 -0
- package/dist/types.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunk-55BYHK5B.mjs +0 -31
- package/dist/chunk-DZM5JUL2.mjs +0 -22
- package/dist/chunk-ETRHBIGD.mjs +0 -66
- package/dist/chunk-GLQDJRSE.mjs +0 -31
- package/dist/chunk-JZVHAOWX.mjs +0 -35
- package/dist/chunk-MGRIF22W.mjs +0 -18
- package/dist/chunk-SQCHVCXH.mjs +0 -42
- package/dist/chunk-TSOWYV6W.mjs +0 -34
- package/dist/chunk-U6WRBS5P.mjs +0 -77
- package/dist/get-formatter.d.ts +0 -8
- package/dist/get-formatter.mjs +0 -8
- package/dist/get-month-dates.d.ts +0 -5
- package/dist/get-month-dates.mjs +0 -7
- package/dist/get-week-dates.d.ts +0 -7
- package/dist/get-week-dates.js +0 -60
- package/dist/get-week-dates.mjs +0 -8
- package/dist/placeholder.d.ts +0 -7
- package/dist/placeholder.mjs +0 -8
- package/dist/segment-constants.d.ts +0 -27
- package/dist/segment-constants.mjs +0 -10
- package/dist/segment-limit.d.ts +0 -10
- package/dist/segment-limit.js +0 -101
- package/dist/segment-limit.mjs +0 -6
- package/dist/segment-mutation.d.ts +0 -7
- package/dist/segment-mutation.js +0 -91
- package/dist/segment-mutation.mjs +0 -8
- package/dist/segment-parts.d.ts +0 -27
- package/dist/segment-parts.js +0 -159
- package/dist/segment-parts.mjs +0 -11
|
@@ -17,31 +17,32 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
getTodayPlaceholderDate: () => getTodayPlaceholderDate
|
|
20
|
+
// src/get-day-formatter.ts
|
|
21
|
+
var get_day_formatter_exports = {};
|
|
22
|
+
__export(get_day_formatter_exports, {
|
|
23
|
+
getDayFormatter: () => getDayFormatter
|
|
25
24
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(get_day_formatter_exports);
|
|
27
26
|
var import_date = require("@internationalized/date");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
second: 0,
|
|
33
|
-
millisecond: 0
|
|
34
|
-
});
|
|
27
|
+
|
|
28
|
+
// src/get-era-format.ts
|
|
29
|
+
function getEraFormat(date) {
|
|
30
|
+
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
|
|
33
|
+
// src/get-day-formatter.ts
|
|
34
|
+
function getDayFormatter(locale, timeZone) {
|
|
35
|
+
const date = (0, import_date.toCalendarDate)((0, import_date.today)(timeZone));
|
|
36
|
+
return new import_date.DateFormatter(locale, {
|
|
37
|
+
weekday: "long",
|
|
38
|
+
month: "long",
|
|
39
|
+
year: "numeric",
|
|
40
|
+
day: "numeric",
|
|
41
|
+
era: getEraFormat(date),
|
|
42
|
+
timeZone
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
46
|
0 && (module.exports = {
|
|
45
|
-
|
|
46
|
-
getTodayPlaceholderDate
|
|
47
|
+
getDayFormatter
|
|
47
48
|
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-decade-range.ts
|
|
21
|
+
var get_decade_range_exports = {};
|
|
22
|
+
__export(get_decade_range_exports, {
|
|
23
|
+
getDecadeRange: () => getDecadeRange
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_decade_range_exports);
|
|
26
|
+
function getDecadeRange(year) {
|
|
27
|
+
const computedYear = year - year % 10 - 1;
|
|
28
|
+
const years = [];
|
|
29
|
+
for (let i = 0; i < 12; i += 1) {
|
|
30
|
+
const value = computedYear + i;
|
|
31
|
+
years.push(value);
|
|
32
|
+
}
|
|
33
|
+
return years;
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
getDecadeRange
|
|
38
|
+
});
|
|
@@ -17,41 +17,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
getSegmentPageStep: () => getSegmentPageStep,
|
|
25
|
-
isSegmentEditable: () => isSegmentEditable
|
|
20
|
+
// src/get-end-of-week.ts
|
|
21
|
+
var get_end_of_week_exports = {};
|
|
22
|
+
__export(get_end_of_week_exports, {
|
|
23
|
+
getEndOfWeek: () => getEndOfWeek
|
|
26
24
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dayPeriod: true,
|
|
36
|
-
era: true
|
|
37
|
-
};
|
|
38
|
-
var SEGMENT_PAGE_STEP = {
|
|
39
|
-
year: 5,
|
|
40
|
-
month: 2,
|
|
41
|
-
day: 7,
|
|
42
|
-
hour: 2,
|
|
43
|
-
minute: 15,
|
|
44
|
-
second: 15
|
|
45
|
-
};
|
|
46
|
-
function isSegmentEditable(segment) {
|
|
47
|
-
return EDITABLE_SEGMENTS[segment];
|
|
25
|
+
module.exports = __toCommonJS(get_end_of_week_exports);
|
|
26
|
+
|
|
27
|
+
// src/get-start-of-week.ts
|
|
28
|
+
var import_date = require("@internationalized/date");
|
|
29
|
+
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
30
|
+
const day = (0, import_date.getDayOfWeek)(date, locale);
|
|
31
|
+
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
32
|
+
return date.subtract({ days: diff });
|
|
48
33
|
}
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
|
|
35
|
+
// src/get-end-of-week.ts
|
|
36
|
+
function getEndOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
37
|
+
return getStartOfWeek(date, locale, firstDayOfWeek).add({ days: 6 });
|
|
51
38
|
}
|
|
52
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
40
|
0 && (module.exports = {
|
|
54
|
-
|
|
55
|
-
getSegmentPageStep,
|
|
56
|
-
isSegmentEditable
|
|
41
|
+
getEndOfWeek
|
|
57
42
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-era-format.ts
|
|
21
|
+
var get_era_format_exports = {};
|
|
22
|
+
__export(get_era_format_exports, {
|
|
23
|
+
getEraFormat: () => getEraFormat
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_era_format_exports);
|
|
26
|
+
function getEraFormat(date) {
|
|
27
|
+
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
getEraFormat
|
|
32
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
declare function getDaysInWeek(weekIndex: number, from: CalendarDate, locale: string, firstDayOfWeek?: number): (CalendarDate | null)[];
|
|
4
|
+
declare function getMonthDays(from: CalendarDate, locale: string, numOfWeeks?: number, firstDayOfWeek?: number): (CalendarDate | null)[][];
|
|
5
|
+
|
|
6
|
+
export { getDaysInWeek, getMonthDays };
|
|
@@ -17,48 +17,47 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/get-month-
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/get-month-days.ts
|
|
21
|
+
var get_month_days_exports = {};
|
|
22
|
+
__export(get_month_days_exports, {
|
|
23
|
+
getDaysInWeek: () => getDaysInWeek,
|
|
24
|
+
getMonthDays: () => getMonthDays
|
|
24
25
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(get_month_days_exports);
|
|
26
27
|
var import_date2 = require("@internationalized/date");
|
|
27
28
|
|
|
28
|
-
// src/get-week
|
|
29
|
+
// src/get-start-of-week.ts
|
|
29
30
|
var import_date = require("@internationalized/date");
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
date
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
32
|
+
const day = (0, import_date.getDayOfWeek)(date, locale);
|
|
33
|
+
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
34
|
+
return date.subtract({ days: diff });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/get-month-days.ts
|
|
38
|
+
function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
39
|
+
const weekDate = from.add({ weeks: weekIndex });
|
|
40
|
+
const dates = [];
|
|
41
|
+
let date = getStartOfWeek(weekDate, locale, firstDayOfWeek);
|
|
38
42
|
while (dates.length < 7) {
|
|
39
43
|
dates.push(date);
|
|
40
44
|
let nextDate = date.add({ days: 1 });
|
|
41
|
-
if ((0,
|
|
45
|
+
if ((0, import_date2.isSameDay)(date, nextDate)) {
|
|
42
46
|
break;
|
|
43
47
|
}
|
|
44
48
|
date = nextDate;
|
|
45
49
|
}
|
|
46
|
-
while (dates.length < 7) {
|
|
47
|
-
dates.push(null);
|
|
48
|
-
}
|
|
49
50
|
return dates;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let weekArr = [...new Array(numOfWeeks).keys()];
|
|
57
|
-
return weekArr.map((index) => {
|
|
58
|
-
return getDatesInWeek(index, startDate, locale);
|
|
52
|
+
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
53
|
+
const monthWeeks = (0, import_date2.getWeeksInMonth)(from, locale);
|
|
54
|
+
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
55
|
+
return weeks.map((week) => {
|
|
56
|
+
return getDaysInWeek(week, from, locale, firstDayOfWeek);
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
59
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
60
|
0 && (module.exports = {
|
|
63
|
-
|
|
61
|
+
getDaysInWeek,
|
|
62
|
+
getMonthDays
|
|
64
63
|
});
|
|
@@ -17,43 +17,31 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/get-formatter.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
getDateFormatter: () => getDateFormatter,
|
|
20
|
+
// src/get-month-formatter.ts
|
|
21
|
+
var get_month_formatter_exports = {};
|
|
22
|
+
__export(get_month_formatter_exports, {
|
|
24
23
|
getMonthFormatter: () => getMonthFormatter
|
|
25
24
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(get_month_formatter_exports);
|
|
26
|
+
var import_date = require("@internationalized/date");
|
|
27
|
+
|
|
28
|
+
// src/get-era-format.ts
|
|
27
29
|
function getEraFormat(date) {
|
|
28
30
|
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
weekday: "long",
|
|
36
|
-
month: "long",
|
|
37
|
-
year: "numeric",
|
|
38
|
-
day: "numeric",
|
|
39
|
-
era,
|
|
40
|
-
timeZone
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
|
|
44
|
-
let start = startDate;
|
|
45
|
-
let end = endDate ?? startDate;
|
|
46
|
-
let era = getEraFormat(start) || getEraFormat(end);
|
|
47
|
-
return getDateFormatter2({
|
|
32
|
+
|
|
33
|
+
// src/get-month-formatter.ts
|
|
34
|
+
function getMonthFormatter(locale, timeZone) {
|
|
35
|
+
const date = (0, import_date.toCalendarDate)((0, import_date.today)(timeZone));
|
|
36
|
+
return new import_date.DateFormatter(locale, {
|
|
48
37
|
month: "long",
|
|
49
38
|
year: "numeric",
|
|
50
|
-
era,
|
|
51
|
-
calendar:
|
|
39
|
+
era: getEraFormat(date),
|
|
40
|
+
calendar: date?.calendar.identifier,
|
|
52
41
|
timeZone
|
|
53
42
|
});
|
|
54
43
|
}
|
|
55
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
45
|
0 && (module.exports = {
|
|
57
|
-
getDateFormatter,
|
|
58
46
|
getMonthFormatter
|
|
59
47
|
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-month-names.ts
|
|
21
|
+
var get_month_names_exports = {};
|
|
22
|
+
__export(get_month_names_exports, {
|
|
23
|
+
getMonthNames: () => getMonthNames
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_month_names_exports);
|
|
26
|
+
function getMonthNames(locale, format = "long") {
|
|
27
|
+
const date = new Date(2021, 0, 1);
|
|
28
|
+
const monthNames = [];
|
|
29
|
+
for (let i = 0; i < 12; i++) {
|
|
30
|
+
monthNames.push(date.toLocaleString(locale, { month: format }));
|
|
31
|
+
date.setMonth(date.getMonth() + 1);
|
|
32
|
+
}
|
|
33
|
+
return monthNames;
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
getMonthNames
|
|
38
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-start-of-week.ts
|
|
21
|
+
var get_start_of_week_exports = {};
|
|
22
|
+
__export(get_start_of_week_exports, {
|
|
23
|
+
getStartOfWeek: () => getStartOfWeek
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_start_of_week_exports);
|
|
26
|
+
var import_date = require("@internationalized/date");
|
|
27
|
+
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
28
|
+
const day = (0, import_date.getDayOfWeek)(date, locale);
|
|
29
|
+
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
30
|
+
return date.subtract({ days: diff });
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
getStartOfWeek
|
|
35
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
declare function getWeekDays(date: CalendarDate, startOfWeekProp: number | undefined, timeZone: string, locale: string): {
|
|
4
|
+
value: CalendarDate;
|
|
5
|
+
short: string;
|
|
6
|
+
long: string;
|
|
7
|
+
narrow: string;
|
|
8
|
+
}[];
|
|
9
|
+
|
|
10
|
+
export { getWeekDays };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-week-days.ts
|
|
21
|
+
var get_week_days_exports = {};
|
|
22
|
+
__export(get_week_days_exports, {
|
|
23
|
+
getWeekDays: () => getWeekDays
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_week_days_exports);
|
|
26
|
+
|
|
27
|
+
// src/get-weekday-formats.ts
|
|
28
|
+
var import_date = require("@internationalized/date");
|
|
29
|
+
function getWeekdayFormats(locale, timeZone) {
|
|
30
|
+
const longFormat = new import_date.DateFormatter(locale, { weekday: "long", timeZone });
|
|
31
|
+
const shortFormat = new import_date.DateFormatter(locale, { weekday: "short", timeZone });
|
|
32
|
+
const narrowFormat = new import_date.DateFormatter(locale, { weekday: "narrow", timeZone });
|
|
33
|
+
return (value) => {
|
|
34
|
+
const date = value instanceof Date ? value : value.toDate(timeZone);
|
|
35
|
+
return {
|
|
36
|
+
value,
|
|
37
|
+
short: shortFormat.format(date),
|
|
38
|
+
long: longFormat.format(date),
|
|
39
|
+
narrow: narrowFormat.format(date)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/get-start-of-week.ts
|
|
45
|
+
var import_date2 = require("@internationalized/date");
|
|
46
|
+
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
47
|
+
const day = (0, import_date2.getDayOfWeek)(date, locale);
|
|
48
|
+
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
49
|
+
return date.subtract({ days: diff });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/get-week-days.ts
|
|
53
|
+
function getWeekDays(date, startOfWeekProp, timeZone, locale) {
|
|
54
|
+
const firstDayOfWeek = getStartOfWeek(date, locale, startOfWeekProp);
|
|
55
|
+
const weeks = [...new Array(7).keys()];
|
|
56
|
+
const format = getWeekdayFormats(locale, timeZone);
|
|
57
|
+
return weeks.map((index) => format(firstDayOfWeek.add({ days: index })));
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
getWeekDays
|
|
62
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
declare function getWeekdayFormats(locale: string, timeZone: string): <T extends CalendarDate | Date>(value: T) => {
|
|
4
|
+
value: T;
|
|
5
|
+
short: string;
|
|
6
|
+
long: string;
|
|
7
|
+
narrow: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { getWeekdayFormats };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/get-weekday-formats.ts
|
|
21
|
+
var get_weekday_formats_exports = {};
|
|
22
|
+
__export(get_weekday_formats_exports, {
|
|
23
|
+
getWeekdayFormats: () => getWeekdayFormats
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_weekday_formats_exports);
|
|
26
|
+
var import_date = require("@internationalized/date");
|
|
27
|
+
function getWeekdayFormats(locale, timeZone) {
|
|
28
|
+
const longFormat = new import_date.DateFormatter(locale, { weekday: "long", timeZone });
|
|
29
|
+
const shortFormat = new import_date.DateFormatter(locale, { weekday: "short", timeZone });
|
|
30
|
+
const narrowFormat = new import_date.DateFormatter(locale, { weekday: "narrow", timeZone });
|
|
31
|
+
return (value) => {
|
|
32
|
+
const date = value instanceof Date ? value : value.toDate(timeZone);
|
|
33
|
+
return {
|
|
34
|
+
value,
|
|
35
|
+
short: shortFormat.format(date),
|
|
36
|
+
long: longFormat.format(date),
|
|
37
|
+
narrow: narrowFormat.format(date)
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getWeekdayFormats
|
|
44
|
+
});
|