@zag-js/date-utils 2.0.0-next.2 → 2.0.0-next.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/align.d.mts +4 -8
- package/dist/align.d.ts +4 -8
- package/dist/align.js +15 -47
- package/dist/align.mjs +10 -21
- package/dist/assertion.d.mts +6 -10
- package/dist/assertion.d.ts +6 -10
- package/dist/assertion.js +21 -48
- package/dist/assertion.mjs +13 -19
- package/dist/constrain.d.mts +7 -10
- package/dist/constrain.d.ts +7 -10
- package/dist/constrain.js +72 -133
- package/dist/constrain.mjs +63 -110
- package/dist/date-month.d.mts +17 -21
- package/dist/date-month.d.ts +17 -21
- package/dist/date-month.js +103 -112
- package/dist/date-month.mjs +92 -86
- package/dist/date-year.d.mts +8 -13
- package/dist/date-year.d.ts +8 -13
- package/dist/date-year.js +36 -64
- package/dist/date-year.mjs +29 -36
- package/dist/duration.d.mts +8 -12
- package/dist/duration.d.ts +8 -12
- package/dist/duration.js +13 -37
- package/dist/duration.mjs +8 -11
- package/dist/format.d.mts +5 -8
- package/dist/format.d.ts +5 -8
- package/dist/format.js +35 -76
- package/dist/format.mjs +29 -49
- package/dist/formatter.d.mts +3 -6
- package/dist/formatter.d.ts +3 -6
- package/dist/formatter.js +26 -50
- package/dist/formatter.mjs +21 -24
- package/dist/get-era-format.d.mts +2 -6
- package/dist/get-era-format.d.ts +2 -6
- package/dist/get-era-format.js +9 -34
- package/dist/get-era-format.mjs +5 -9
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +66 -47
- package/dist/index.mjs +14 -14
- package/dist/locale.d.mts +3 -5
- package/dist/locale.d.ts +3 -5
- package/dist/locale.js +28 -55
- package/dist/locale.mjs +22 -28
- package/dist/mutation.d.mts +6 -10
- package/dist/mutation.d.ts +6 -10
- package/dist/mutation.js +21 -53
- package/dist/mutation.mjs +14 -30
- package/dist/pagination.d.mts +16 -19
- package/dist/pagination.d.ts +16 -19
- package/dist/pagination.js +120 -201
- package/dist/pagination.mjs +106 -166
- package/dist/parse-date.d.mts +2 -6
- package/dist/parse-date.d.ts +2 -6
- package/dist/parse-date.js +41 -72
- package/dist/parse-date.mjs +37 -47
- package/dist/preset.d.mts +3 -6
- package/dist/preset.d.ts +3 -6
- package/dist/preset.js +23 -63
- package/dist/preset.mjs +19 -47
- package/dist/types.d.mts +17 -20
- package/dist/types.d.ts +17 -20
- package/dist/types.js +4 -18
- package/dist/types.mjs +1 -0
- package/package.json +3 -3
package/dist/format.js
CHANGED
|
@@ -1,83 +1,42 @@
|
|
|
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);
|
|
19
|
-
|
|
20
|
-
// src/format.ts
|
|
21
|
-
var format_exports = {};
|
|
22
|
-
__export(format_exports, {
|
|
23
|
-
formatRange: () => formatRange,
|
|
24
|
-
formatSelectedDate: () => formatSelectedDate,
|
|
25
|
-
formatVisibleRange: () => formatVisibleRange
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
26
4
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
const require_formatter = require("./formatter.js");
|
|
6
|
+
let _internationalized_date = require("@internationalized/date");
|
|
7
|
+
// src/format.ts
|
|
30
8
|
function formatRange(startDate, endDate, formatter, toString, timeZone) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (let i = 0; i < parts.length; i++) {
|
|
44
|
-
if (i < separatorIndex) {
|
|
45
|
-
start += parts[i].value;
|
|
46
|
-
} else if (i > separatorIndex) {
|
|
47
|
-
end += parts[i].value;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return toString(start, end);
|
|
9
|
+
let parts = formatter.formatRangeToParts(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
10
|
+
let separatorIndex = -1;
|
|
11
|
+
for (let i = 0; i < parts.length; i++) {
|
|
12
|
+
let part = parts[i];
|
|
13
|
+
if (part.source === "shared" && part.type === "literal") separatorIndex = i;
|
|
14
|
+
else if (part.source === "endRange") break;
|
|
15
|
+
}
|
|
16
|
+
let start = "";
|
|
17
|
+
let end = "";
|
|
18
|
+
for (let i = 0; i < parts.length; i++) if (i < separatorIndex) start += parts[i].value;
|
|
19
|
+
else if (i > separatorIndex) end += parts[i].value;
|
|
20
|
+
return toString(start, end);
|
|
51
21
|
}
|
|
52
22
|
function formatSelectedDate(startDate, endDate, locale, timeZone) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
return formatRange(start, end, formatter, (start2, end2) => `${start2} \u2013 ${end2}`, timeZone);
|
|
23
|
+
if (!startDate) return "";
|
|
24
|
+
let start = startDate;
|
|
25
|
+
let end = endDate ?? startDate;
|
|
26
|
+
let formatter = require_formatter.getDayFormatter(locale, timeZone);
|
|
27
|
+
if ((0, _internationalized_date.isSameDay)(start, end)) return formatter.format(start.toDate(timeZone));
|
|
28
|
+
return formatRange(start, end, formatter, (start, end) => `${start} – ${end}`, timeZone);
|
|
61
29
|
}
|
|
62
30
|
function formatVisibleRange(startDate, endDate, locale, timeZone) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return monthFormatter.format(start.toDate(timeZone));
|
|
72
|
-
}
|
|
73
|
-
if ((0, import_date.isSameDay)(end, (0, import_date.endOfMonth)(end))) {
|
|
74
|
-
return monthFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
75
|
-
}
|
|
76
|
-
return "";
|
|
31
|
+
const start = startDate;
|
|
32
|
+
const end = endDate ?? startDate;
|
|
33
|
+
const dayFormatter = require_formatter.getDayFormatter(locale, timeZone);
|
|
34
|
+
if (!(0, _internationalized_date.isSameDay)(start, (0, _internationalized_date.startOfMonth)(start))) return dayFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
35
|
+
const monthFormatter = require_formatter.getMonthFormatter(locale, timeZone);
|
|
36
|
+
if ((0, _internationalized_date.isSameDay)(end, (0, _internationalized_date.endOfMonth)(start))) return monthFormatter.format(start.toDate(timeZone));
|
|
37
|
+
if ((0, _internationalized_date.isSameDay)(end, (0, _internationalized_date.endOfMonth)(end))) return monthFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
38
|
+
return "";
|
|
77
39
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
formatSelectedDate,
|
|
82
|
-
formatVisibleRange
|
|
83
|
-
});
|
|
40
|
+
exports.formatRange = formatRange;
|
|
41
|
+
exports.formatSelectedDate = formatSelectedDate;
|
|
42
|
+
exports.formatVisibleRange = formatVisibleRange;
|
package/dist/format.mjs
CHANGED
|
@@ -1,56 +1,36 @@
|
|
|
1
|
-
// src/format.ts
|
|
2
|
-
import { endOfMonth, isSameDay, startOfMonth } from "@internationalized/date";
|
|
3
1
|
import { getDayFormatter, getMonthFormatter } from "./formatter.mjs";
|
|
2
|
+
import { endOfMonth, isSameDay, startOfMonth } from "@internationalized/date";
|
|
3
|
+
// src/format.ts
|
|
4
4
|
function formatRange(startDate, endDate, formatter, toString, timeZone) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
for (let i = 0; i < parts.length; i++) {
|
|
18
|
-
if (i < separatorIndex) {
|
|
19
|
-
start += parts[i].value;
|
|
20
|
-
} else if (i > separatorIndex) {
|
|
21
|
-
end += parts[i].value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return toString(start, end);
|
|
5
|
+
let parts = formatter.formatRangeToParts(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
6
|
+
let separatorIndex = -1;
|
|
7
|
+
for (let i = 0; i < parts.length; i++) {
|
|
8
|
+
let part = parts[i];
|
|
9
|
+
if (part.source === "shared" && part.type === "literal") separatorIndex = i;
|
|
10
|
+
else if (part.source === "endRange") break;
|
|
11
|
+
}
|
|
12
|
+
let start = "";
|
|
13
|
+
let end = "";
|
|
14
|
+
for (let i = 0; i < parts.length; i++) if (i < separatorIndex) start += parts[i].value;
|
|
15
|
+
else if (i > separatorIndex) end += parts[i].value;
|
|
16
|
+
return toString(start, end);
|
|
25
17
|
}
|
|
26
18
|
function formatSelectedDate(startDate, endDate, locale, timeZone) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return formatRange(start, end, formatter, (start2, end2) => `${start2} \u2013 ${end2}`, timeZone);
|
|
19
|
+
if (!startDate) return "";
|
|
20
|
+
let start = startDate;
|
|
21
|
+
let end = endDate ?? startDate;
|
|
22
|
+
let formatter = getDayFormatter(locale, timeZone);
|
|
23
|
+
if (isSameDay(start, end)) return formatter.format(start.toDate(timeZone));
|
|
24
|
+
return formatRange(start, end, formatter, (start, end) => `${start} – ${end}`, timeZone);
|
|
35
25
|
}
|
|
36
26
|
function formatVisibleRange(startDate, endDate, locale, timeZone) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return monthFormatter.format(start.toDate(timeZone));
|
|
46
|
-
}
|
|
47
|
-
if (isSameDay(end, endOfMonth(end))) {
|
|
48
|
-
return monthFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
49
|
-
}
|
|
50
|
-
return "";
|
|
27
|
+
const start = startDate;
|
|
28
|
+
const end = endDate ?? startDate;
|
|
29
|
+
const dayFormatter = getDayFormatter(locale, timeZone);
|
|
30
|
+
if (!isSameDay(start, startOfMonth(start))) return dayFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
31
|
+
const monthFormatter = getMonthFormatter(locale, timeZone);
|
|
32
|
+
if (isSameDay(end, endOfMonth(start))) return monthFormatter.format(start.toDate(timeZone));
|
|
33
|
+
if (isSameDay(end, endOfMonth(end))) return monthFormatter.formatRange(start.toDate(timeZone), end.toDate(timeZone));
|
|
34
|
+
return "";
|
|
51
35
|
}
|
|
52
|
-
export {
|
|
53
|
-
formatRange,
|
|
54
|
-
formatSelectedDate,
|
|
55
|
-
formatVisibleRange
|
|
56
|
-
};
|
|
36
|
+
export { formatRange, formatSelectedDate, formatVisibleRange };
|
package/dist/formatter.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function
|
|
4
|
-
declare function getMonthFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
|
5
|
-
|
|
6
|
-
export { getDayFormatter, getMonthFormatter };
|
|
1
|
+
import { DateFormatter, DateValue } from "@internationalized/date";
|
|
2
|
+
export declare function getDayFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
|
3
|
+
export declare function getMonthFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
package/dist/formatter.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function
|
|
4
|
-
declare function getMonthFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
|
5
|
-
|
|
6
|
-
export { getDayFormatter, getMonthFormatter };
|
|
1
|
+
import { DateFormatter, DateValue } from "@internationalized/date";
|
|
2
|
+
export declare function getDayFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
|
3
|
+
export declare function getMonthFormatter(locale: string, timeZone: string, referenceDate?: DateValue): DateFormatter;
|
package/dist/formatter.js
CHANGED
|
@@ -1,55 +1,31 @@
|
|
|
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);
|
|
19
|
-
|
|
20
|
-
// src/formatter.ts
|
|
21
|
-
var formatter_exports = {};
|
|
22
|
-
__export(formatter_exports, {
|
|
23
|
-
getDayFormatter: () => getDayFormatter,
|
|
24
|
-
getMonthFormatter: () => getMonthFormatter
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
25
4
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
const require_get_era_format = require("./get-era-format.js");
|
|
6
|
+
let _internationalized_date = require("@internationalized/date");
|
|
7
|
+
// src/formatter.ts
|
|
29
8
|
function getDayFormatter(locale, timeZone, referenceDate) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
9
|
+
const date = referenceDate ?? (0, _internationalized_date.toCalendarDateTime)((0, _internationalized_date.today)(timeZone));
|
|
10
|
+
return new _internationalized_date.DateFormatter(locale, {
|
|
11
|
+
weekday: "long",
|
|
12
|
+
month: "long",
|
|
13
|
+
year: "numeric",
|
|
14
|
+
day: "numeric",
|
|
15
|
+
era: require_get_era_format.getEraFormat(date),
|
|
16
|
+
calendar: date.calendar.identifier,
|
|
17
|
+
timeZone
|
|
18
|
+
});
|
|
40
19
|
}
|
|
41
20
|
function getMonthFormatter(locale, timeZone, referenceDate) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
21
|
+
const date = referenceDate ?? (0, _internationalized_date.today)(timeZone);
|
|
22
|
+
return new _internationalized_date.DateFormatter(locale, {
|
|
23
|
+
month: "long",
|
|
24
|
+
year: "numeric",
|
|
25
|
+
era: require_get_era_format.getEraFormat(date),
|
|
26
|
+
calendar: date.calendar.identifier,
|
|
27
|
+
timeZone
|
|
28
|
+
});
|
|
50
29
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
getDayFormatter,
|
|
54
|
-
getMonthFormatter
|
|
55
|
-
});
|
|
30
|
+
exports.getDayFormatter = getDayFormatter;
|
|
31
|
+
exports.getMonthFormatter = getMonthFormatter;
|
package/dist/formatter.mjs
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
// src/formatter.ts
|
|
2
|
-
import { DateFormatter, toCalendarDateTime, today } from "@internationalized/date";
|
|
3
1
|
import { getEraFormat } from "./get-era-format.mjs";
|
|
2
|
+
import { DateFormatter, toCalendarDateTime, today } from "@internationalized/date";
|
|
3
|
+
// src/formatter.ts
|
|
4
4
|
function getDayFormatter(locale, timeZone, referenceDate) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const date = referenceDate ?? toCalendarDateTime(today(timeZone));
|
|
6
|
+
return new DateFormatter(locale, {
|
|
7
|
+
weekday: "long",
|
|
8
|
+
month: "long",
|
|
9
|
+
year: "numeric",
|
|
10
|
+
day: "numeric",
|
|
11
|
+
era: getEraFormat(date),
|
|
12
|
+
calendar: date.calendar.identifier,
|
|
13
|
+
timeZone
|
|
14
|
+
});
|
|
15
15
|
}
|
|
16
16
|
function getMonthFormatter(locale, timeZone, referenceDate) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const date = referenceDate ?? today(timeZone);
|
|
18
|
+
return new DateFormatter(locale, {
|
|
19
|
+
month: "long",
|
|
20
|
+
year: "numeric",
|
|
21
|
+
era: getEraFormat(date),
|
|
22
|
+
calendar: date.calendar.identifier,
|
|
23
|
+
timeZone
|
|
24
|
+
});
|
|
25
25
|
}
|
|
26
|
-
export {
|
|
27
|
-
getDayFormatter,
|
|
28
|
-
getMonthFormatter
|
|
29
|
-
};
|
|
26
|
+
export { getDayFormatter, getMonthFormatter };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
|
5
|
-
|
|
6
|
-
export { getEraFormat };
|
|
1
|
+
import { DateValue } from "./types.mjs";
|
|
2
|
+
export declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
package/dist/get-era-format.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
|
5
|
-
|
|
6
|
-
export { getEraFormat };
|
|
1
|
+
import { DateValue } from "./types.js";
|
|
2
|
+
export declare function getEraFormat(date: DateValue | undefined): "short" | undefined;
|
package/dist/get-era-format.js
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
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);
|
|
19
|
-
|
|
20
|
-
// src/get-era-format.ts
|
|
21
|
-
var get_era_format_exports = {};
|
|
22
|
-
__export(get_era_format_exports, {
|
|
23
|
-
getEraFormat: () => getEraFormat
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
4
|
});
|
|
25
|
-
|
|
5
|
+
// src/get-era-format.ts
|
|
26
6
|
function getEraFormat(date) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
return "short";
|
|
7
|
+
if (!date) return void 0;
|
|
8
|
+
const id = date.calendar.identifier;
|
|
9
|
+
if (id === "gregory" || id === "iso8601") return date.era === "BC" ? "short" : void 0;
|
|
10
|
+
return "short";
|
|
33
11
|
}
|
|
34
|
-
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
getEraFormat
|
|
37
|
-
});
|
|
12
|
+
exports.getEraFormat = getEraFormat;
|
package/dist/get-era-format.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// src/get-era-format.ts
|
|
2
2
|
function getEraFormat(date) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return "short";
|
|
3
|
+
if (!date) return void 0;
|
|
4
|
+
const id = date.calendar.identifier;
|
|
5
|
+
if (id === "gregory" || id === "iso8601") return date.era === "BC" ? "short" : void 0;
|
|
6
|
+
return "short";
|
|
9
7
|
}
|
|
10
|
-
export {
|
|
11
|
-
getEraFormat
|
|
12
|
-
};
|
|
8
|
+
export { getEraFormat };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { alignDate, alignStartDate } from "./align.mjs";
|
|
2
|
+
import { isDateEqual, isDateOutsideRange, isDateUnavailable, isNextRangeInvalid, isPreviousRangeInvalid } from "./assertion.mjs";
|
|
3
|
+
import { alignCenter, alignEnd, alignStart, constrainSegments, constrainStart, constrainValue } from "./constrain.mjs";
|
|
4
|
+
import { getEndDate, getUnitDuration } from "./duration.mjs";
|
|
5
|
+
import { formatRange, formatSelectedDate, formatVisibleRange } from "./format.mjs";
|
|
6
|
+
import { getDayFormatter, getMonthFormatter } from "./formatter.mjs";
|
|
7
|
+
import { getDaysInWeek, getEndOfWeek, getMonthDays, getMonthNames, getStartOfWeek, getWeekDays, getWeekOfYear, getWeekdayFormats } from "./date-month.mjs";
|
|
8
|
+
import { YearsRange, getDecadeRange, getDefaultYearRange, getYearsRange, normalizeYear } from "./date-year.mjs";
|
|
9
|
+
import { getPreviousAvailableDate, getTodayDate, setCalendar, setDate } from "./mutation.mjs";
|
|
10
|
+
import { AdjustDateParams, AdjustDateReturn, getAdjustedDateFn, getNextPage, getNextRow, getNextSection, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart } from "./pagination.mjs";
|
|
11
|
+
import { ensureValidCharacters, getLocaleSeparator, isValidCharacter } from "./locale.mjs";
|
|
12
|
+
import { parseDateString } from "./parse-date.mjs";
|
|
13
|
+
import { getDateRangePreset } from "./preset.mjs";
|
|
14
|
+
import { DateAdjustFn, DateGranularity, DateRangePreset, DateValue } from "./types.mjs";
|
|
15
|
+
export { AdjustDateParams, AdjustDateReturn, type DateAdjustFn, type DateGranularity, type DateRangePreset, type DateValue, YearsRange, alignCenter, alignDate, alignEnd, alignStart, alignStartDate, constrainSegments, constrainStart, constrainValue, ensureValidCharacters, formatRange, formatSelectedDate, formatVisibleRange, getAdjustedDateFn, getDateRangePreset, getDayFormatter, getDaysInWeek, getDecadeRange, getDefaultYearRange, getEndDate, getEndOfWeek, getLocaleSeparator, getMonthDays, getMonthFormatter, getMonthNames, getNextPage, getNextRow, getNextSection, getPreviousAvailableDate, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart, getStartOfWeek, getTodayDate, getUnitDuration, getWeekDays, getWeekOfYear, getWeekdayFormats, getYearsRange, isDateEqual, isDateOutsideRange, isDateUnavailable, isNextRangeInvalid, isPreviousRangeInvalid, isValidCharacter, normalizeYear, parseDateString, setCalendar, setDate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { alignDate, alignStartDate } from "./align.js";
|
|
2
|
+
import { isDateEqual, isDateOutsideRange, isDateUnavailable, isNextRangeInvalid, isPreviousRangeInvalid } from "./assertion.js";
|
|
3
|
+
import { alignCenter, alignEnd, alignStart, constrainSegments, constrainStart, constrainValue } from "./constrain.js";
|
|
4
|
+
import { getEndDate, getUnitDuration } from "./duration.js";
|
|
5
|
+
import { formatRange, formatSelectedDate, formatVisibleRange } from "./format.js";
|
|
6
|
+
import { getDayFormatter, getMonthFormatter } from "./formatter.js";
|
|
7
|
+
import { getDaysInWeek, getEndOfWeek, getMonthDays, getMonthNames, getStartOfWeek, getWeekDays, getWeekOfYear, getWeekdayFormats } from "./date-month.js";
|
|
8
|
+
import { YearsRange, getDecadeRange, getDefaultYearRange, getYearsRange, normalizeYear } from "./date-year.js";
|
|
9
|
+
import { getPreviousAvailableDate, getTodayDate, setCalendar, setDate } from "./mutation.js";
|
|
10
|
+
import { AdjustDateParams, AdjustDateReturn, getAdjustedDateFn, getNextPage, getNextRow, getNextSection, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart } from "./pagination.js";
|
|
11
|
+
import { ensureValidCharacters, getLocaleSeparator, isValidCharacter } from "./locale.js";
|
|
12
|
+
import { parseDateString } from "./parse-date.js";
|
|
13
|
+
import { getDateRangePreset } from "./preset.js";
|
|
14
|
+
import { DateAdjustFn, DateGranularity, DateRangePreset, DateValue } from "./types.js";
|
|
15
|
+
export { AdjustDateParams, AdjustDateReturn, type DateAdjustFn, type DateGranularity, type DateRangePreset, type DateValue, YearsRange, alignCenter, alignDate, alignEnd, alignStart, alignStartDate, constrainSegments, constrainStart, constrainValue, ensureValidCharacters, formatRange, formatSelectedDate, formatVisibleRange, getAdjustedDateFn, getDateRangePreset, getDayFormatter, getDaysInWeek, getDecadeRange, getDefaultYearRange, getEndDate, getEndOfWeek, getLocaleSeparator, getMonthDays, getMonthFormatter, getMonthNames, getNextPage, getNextRow, getNextSection, getPreviousAvailableDate, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart, getStartOfWeek, getTodayDate, getUnitDuration, getWeekDays, getWeekOfYear, getWeekdayFormats, getYearsRange, isDateEqual, isDateOutsideRange, isDateUnavailable, isNextRangeInvalid, isPreviousRangeInvalid, isValidCharacter, normalizeYear, parseDateString, setCalendar, setDate };
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
|
|
17
|
-
// src/index.ts
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./align.js"), module.exports);
|
|
21
|
-
__reExport(index_exports, require("./assertion.js"), module.exports);
|
|
22
|
-
__reExport(index_exports, require("./constrain.js"), module.exports);
|
|
23
|
-
__reExport(index_exports, require("./duration.js"), module.exports);
|
|
24
|
-
__reExport(index_exports, require("./format.js"), module.exports);
|
|
25
|
-
__reExport(index_exports, require("./formatter.js"), module.exports);
|
|
26
|
-
__reExport(index_exports, require("./date-month.js"), module.exports);
|
|
27
|
-
__reExport(index_exports, require("./date-year.js"), module.exports);
|
|
28
|
-
__reExport(index_exports, require("./mutation.js"), module.exports);
|
|
29
|
-
__reExport(index_exports, require("./pagination.js"), module.exports);
|
|
30
|
-
__reExport(index_exports, require("./locale.js"), module.exports);
|
|
31
|
-
__reExport(index_exports, require("./parse-date.js"), module.exports);
|
|
32
|
-
__reExport(index_exports, require("./preset.js"), module.exports);
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
...require("./align.js"),
|
|
36
|
-
...require("./assertion.js"),
|
|
37
|
-
...require("./constrain.js"),
|
|
38
|
-
...require("./duration.js"),
|
|
39
|
-
...require("./format.js"),
|
|
40
|
-
...require("./formatter.js"),
|
|
41
|
-
...require("./date-month.js"),
|
|
42
|
-
...require("./date-year.js"),
|
|
43
|
-
...require("./mutation.js"),
|
|
44
|
-
...require("./pagination.js"),
|
|
45
|
-
...require("./locale.js"),
|
|
46
|
-
...require("./parse-date.js"),
|
|
47
|
-
...require("./preset.js")
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
48
4
|
});
|
|
5
|
+
const require_align = require("./align.js");
|
|
6
|
+
const require_assertion = require("./assertion.js");
|
|
7
|
+
const require_constrain = require("./constrain.js");
|
|
8
|
+
const require_duration = require("./duration.js");
|
|
9
|
+
const require_format = require("./format.js");
|
|
10
|
+
const require_formatter = require("./formatter.js");
|
|
11
|
+
const require_date_month = require("./date-month.js");
|
|
12
|
+
const require_date_year = require("./date-year.js");
|
|
13
|
+
const require_mutation = require("./mutation.js");
|
|
14
|
+
const require_pagination = require("./pagination.js");
|
|
15
|
+
const require_locale = require("./locale.js");
|
|
16
|
+
const require_parse_date = require("./parse-date.js");
|
|
17
|
+
const require_preset = require("./preset.js");
|
|
18
|
+
exports.alignCenter = require_constrain.alignCenter;
|
|
19
|
+
exports.alignDate = require_align.alignDate;
|
|
20
|
+
exports.alignEnd = require_constrain.alignEnd;
|
|
21
|
+
exports.alignStart = require_constrain.alignStart;
|
|
22
|
+
exports.alignStartDate = require_align.alignStartDate;
|
|
23
|
+
exports.constrainSegments = require_constrain.constrainSegments;
|
|
24
|
+
exports.constrainStart = require_constrain.constrainStart;
|
|
25
|
+
exports.constrainValue = require_constrain.constrainValue;
|
|
26
|
+
exports.ensureValidCharacters = require_locale.ensureValidCharacters;
|
|
27
|
+
exports.formatRange = require_format.formatRange;
|
|
28
|
+
exports.formatSelectedDate = require_format.formatSelectedDate;
|
|
29
|
+
exports.formatVisibleRange = require_format.formatVisibleRange;
|
|
30
|
+
exports.getAdjustedDateFn = require_pagination.getAdjustedDateFn;
|
|
31
|
+
exports.getDateRangePreset = require_preset.getDateRangePreset;
|
|
32
|
+
exports.getDayFormatter = require_formatter.getDayFormatter;
|
|
33
|
+
exports.getDaysInWeek = require_date_month.getDaysInWeek;
|
|
34
|
+
exports.getDecadeRange = require_date_year.getDecadeRange;
|
|
35
|
+
exports.getDefaultYearRange = require_date_year.getDefaultYearRange;
|
|
36
|
+
exports.getEndDate = require_duration.getEndDate;
|
|
37
|
+
exports.getEndOfWeek = require_date_month.getEndOfWeek;
|
|
38
|
+
exports.getLocaleSeparator = require_locale.getLocaleSeparator;
|
|
39
|
+
exports.getMonthDays = require_date_month.getMonthDays;
|
|
40
|
+
exports.getMonthFormatter = require_formatter.getMonthFormatter;
|
|
41
|
+
exports.getMonthNames = require_date_month.getMonthNames;
|
|
42
|
+
exports.getNextPage = require_pagination.getNextPage;
|
|
43
|
+
exports.getNextRow = require_pagination.getNextRow;
|
|
44
|
+
exports.getNextSection = require_pagination.getNextSection;
|
|
45
|
+
exports.getPreviousAvailableDate = require_mutation.getPreviousAvailableDate;
|
|
46
|
+
exports.getPreviousPage = require_pagination.getPreviousPage;
|
|
47
|
+
exports.getPreviousRow = require_pagination.getPreviousRow;
|
|
48
|
+
exports.getPreviousSection = require_pagination.getPreviousSection;
|
|
49
|
+
exports.getSectionEnd = require_pagination.getSectionEnd;
|
|
50
|
+
exports.getSectionStart = require_pagination.getSectionStart;
|
|
51
|
+
exports.getStartOfWeek = require_date_month.getStartOfWeek;
|
|
52
|
+
exports.getTodayDate = require_mutation.getTodayDate;
|
|
53
|
+
exports.getUnitDuration = require_duration.getUnitDuration;
|
|
54
|
+
exports.getWeekDays = require_date_month.getWeekDays;
|
|
55
|
+
exports.getWeekOfYear = require_date_month.getWeekOfYear;
|
|
56
|
+
exports.getWeekdayFormats = require_date_month.getWeekdayFormats;
|
|
57
|
+
exports.getYearsRange = require_date_year.getYearsRange;
|
|
58
|
+
exports.isDateEqual = require_assertion.isDateEqual;
|
|
59
|
+
exports.isDateOutsideRange = require_assertion.isDateOutsideRange;
|
|
60
|
+
exports.isDateUnavailable = require_assertion.isDateUnavailable;
|
|
61
|
+
exports.isNextRangeInvalid = require_assertion.isNextRangeInvalid;
|
|
62
|
+
exports.isPreviousRangeInvalid = require_assertion.isPreviousRangeInvalid;
|
|
63
|
+
exports.isValidCharacter = require_locale.isValidCharacter;
|
|
64
|
+
exports.normalizeYear = require_date_year.normalizeYear;
|
|
65
|
+
exports.parseDateString = require_parse_date.parseDateString;
|
|
66
|
+
exports.setCalendar = require_mutation.setCalendar;
|
|
67
|
+
exports.setDate = require_mutation.setDate;
|