@zag-js/date-utils 0.10.1 → 0.10.3
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 +4 -7
- package/dist/align.js +11 -83
- package/dist/align.mjs +24 -9
- package/dist/assertion.d.ts +10 -13
- package/dist/assertion.js +19 -48
- package/dist/assertion.mjs +36 -20
- package/dist/constrain.d.ts +6 -9
- package/dist/constrain.js +26 -52
- package/dist/constrain.mjs +58 -14
- package/dist/duration.d.ts +3 -7
- package/dist/duration.js +6 -30
- package/dist/duration.mjs +18 -8
- package/dist/format-date.d.ts +2 -5
- package/dist/format-date.js +32 -54
- package/dist/format-date.mjs +53 -6
- package/dist/format-range.d.ts +2 -5
- package/dist/format-range.js +5 -28
- package/dist/format-range.mjs +24 -6
- package/dist/format-selected-date.d.ts +2 -5
- package/dist/format-selected-date.js +10 -77
- package/dist/format-selected-date.mjs +15 -9
- package/dist/format-visible-range.d.ts +2 -5
- package/dist/format-visible-range.js +12 -68
- package/dist/format-visible-range.mjs +22 -9
- package/dist/get-day-formatter.d.ts +2 -5
- package/dist/get-day-formatter.js +9 -37
- package/dist/get-day-formatter.mjs +16 -7
- package/dist/get-decade-range.d.ts +1 -3
- package/dist/get-decade-range.js +5 -28
- package/dist/get-decade-range.mjs +11 -6
- package/dist/get-era-format.d.ts +2 -5
- package/dist/get-era-format.js +5 -28
- package/dist/get-era-format.mjs +5 -6
- package/dist/get-month-days.d.ts +3 -6
- package/dist/get-month-days.js +13 -45
- package/dist/get-month-days.mjs +24 -9
- package/dist/get-month-formatter.d.ts +2 -5
- package/dist/get-month-formatter.js +10 -38
- package/dist/get-month-formatter.mjs +15 -7
- package/dist/get-month-names.d.ts +1 -3
- package/dist/get-month-names.js +5 -28
- package/dist/get-month-names.mjs +11 -6
- package/dist/get-start-of-week.d.ts +2 -6
- package/dist/get-start-of-week.js +10 -32
- package/dist/get-start-of-week.mjs +9 -6
- package/dist/get-week-days.d.ts +3 -7
- package/dist/get-week-days.js +8 -55
- package/dist/get-week-days.mjs +11 -8
- package/dist/get-weekday-formats.d.ts +2 -5
- package/dist/get-weekday-formats.js +10 -32
- package/dist/get-weekday-formats.mjs +18 -6
- package/dist/get-year-range.d.ts +2 -4
- package/dist/get-year-range.js +5 -28
- package/dist/get-year-range.mjs +9 -6
- package/dist/index.d.ts +20 -21
- package/dist/index.js +74 -740
- package/dist/index.mjs +19 -138
- package/dist/mutation.d.ts +10 -14
- package/dist/mutation.js +17 -59
- package/dist/mutation.mjs +40 -21
- package/dist/pagination.d.ts +19 -23
- package/dist/pagination.js +35 -134
- package/dist/pagination.mjs +179 -25
- package/dist/parse-date.d.ts +2 -5
- package/dist/parse-date.js +13 -35
- package/dist/parse-date.mjs +40 -6
- package/dist/types.d.ts +8 -11
- package/package.json +2 -7
- package/src/assertion.ts +1 -1
- package/src/constrain.ts +2 -2
- package/src/format-date.ts +1 -1
- package/src/format-selected-date.ts +1 -1
- package/src/format-visible-range.ts +1 -1
- package/src/get-month-days.ts +1 -1
- package/src/get-start-of-week.ts +1 -1
- package/src/get-weekday-formats.ts +1 -1
- package/src/mutation.ts +8 -1
- package/src/pagination.ts +8 -1
- package/dist/chunk-5HGHDJ3L.mjs +0 -14
- package/dist/chunk-6FNTXW54.mjs +0 -52
- package/dist/chunk-6LXTZHZP.mjs +0 -22
- package/dist/chunk-AMZ7CJ5F.mjs +0 -18
- package/dist/chunk-BUT5IUNZ.mjs +0 -32
- package/dist/chunk-FJKH6IJZ.mjs +0 -21
- package/dist/chunk-G4VVKINZ.mjs +0 -14
- package/dist/chunk-HKHGJ6WS.mjs +0 -27
- package/dist/chunk-HLAN6TUA.mjs +0 -45
- package/dist/chunk-KBGJA6NB.mjs +0 -55
- package/dist/chunk-KLHRN7WS.mjs +0 -20
- package/dist/chunk-KN3YMOSL.mjs +0 -8
- package/dist/chunk-KQVWH4YA.mjs +0 -29
- package/dist/chunk-LGEGBP3O.mjs +0 -20
- package/dist/chunk-MGPXEJO4.mjs +0 -71
- package/dist/chunk-NV7UFBMY.mjs +0 -30
- package/dist/chunk-POBWDZPE.mjs +0 -200
- package/dist/chunk-SI75FOJ2.mjs +0 -11
- package/dist/chunk-TTJVXKJY.mjs +0 -12
- package/dist/chunk-WQYMLJUJ.mjs +0 -42
- package/dist/chunk-ZSLC7OI2.mjs +0 -22
- package/dist/get-end-of-week.d.ts +0 -6
- package/dist/get-end-of-week.js +0 -42
- package/dist/get-end-of-week.mjs +0 -11
- package/dist/types.js +0 -18
- package/dist/types.mjs +0 -0
package/dist/get-decade-range.js
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
19
4
|
|
|
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
5
|
function getDecadeRange(year) {
|
|
27
6
|
const computedYear = year - year % 10 - 1;
|
|
28
7
|
const years = [];
|
|
@@ -32,7 +11,5 @@ function getDecadeRange(year) {
|
|
|
32
11
|
}
|
|
33
12
|
return years;
|
|
34
13
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
getDecadeRange
|
|
38
|
-
});
|
|
14
|
+
|
|
15
|
+
exports.getDecadeRange = getDecadeRange;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function getDecadeRange(year) {
|
|
2
|
+
const computedYear = year - year % 10 - 1;
|
|
3
|
+
const years = [];
|
|
4
|
+
for (let i = 0; i < 12; i += 1) {
|
|
5
|
+
const value = computedYear + i;
|
|
6
|
+
years.push(value);
|
|
7
|
+
}
|
|
8
|
+
return years;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { getDecadeRange };
|
package/dist/get-era-format.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
|
4
|
-
|
|
5
|
-
export { getEraFormat };
|
|
1
|
+
import type { DateValue } from "@internationalized/date";
|
|
2
|
+
export declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
package/dist/get-era-format.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
19
4
|
|
|
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
5
|
function getEraFormat(date) {
|
|
27
6
|
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
28
7
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
getEraFormat
|
|
32
|
-
});
|
|
8
|
+
|
|
9
|
+
exports.getEraFormat = getEraFormat;
|
package/dist/get-era-format.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
function getEraFormat(date) {
|
|
2
|
+
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export { getEraFormat };
|
package/dist/get-month-days.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
declare function
|
|
4
|
-
declare function getMonthDays(from: DateValue, locale: string, numOfWeeks?: number, firstDayOfWeek?: number): DateValue[][];
|
|
5
|
-
|
|
6
|
-
export { getDaysInWeek, getMonthDays };
|
|
1
|
+
import { type DateValue } from "@internationalized/date";
|
|
2
|
+
export declare function getDaysInWeek(weekIndex: number, from: DateValue, locale: string, firstDayOfWeek?: number): DateValue[];
|
|
3
|
+
export declare function getMonthDays(from: DateValue, locale: string, numOfWeeks?: number, firstDayOfWeek?: number): DateValue[][];
|
package/dist/get-month-days.js
CHANGED
|
@@ -1,61 +1,29 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var get_month_days_exports = {};
|
|
22
|
-
__export(get_month_days_exports, {
|
|
23
|
-
getDaysInWeek: () => getDaysInWeek,
|
|
24
|
-
getMonthDays: () => getMonthDays
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(get_month_days_exports);
|
|
27
|
-
var import_date2 = require("@internationalized/date");
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
28
4
|
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
}
|
|
5
|
+
const date = require('@internationalized/date');
|
|
6
|
+
const getStartOfWeek = require('./get-start-of-week.js');
|
|
36
7
|
|
|
37
|
-
// src/get-month-days.ts
|
|
38
8
|
function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
39
9
|
const weekDate = from.add({ weeks: weekIndex });
|
|
40
10
|
const dates = [];
|
|
41
|
-
let date = getStartOfWeek(weekDate, locale, firstDayOfWeek);
|
|
11
|
+
let date$1 = getStartOfWeek.getStartOfWeek(weekDate, locale, firstDayOfWeek);
|
|
42
12
|
while (dates.length < 7) {
|
|
43
|
-
dates.push(date);
|
|
44
|
-
let nextDate = date.add({ days: 1 });
|
|
45
|
-
if (
|
|
13
|
+
dates.push(date$1);
|
|
14
|
+
let nextDate = date$1.add({ days: 1 });
|
|
15
|
+
if (date.isSameDay(date$1, nextDate)) {
|
|
46
16
|
break;
|
|
47
17
|
}
|
|
48
|
-
date = nextDate;
|
|
18
|
+
date$1 = nextDate;
|
|
49
19
|
}
|
|
50
20
|
return dates;
|
|
51
21
|
}
|
|
52
22
|
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
53
|
-
const monthWeeks =
|
|
23
|
+
const monthWeeks = date.getWeeksInMonth(from, locale);
|
|
54
24
|
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
55
25
|
return weeks.map((week) => getDaysInWeek(week, from, locale, firstDayOfWeek));
|
|
56
26
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getMonthDays
|
|
61
|
-
});
|
|
27
|
+
|
|
28
|
+
exports.getDaysInWeek = getDaysInWeek;
|
|
29
|
+
exports.getMonthDays = getMonthDays;
|
package/dist/get-month-days.mjs
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { isSameDay, getWeeksInMonth } from '@internationalized/date';
|
|
2
|
+
import { getStartOfWeek } from './get-start-of-week.mjs';
|
|
3
|
+
|
|
4
|
+
function getDaysInWeek(weekIndex, from, locale, firstDayOfWeek) {
|
|
5
|
+
const weekDate = from.add({ weeks: weekIndex });
|
|
6
|
+
const dates = [];
|
|
7
|
+
let date = getStartOfWeek(weekDate, locale, firstDayOfWeek);
|
|
8
|
+
while (dates.length < 7) {
|
|
9
|
+
dates.push(date);
|
|
10
|
+
let nextDate = date.add({ days: 1 });
|
|
11
|
+
if (isSameDay(date, nextDate)) {
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
date = nextDate;
|
|
15
|
+
}
|
|
16
|
+
return dates;
|
|
17
|
+
}
|
|
18
|
+
function getMonthDays(from, locale, numOfWeeks, firstDayOfWeek) {
|
|
19
|
+
const monthWeeks = getWeeksInMonth(from, locale);
|
|
20
|
+
const weeks = [...new Array(numOfWeeks ?? monthWeeks).keys()];
|
|
21
|
+
return weeks.map((week) => getDaysInWeek(week, from, locale, firstDayOfWeek));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { getDaysInWeek, getMonthDays };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { DateFormatter } from
|
|
2
|
-
|
|
3
|
-
declare function getMonthFormatter(locale: string, timeZone: string): DateFormatter;
|
|
4
|
-
|
|
5
|
-
export { getMonthFormatter };
|
|
1
|
+
import { DateFormatter } from "@internationalized/date";
|
|
2
|
+
export declare function getMonthFormatter(locale: string, timeZone: string): DateFormatter;
|
|
@@ -1,47 +1,19 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var get_month_formatter_exports = {};
|
|
22
|
-
__export(get_month_formatter_exports, {
|
|
23
|
-
getMonthFormatter: () => getMonthFormatter
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(get_month_formatter_exports);
|
|
26
|
-
var import_date = require("@internationalized/date");
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
27
4
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
|
|
31
|
-
}
|
|
5
|
+
const date = require('@internationalized/date');
|
|
6
|
+
const getEraFormat = require('./get-era-format.js');
|
|
32
7
|
|
|
33
|
-
// src/get-month-formatter.ts
|
|
34
8
|
function getMonthFormatter(locale, timeZone) {
|
|
35
|
-
const date =
|
|
36
|
-
return new
|
|
9
|
+
const date$1 = date.toCalendarDate(date.today(timeZone));
|
|
10
|
+
return new date.DateFormatter(locale, {
|
|
37
11
|
month: "long",
|
|
38
12
|
year: "numeric",
|
|
39
|
-
era: getEraFormat(date),
|
|
40
|
-
calendar: date?.calendar.identifier,
|
|
13
|
+
era: getEraFormat.getEraFormat(date$1),
|
|
14
|
+
calendar: date$1?.calendar.identifier,
|
|
41
15
|
timeZone
|
|
42
16
|
});
|
|
43
17
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
getMonthFormatter
|
|
47
|
-
});
|
|
18
|
+
|
|
19
|
+
exports.getMonthFormatter = getMonthFormatter;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { toCalendarDate, today, DateFormatter } from '@internationalized/date';
|
|
2
|
+
import { getEraFormat } from './get-era-format.mjs';
|
|
3
|
+
|
|
4
|
+
function getMonthFormatter(locale, timeZone) {
|
|
5
|
+
const date = toCalendarDate(today(timeZone));
|
|
6
|
+
return new DateFormatter(locale, {
|
|
7
|
+
month: "long",
|
|
8
|
+
year: "numeric",
|
|
9
|
+
era: getEraFormat(date),
|
|
10
|
+
calendar: date?.calendar.identifier,
|
|
11
|
+
timeZone
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getMonthFormatter };
|
package/dist/get-month-names.js
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
19
4
|
|
|
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
5
|
function getMonthNames(locale, format = "long") {
|
|
27
6
|
const date = new Date(2021, 0, 1);
|
|
28
7
|
const monthNames = [];
|
|
@@ -32,7 +11,5 @@ function getMonthNames(locale, format = "long") {
|
|
|
32
11
|
}
|
|
33
12
|
return monthNames;
|
|
34
13
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
getMonthNames
|
|
38
|
-
});
|
|
14
|
+
|
|
15
|
+
exports.getMonthNames = getMonthNames;
|
package/dist/get-month-names.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function getMonthNames(locale, format = "long") {
|
|
2
|
+
const date = new Date(2021, 0, 1);
|
|
3
|
+
const monthNames = [];
|
|
4
|
+
for (let i = 0; i < 12; i++) {
|
|
5
|
+
monthNames.push(date.toLocaleString(locale, { month: format }));
|
|
6
|
+
date.setMonth(date.getMonth() + 1);
|
|
7
|
+
}
|
|
8
|
+
return monthNames;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { getMonthNames };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function getStartOfWeek(date: DateValue, locale: string, firstDayOfWeek?: number): _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
5
|
-
|
|
6
|
-
export { getStartOfWeek };
|
|
1
|
+
import type { CalendarDate, CalendarDateTime, ZonedDateTime, type DateValue } from '@internationalized/date';
|
|
2
|
+
export declare function getStartOfWeek(date: DateValue, locale: string, firstDayOfWeek?: number): CalendarDate | CalendarDateTime | ZonedDateTime;
|
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var import_date = require("@internationalized/date");
|
|
27
|
-
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
28
|
-
const day = (0, import_date.getDayOfWeek)(date, locale);
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const date = require('@internationalized/date');
|
|
6
|
+
|
|
7
|
+
function getStartOfWeek(date$1, locale, firstDayOfWeek = 0) {
|
|
8
|
+
const day = date.getDayOfWeek(date$1, locale);
|
|
29
9
|
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
30
|
-
return date.subtract({ days: diff });
|
|
10
|
+
return date$1.subtract({ days: diff });
|
|
31
11
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getStartOfWeek
|
|
35
|
-
});
|
|
12
|
+
|
|
13
|
+
exports.getStartOfWeek = getStartOfWeek;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
import { getDayOfWeek } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
function getStartOfWeek(date, locale, firstDayOfWeek = 0) {
|
|
4
|
+
const day = getDayOfWeek(date, locale);
|
|
5
|
+
const diff = (day - firstDayOfWeek + 7) % 7;
|
|
6
|
+
return date.subtract({ days: diff });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { getStartOfWeek };
|
package/dist/get-week-days.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function getWeekDays(date: DateValue, startOfWeekProp: number | undefined, timeZone: string, locale: string): {
|
|
5
|
-
value: _internationalized_date.CalendarDate | _internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime;
|
|
1
|
+
import type { CalendarDate, CalendarDateTime, ZonedDateTime, DateValue } from '@internationalized/date';
|
|
2
|
+
export declare function getWeekDays(date: DateValue, startOfWeekProp: number | undefined, timeZone: string, locale: string): {
|
|
3
|
+
value: CalendarDate | CalendarDateTime | ZonedDateTime;
|
|
6
4
|
short: string;
|
|
7
5
|
long: string;
|
|
8
6
|
narrow: string;
|
|
9
7
|
}[];
|
|
10
|
-
|
|
11
|
-
export { getWeekDays };
|
package/dist/get-week-days.js
CHANGED
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var get_week_days_exports = {};
|
|
22
|
-
__export(get_week_days_exports, {
|
|
23
|
-
getWeekDays: () => getWeekDays
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(get_week_days_exports);
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
26
4
|
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
}
|
|
5
|
+
const getWeekdayFormats = require('./get-weekday-formats.js');
|
|
6
|
+
const getStartOfWeek = require('./get-start-of-week.js');
|
|
51
7
|
|
|
52
|
-
// src/get-week-days.ts
|
|
53
8
|
function getWeekDays(date, startOfWeekProp, timeZone, locale) {
|
|
54
|
-
const firstDayOfWeek = getStartOfWeek(date, locale, startOfWeekProp);
|
|
9
|
+
const firstDayOfWeek = getStartOfWeek.getStartOfWeek(date, locale, startOfWeekProp);
|
|
55
10
|
const weeks = [...new Array(7).keys()];
|
|
56
|
-
const format = getWeekdayFormats(locale, timeZone);
|
|
11
|
+
const format = getWeekdayFormats.getWeekdayFormats(locale, timeZone);
|
|
57
12
|
return weeks.map((index) => format(firstDayOfWeek.add({ days: index })));
|
|
58
13
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
getWeekDays
|
|
62
|
-
});
|
|
14
|
+
|
|
15
|
+
exports.getWeekDays = getWeekDays;
|
package/dist/get-week-days.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
1
|
+
import { getWeekdayFormats } from './get-weekday-formats.mjs';
|
|
2
|
+
import { getStartOfWeek } from './get-start-of-week.mjs';
|
|
3
|
+
|
|
4
|
+
function getWeekDays(date, startOfWeekProp, timeZone, locale) {
|
|
5
|
+
const firstDayOfWeek = getStartOfWeek(date, locale, startOfWeekProp);
|
|
6
|
+
const weeks = [...new Array(7).keys()];
|
|
7
|
+
const format = getWeekdayFormats(locale, timeZone);
|
|
8
|
+
return weeks.map((index) => format(firstDayOfWeek.add({ days: index })));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { getWeekDays };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
declare function getWeekdayFormats(locale: string, timeZone: string): <T extends DateValue | Date>(value: T) => {
|
|
1
|
+
import { type DateValue } from "@internationalized/date";
|
|
2
|
+
export declare function getWeekdayFormats(locale: string, timeZone: string): <T extends DateValue | Date>(value: T) => {
|
|
4
3
|
value: T;
|
|
5
4
|
short: string;
|
|
6
5
|
long: string;
|
|
7
6
|
narrow: string;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
export { getWeekdayFormats };
|
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const date = require('@internationalized/date');
|
|
19
6
|
|
|
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
7
|
function getWeekdayFormats(locale, timeZone) {
|
|
28
|
-
const longFormat = new
|
|
29
|
-
const shortFormat = new
|
|
30
|
-
const narrowFormat = new
|
|
8
|
+
const longFormat = new date.DateFormatter(locale, { weekday: "long", timeZone });
|
|
9
|
+
const shortFormat = new date.DateFormatter(locale, { weekday: "short", timeZone });
|
|
10
|
+
const narrowFormat = new date.DateFormatter(locale, { weekday: "narrow", timeZone });
|
|
31
11
|
return (value) => {
|
|
32
12
|
const date = value instanceof Date ? value : value.toDate(timeZone);
|
|
33
13
|
return {
|
|
@@ -38,7 +18,5 @@ function getWeekdayFormats(locale, timeZone) {
|
|
|
38
18
|
};
|
|
39
19
|
};
|
|
40
20
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
getWeekdayFormats
|
|
44
|
-
});
|
|
21
|
+
|
|
22
|
+
exports.getWeekdayFormats = getWeekdayFormats;
|