@zag-js/date-utils 2.0.0-next.3 → 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 -11
- package/dist/date-year.d.ts +8 -11
- package/dist/date-year.js +35 -62
- package/dist/date-year.mjs +28 -34
- 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/pagination.js
CHANGED
|
@@ -1,220 +1,139 @@
|
|
|
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/pagination.ts
|
|
21
|
-
var pagination_exports = {};
|
|
22
|
-
__export(pagination_exports, {
|
|
23
|
-
getAdjustedDateFn: () => getAdjustedDateFn,
|
|
24
|
-
getNextPage: () => getNextPage,
|
|
25
|
-
getNextRow: () => getNextRow,
|
|
26
|
-
getNextSection: () => getNextSection,
|
|
27
|
-
getPreviousPage: () => getPreviousPage,
|
|
28
|
-
getPreviousRow: () => getPreviousRow,
|
|
29
|
-
getPreviousSection: () => getPreviousSection,
|
|
30
|
-
getSectionEnd: () => getSectionEnd,
|
|
31
|
-
getSectionStart: () => getSectionStart
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
32
4
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
5
|
+
const require_assertion = require("./assertion.js");
|
|
6
|
+
const require_constrain = require("./constrain.js");
|
|
7
|
+
const require_duration = require("./duration.js");
|
|
8
|
+
let _internationalized_date = require("@internationalized/date");
|
|
9
|
+
// src/pagination.ts
|
|
38
10
|
function getAdjustedDateFn(visibleDuration, locale, minValue, maxValue) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
startDate,
|
|
65
|
-
endDate,
|
|
66
|
-
focusedDate: (0, import_constrain.constrainValue)(focusedDate, minValue, maxValue)
|
|
67
|
-
};
|
|
68
|
-
};
|
|
11
|
+
return function getDate(options) {
|
|
12
|
+
const { startDate, focusedDate } = options;
|
|
13
|
+
const endDate = require_duration.getEndDate(startDate, visibleDuration);
|
|
14
|
+
if (require_assertion.isDateOutsideRange(focusedDate, minValue, maxValue)) return {
|
|
15
|
+
startDate,
|
|
16
|
+
focusedDate: require_constrain.constrainValue(focusedDate, minValue, maxValue),
|
|
17
|
+
endDate
|
|
18
|
+
};
|
|
19
|
+
if (focusedDate.compare(startDate) < 0) return {
|
|
20
|
+
startDate: require_constrain.alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue),
|
|
21
|
+
focusedDate: require_constrain.constrainValue(focusedDate, minValue, maxValue),
|
|
22
|
+
endDate
|
|
23
|
+
};
|
|
24
|
+
if (focusedDate.compare(endDate) > 0) return {
|
|
25
|
+
startDate: require_constrain.alignStart(focusedDate, visibleDuration, locale, minValue, maxValue),
|
|
26
|
+
endDate,
|
|
27
|
+
focusedDate: require_constrain.constrainValue(focusedDate, minValue, maxValue)
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
startDate,
|
|
31
|
+
endDate,
|
|
32
|
+
focusedDate: require_constrain.constrainValue(focusedDate, minValue, maxValue)
|
|
33
|
+
};
|
|
34
|
+
};
|
|
69
35
|
}
|
|
70
36
|
function getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
visibleDuration,
|
|
78
|
-
locale
|
|
79
|
-
)
|
|
80
|
-
});
|
|
37
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
38
|
+
const start = startDate.add(visibleDuration);
|
|
39
|
+
return adjust({
|
|
40
|
+
focusedDate: focusedDate.add(visibleDuration),
|
|
41
|
+
startDate: require_constrain.alignStart(require_constrain.constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale)
|
|
42
|
+
});
|
|
81
43
|
}
|
|
82
44
|
function getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
visibleDuration,
|
|
90
|
-
locale
|
|
91
|
-
)
|
|
92
|
-
});
|
|
45
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
46
|
+
let start = startDate.subtract(visibleDuration);
|
|
47
|
+
return adjust({
|
|
48
|
+
focusedDate: focusedDate.subtract(visibleDuration),
|
|
49
|
+
startDate: require_constrain.alignStart(require_constrain.constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale)
|
|
50
|
+
});
|
|
93
51
|
}
|
|
94
52
|
function getNextRow(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
focusedDate: focusedDate.add({ weeks: 1 }),
|
|
102
|
-
startDate
|
|
103
|
-
});
|
|
104
|
-
}
|
|
53
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
54
|
+
if (visibleDuration.days) return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
55
|
+
if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) return adjust({
|
|
56
|
+
focusedDate: focusedDate.add({ weeks: 1 }),
|
|
57
|
+
startDate
|
|
58
|
+
});
|
|
105
59
|
}
|
|
106
60
|
function getPreviousRow(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
focusedDate: focusedDate.subtract({ weeks: 1 }),
|
|
114
|
-
startDate
|
|
115
|
-
});
|
|
116
|
-
}
|
|
61
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
62
|
+
if (visibleDuration.days) return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
63
|
+
if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) return adjust({
|
|
64
|
+
focusedDate: focusedDate.subtract({ weeks: 1 }),
|
|
65
|
+
startDate
|
|
66
|
+
});
|
|
117
67
|
}
|
|
118
68
|
function getSectionStart(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
133
|
-
return adjust({
|
|
134
|
-
focusedDate: (0, import_date.startOfMonth)(focusedDate),
|
|
135
|
-
startDate
|
|
136
|
-
});
|
|
137
|
-
}
|
|
69
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
70
|
+
if (visibleDuration.days) return adjust({
|
|
71
|
+
focusedDate: startDate,
|
|
72
|
+
startDate
|
|
73
|
+
});
|
|
74
|
+
if (visibleDuration.weeks) return adjust({
|
|
75
|
+
focusedDate: (0, _internationalized_date.startOfWeek)(focusedDate, locale),
|
|
76
|
+
startDate
|
|
77
|
+
});
|
|
78
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
79
|
+
focusedDate: (0, _internationalized_date.startOfMonth)(focusedDate),
|
|
80
|
+
startDate
|
|
81
|
+
});
|
|
138
82
|
}
|
|
139
83
|
function getSectionEnd(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
155
|
-
return adjust({
|
|
156
|
-
focusedDate: (0, import_date.endOfMonth)(focusedDate),
|
|
157
|
-
startDate
|
|
158
|
-
});
|
|
159
|
-
}
|
|
84
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
85
|
+
const endDate = require_duration.getEndDate(startDate, visibleDuration);
|
|
86
|
+
if (visibleDuration.days) return adjust({
|
|
87
|
+
focusedDate: endDate,
|
|
88
|
+
startDate
|
|
89
|
+
});
|
|
90
|
+
if (visibleDuration.weeks) return adjust({
|
|
91
|
+
focusedDate: (0, _internationalized_date.endOfWeek)(focusedDate, locale),
|
|
92
|
+
startDate
|
|
93
|
+
});
|
|
94
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
95
|
+
focusedDate: (0, _internationalized_date.endOfMonth)(focusedDate),
|
|
96
|
+
startDate
|
|
97
|
+
});
|
|
160
98
|
}
|
|
161
99
|
function getNextSection(focusedDate, startDate, larger, visibleDuration, locale, minValue, maxValue) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
179
|
-
return adjust({
|
|
180
|
-
focusedDate: focusedDate.add({ years: 1 }),
|
|
181
|
-
startDate
|
|
182
|
-
});
|
|
183
|
-
}
|
|
100
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
101
|
+
if (!larger && !visibleDuration.days) return adjust({
|
|
102
|
+
focusedDate: focusedDate.add(require_duration.getUnitDuration(visibleDuration)),
|
|
103
|
+
startDate
|
|
104
|
+
});
|
|
105
|
+
if (visibleDuration.days) return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
106
|
+
if (visibleDuration.weeks) return adjust({
|
|
107
|
+
focusedDate: focusedDate.add({ months: 1 }),
|
|
108
|
+
startDate
|
|
109
|
+
});
|
|
110
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
111
|
+
focusedDate: focusedDate.add({ years: 1 }),
|
|
112
|
+
startDate
|
|
113
|
+
});
|
|
184
114
|
}
|
|
185
115
|
function getPreviousSection(focusedDate, startDate, larger, visibleDuration, locale, minValue, maxValue) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
203
|
-
return adjust({
|
|
204
|
-
focusedDate: focusedDate.subtract({ years: 1 }),
|
|
205
|
-
startDate
|
|
206
|
-
});
|
|
207
|
-
}
|
|
116
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
117
|
+
if (!larger && !visibleDuration.days) return adjust({
|
|
118
|
+
focusedDate: focusedDate.subtract(require_duration.getUnitDuration(visibleDuration)),
|
|
119
|
+
startDate
|
|
120
|
+
});
|
|
121
|
+
if (visibleDuration.days) return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
122
|
+
if (visibleDuration.weeks) return adjust({
|
|
123
|
+
focusedDate: focusedDate.subtract({ months: 1 }),
|
|
124
|
+
startDate
|
|
125
|
+
});
|
|
126
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
127
|
+
focusedDate: focusedDate.subtract({ years: 1 }),
|
|
128
|
+
startDate
|
|
129
|
+
});
|
|
208
130
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
getSectionEnd,
|
|
219
|
-
getSectionStart
|
|
220
|
-
});
|
|
131
|
+
exports.getAdjustedDateFn = getAdjustedDateFn;
|
|
132
|
+
exports.getNextPage = getNextPage;
|
|
133
|
+
exports.getNextRow = getNextRow;
|
|
134
|
+
exports.getNextSection = getNextSection;
|
|
135
|
+
exports.getPreviousPage = getPreviousPage;
|
|
136
|
+
exports.getPreviousRow = getPreviousRow;
|
|
137
|
+
exports.getPreviousSection = getPreviousSection;
|
|
138
|
+
exports.getSectionEnd = getSectionEnd;
|
|
139
|
+
exports.getSectionStart = getSectionStart;
|
package/dist/pagination.mjs
CHANGED
|
@@ -1,187 +1,127 @@
|
|
|
1
|
-
// src/pagination.ts
|
|
2
|
-
import { endOfMonth, endOfWeek, startOfMonth, startOfWeek } from "@internationalized/date";
|
|
3
1
|
import { isDateOutsideRange } from "./assertion.mjs";
|
|
4
2
|
import { alignEnd, alignStart, constrainStart, constrainValue } from "./constrain.mjs";
|
|
5
3
|
import { getEndDate, getUnitDuration } from "./duration.mjs";
|
|
4
|
+
import { endOfMonth, endOfWeek, startOfMonth, startOfWeek } from "@internationalized/date";
|
|
5
|
+
// src/pagination.ts
|
|
6
6
|
function getAdjustedDateFn(visibleDuration, locale, minValue, maxValue) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
startDate,
|
|
33
|
-
endDate,
|
|
34
|
-
focusedDate: constrainValue(focusedDate, minValue, maxValue)
|
|
35
|
-
};
|
|
36
|
-
};
|
|
7
|
+
return function getDate(options) {
|
|
8
|
+
const { startDate, focusedDate } = options;
|
|
9
|
+
const endDate = getEndDate(startDate, visibleDuration);
|
|
10
|
+
if (isDateOutsideRange(focusedDate, minValue, maxValue)) return {
|
|
11
|
+
startDate,
|
|
12
|
+
focusedDate: constrainValue(focusedDate, minValue, maxValue),
|
|
13
|
+
endDate
|
|
14
|
+
};
|
|
15
|
+
if (focusedDate.compare(startDate) < 0) return {
|
|
16
|
+
startDate: alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue),
|
|
17
|
+
focusedDate: constrainValue(focusedDate, minValue, maxValue),
|
|
18
|
+
endDate
|
|
19
|
+
};
|
|
20
|
+
if (focusedDate.compare(endDate) > 0) return {
|
|
21
|
+
startDate: alignStart(focusedDate, visibleDuration, locale, minValue, maxValue),
|
|
22
|
+
endDate,
|
|
23
|
+
focusedDate: constrainValue(focusedDate, minValue, maxValue)
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
startDate,
|
|
27
|
+
endDate,
|
|
28
|
+
focusedDate: constrainValue(focusedDate, minValue, maxValue)
|
|
29
|
+
};
|
|
30
|
+
};
|
|
37
31
|
}
|
|
38
32
|
function getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
visibleDuration,
|
|
46
|
-
locale
|
|
47
|
-
)
|
|
48
|
-
});
|
|
33
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
34
|
+
const start = startDate.add(visibleDuration);
|
|
35
|
+
return adjust({
|
|
36
|
+
focusedDate: focusedDate.add(visibleDuration),
|
|
37
|
+
startDate: alignStart(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale)
|
|
38
|
+
});
|
|
49
39
|
}
|
|
50
40
|
function getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
visibleDuration,
|
|
58
|
-
locale
|
|
59
|
-
)
|
|
60
|
-
});
|
|
41
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
42
|
+
let start = startDate.subtract(visibleDuration);
|
|
43
|
+
return adjust({
|
|
44
|
+
focusedDate: focusedDate.subtract(visibleDuration),
|
|
45
|
+
startDate: alignStart(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale)
|
|
46
|
+
});
|
|
61
47
|
}
|
|
62
48
|
function getNextRow(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
focusedDate: focusedDate.add({ weeks: 1 }),
|
|
70
|
-
startDate
|
|
71
|
-
});
|
|
72
|
-
}
|
|
49
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
50
|
+
if (visibleDuration.days) return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
51
|
+
if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) return adjust({
|
|
52
|
+
focusedDate: focusedDate.add({ weeks: 1 }),
|
|
53
|
+
startDate
|
|
54
|
+
});
|
|
73
55
|
}
|
|
74
56
|
function getPreviousRow(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
focusedDate: focusedDate.subtract({ weeks: 1 }),
|
|
82
|
-
startDate
|
|
83
|
-
});
|
|
84
|
-
}
|
|
57
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
58
|
+
if (visibleDuration.days) return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
59
|
+
if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) return adjust({
|
|
60
|
+
focusedDate: focusedDate.subtract({ weeks: 1 }),
|
|
61
|
+
startDate
|
|
62
|
+
});
|
|
85
63
|
}
|
|
86
64
|
function getSectionStart(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
101
|
-
return adjust({
|
|
102
|
-
focusedDate: startOfMonth(focusedDate),
|
|
103
|
-
startDate
|
|
104
|
-
});
|
|
105
|
-
}
|
|
65
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
66
|
+
if (visibleDuration.days) return adjust({
|
|
67
|
+
focusedDate: startDate,
|
|
68
|
+
startDate
|
|
69
|
+
});
|
|
70
|
+
if (visibleDuration.weeks) return adjust({
|
|
71
|
+
focusedDate: startOfWeek(focusedDate, locale),
|
|
72
|
+
startDate
|
|
73
|
+
});
|
|
74
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
75
|
+
focusedDate: startOfMonth(focusedDate),
|
|
76
|
+
startDate
|
|
77
|
+
});
|
|
106
78
|
}
|
|
107
79
|
function getSectionEnd(focusedDate, startDate, visibleDuration, locale, minValue, maxValue) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
123
|
-
return adjust({
|
|
124
|
-
focusedDate: endOfMonth(focusedDate),
|
|
125
|
-
startDate
|
|
126
|
-
});
|
|
127
|
-
}
|
|
80
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
81
|
+
const endDate = getEndDate(startDate, visibleDuration);
|
|
82
|
+
if (visibleDuration.days) return adjust({
|
|
83
|
+
focusedDate: endDate,
|
|
84
|
+
startDate
|
|
85
|
+
});
|
|
86
|
+
if (visibleDuration.weeks) return adjust({
|
|
87
|
+
focusedDate: endOfWeek(focusedDate, locale),
|
|
88
|
+
startDate
|
|
89
|
+
});
|
|
90
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
91
|
+
focusedDate: endOfMonth(focusedDate),
|
|
92
|
+
startDate
|
|
93
|
+
});
|
|
128
94
|
}
|
|
129
95
|
function getNextSection(focusedDate, startDate, larger, visibleDuration, locale, minValue, maxValue) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
147
|
-
return adjust({
|
|
148
|
-
focusedDate: focusedDate.add({ years: 1 }),
|
|
149
|
-
startDate
|
|
150
|
-
});
|
|
151
|
-
}
|
|
96
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
97
|
+
if (!larger && !visibleDuration.days) return adjust({
|
|
98
|
+
focusedDate: focusedDate.add(getUnitDuration(visibleDuration)),
|
|
99
|
+
startDate
|
|
100
|
+
});
|
|
101
|
+
if (visibleDuration.days) return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
102
|
+
if (visibleDuration.weeks) return adjust({
|
|
103
|
+
focusedDate: focusedDate.add({ months: 1 }),
|
|
104
|
+
startDate
|
|
105
|
+
});
|
|
106
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
107
|
+
focusedDate: focusedDate.add({ years: 1 }),
|
|
108
|
+
startDate
|
|
109
|
+
});
|
|
152
110
|
}
|
|
153
111
|
function getPreviousSection(focusedDate, startDate, larger, visibleDuration, locale, minValue, maxValue) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
if (visibleDuration.months || visibleDuration.years) {
|
|
171
|
-
return adjust({
|
|
172
|
-
focusedDate: focusedDate.subtract({ years: 1 }),
|
|
173
|
-
startDate
|
|
174
|
-
});
|
|
175
|
-
}
|
|
112
|
+
const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
|
|
113
|
+
if (!larger && !visibleDuration.days) return adjust({
|
|
114
|
+
focusedDate: focusedDate.subtract(getUnitDuration(visibleDuration)),
|
|
115
|
+
startDate
|
|
116
|
+
});
|
|
117
|
+
if (visibleDuration.days) return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
|
|
118
|
+
if (visibleDuration.weeks) return adjust({
|
|
119
|
+
focusedDate: focusedDate.subtract({ months: 1 }),
|
|
120
|
+
startDate
|
|
121
|
+
});
|
|
122
|
+
if (visibleDuration.months || visibleDuration.years) return adjust({
|
|
123
|
+
focusedDate: focusedDate.subtract({ years: 1 }),
|
|
124
|
+
startDate
|
|
125
|
+
});
|
|
176
126
|
}
|
|
177
|
-
export {
|
|
178
|
-
getAdjustedDateFn,
|
|
179
|
-
getNextPage,
|
|
180
|
-
getNextRow,
|
|
181
|
-
getNextSection,
|
|
182
|
-
getPreviousPage,
|
|
183
|
-
getPreviousRow,
|
|
184
|
-
getPreviousSection,
|
|
185
|
-
getSectionEnd,
|
|
186
|
-
getSectionStart
|
|
187
|
-
};
|
|
127
|
+
export { getAdjustedDateFn, getNextPage, getNextRow, getNextSection, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart };
|
package/dist/parse-date.d.mts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function parseDateString(date: string, locale: string, timeZone: string): DateValue | undefined;
|
|
5
|
-
|
|
6
|
-
export { parseDateString };
|
|
1
|
+
import { DateValue } from "./types.mjs";
|
|
2
|
+
export declare function parseDateString(date: string, locale: string, timeZone: string): DateValue | undefined;
|
package/dist/parse-date.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { DateValue } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function parseDateString(date: string, locale: string, timeZone: string): DateValue | undefined;
|
|
5
|
-
|
|
6
|
-
export { parseDateString };
|
|
1
|
+
import { DateValue } from "./types.js";
|
|
2
|
+
export declare function parseDateString(date: string, locale: string, timeZone: string): DateValue | undefined;
|