@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
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
import { DateFormatter } from '@internationalized/date';
|
|
2
|
+
|
|
3
|
+
function getWeekdayFormats(locale, timeZone) {
|
|
4
|
+
const longFormat = new DateFormatter(locale, { weekday: "long", timeZone });
|
|
5
|
+
const shortFormat = new DateFormatter(locale, { weekday: "short", timeZone });
|
|
6
|
+
const narrowFormat = new DateFormatter(locale, { weekday: "narrow", timeZone });
|
|
7
|
+
return (value) => {
|
|
8
|
+
const date = value instanceof Date ? value : value.toDate(timeZone);
|
|
9
|
+
return {
|
|
10
|
+
value,
|
|
11
|
+
short: shortFormat.format(date),
|
|
12
|
+
long: longFormat.format(date),
|
|
13
|
+
narrow: narrowFormat.format(date)
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getWeekdayFormats };
|
package/dist/get-year-range.d.ts
CHANGED
package/dist/get-year-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-year-range.ts
|
|
21
|
-
var get_year_range_exports = {};
|
|
22
|
-
__export(get_year_range_exports, {
|
|
23
|
-
getYearsRange: () => getYearsRange
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(get_year_range_exports);
|
|
26
5
|
function getYearsRange(range) {
|
|
27
6
|
const years = [];
|
|
28
7
|
for (let year = range.from; year <= range.to; year += 1) {
|
|
@@ -30,7 +9,5 @@ function getYearsRange(range) {
|
|
|
30
9
|
}
|
|
31
10
|
return years;
|
|
32
11
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
getYearsRange
|
|
36
|
-
});
|
|
12
|
+
|
|
13
|
+
exports.getYearsRange = getYearsRange;
|
package/dist/get-year-range.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function getYearsRange(range) {
|
|
2
|
+
const years = [];
|
|
3
|
+
for (let year = range.from; year <= range.to; year += 1) {
|
|
4
|
+
years.push(year);
|
|
5
|
+
}
|
|
6
|
+
return years;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { getYearsRange };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export { DateAdjustFn, DateGranularity } from
|
|
21
|
-
import '@internationalized/date';
|
|
1
|
+
export * from "./align";
|
|
2
|
+
export * from "./assertion";
|
|
3
|
+
export * from "./constrain";
|
|
4
|
+
export * from "./duration";
|
|
5
|
+
export * from "./format-date";
|
|
6
|
+
export * from "./format-range";
|
|
7
|
+
export * from "./format-selected-date";
|
|
8
|
+
export * from "./format-visible-range";
|
|
9
|
+
export * from "./get-day-formatter";
|
|
10
|
+
export * from "./get-decade-range";
|
|
11
|
+
export * from "./get-month-days";
|
|
12
|
+
export * from "./get-month-formatter";
|
|
13
|
+
export * from "./get-month-names";
|
|
14
|
+
export * from "./get-week-days";
|
|
15
|
+
export * from "./get-weekday-formats";
|
|
16
|
+
export * from "./get-year-range";
|
|
17
|
+
export * from "./mutation";
|
|
18
|
+
export * from "./pagination";
|
|
19
|
+
export * from "./parse-date";
|
|
20
|
+
export type { DateAdjustFn, DateGranularity } from "./types";
|