@zag-js/date-utils 1.46.0 → 1.48.0

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.
Files changed (65) hide show
  1. package/dist/align.d.mts +4 -8
  2. package/dist/align.d.ts +4 -8
  3. package/dist/align.js +15 -47
  4. package/dist/align.mjs +10 -21
  5. package/dist/assertion.d.mts +6 -10
  6. package/dist/assertion.d.ts +6 -10
  7. package/dist/assertion.js +21 -48
  8. package/dist/assertion.mjs +13 -19
  9. package/dist/constrain.d.mts +7 -10
  10. package/dist/constrain.d.ts +7 -10
  11. package/dist/constrain.js +68 -133
  12. package/dist/constrain.mjs +59 -110
  13. package/dist/date-month.d.mts +17 -21
  14. package/dist/date-month.d.ts +17 -21
  15. package/dist/date-month.js +103 -112
  16. package/dist/date-month.mjs +92 -86
  17. package/dist/date-year.d.mts +8 -11
  18. package/dist/date-year.d.ts +8 -11
  19. package/dist/date-year.js +35 -62
  20. package/dist/date-year.mjs +28 -34
  21. package/dist/duration.d.mts +8 -12
  22. package/dist/duration.d.ts +8 -12
  23. package/dist/duration.js +13 -37
  24. package/dist/duration.mjs +8 -11
  25. package/dist/format.d.mts +5 -8
  26. package/dist/format.d.ts +5 -8
  27. package/dist/format.js +35 -76
  28. package/dist/format.mjs +29 -49
  29. package/dist/formatter.d.mts +3 -6
  30. package/dist/formatter.d.ts +3 -6
  31. package/dist/formatter.js +26 -50
  32. package/dist/formatter.mjs +21 -24
  33. package/dist/get-era-format.d.mts +2 -6
  34. package/dist/get-era-format.d.ts +2 -6
  35. package/dist/get-era-format.js +9 -34
  36. package/dist/get-era-format.mjs +5 -9
  37. package/dist/index.d.mts +15 -15
  38. package/dist/index.d.ts +15 -15
  39. package/dist/index.js +66 -47
  40. package/dist/index.mjs +14 -14
  41. package/dist/locale.d.mts +3 -5
  42. package/dist/locale.d.ts +3 -5
  43. package/dist/locale.js +28 -55
  44. package/dist/locale.mjs +22 -28
  45. package/dist/mutation.d.mts +6 -10
  46. package/dist/mutation.d.ts +6 -10
  47. package/dist/mutation.js +21 -53
  48. package/dist/mutation.mjs +14 -30
  49. package/dist/pagination.d.mts +16 -19
  50. package/dist/pagination.d.ts +16 -19
  51. package/dist/pagination.js +120 -201
  52. package/dist/pagination.mjs +106 -166
  53. package/dist/parse-date.d.mts +2 -6
  54. package/dist/parse-date.d.ts +2 -6
  55. package/dist/parse-date.js +41 -72
  56. package/dist/parse-date.mjs +37 -47
  57. package/dist/preset.d.mts +3 -6
  58. package/dist/preset.d.ts +3 -6
  59. package/dist/preset.js +23 -63
  60. package/dist/preset.mjs +19 -47
  61. package/dist/types.d.mts +17 -20
  62. package/dist/types.d.ts +17 -20
  63. package/dist/types.js +4 -18
  64. package/dist/types.mjs +1 -0
  65. package/package.json +3 -3
@@ -1,220 +1,139 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/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
- module.exports = __toCommonJS(pagination_exports);
34
- var import_date = require("@internationalized/date");
35
- var import_assertion = require("./assertion.js");
36
- var import_constrain = require("./constrain.js");
37
- var import_duration = require("./duration.js");
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
- return function getDate(options) {
40
- const { startDate, focusedDate } = options;
41
- const endDate = (0, import_duration.getEndDate)(startDate, visibleDuration);
42
- if ((0, import_assertion.isDateOutsideRange)(focusedDate, minValue, maxValue)) {
43
- return {
44
- startDate,
45
- focusedDate: (0, import_constrain.constrainValue)(focusedDate, minValue, maxValue),
46
- endDate
47
- };
48
- }
49
- if (focusedDate.compare(startDate) < 0) {
50
- return {
51
- startDate: (0, import_constrain.alignEnd)(focusedDate, visibleDuration, locale, minValue, maxValue),
52
- focusedDate: (0, import_constrain.constrainValue)(focusedDate, minValue, maxValue),
53
- endDate
54
- };
55
- }
56
- if (focusedDate.compare(endDate) > 0) {
57
- return {
58
- startDate: (0, import_constrain.alignStart)(focusedDate, visibleDuration, locale, minValue, maxValue),
59
- endDate,
60
- focusedDate: (0, import_constrain.constrainValue)(focusedDate, minValue, maxValue)
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
72
- const start = startDate.add(visibleDuration);
73
- return adjust({
74
- focusedDate: focusedDate.add(visibleDuration),
75
- startDate: (0, import_constrain.alignStart)(
76
- (0, import_constrain.constrainStart)(focusedDate, start, visibleDuration, locale, minValue, maxValue),
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
84
- let start = startDate.subtract(visibleDuration);
85
- return adjust({
86
- focusedDate: focusedDate.subtract(visibleDuration),
87
- startDate: (0, import_constrain.alignStart)(
88
- (0, import_constrain.constrainStart)(focusedDate, start, visibleDuration, locale, minValue, maxValue),
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
96
- if (visibleDuration.days) {
97
- return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
98
- }
99
- if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {
100
- return adjust({
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
108
- if (visibleDuration.days) {
109
- return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
110
- }
111
- if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {
112
- return adjust({
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
120
- if (visibleDuration.days) {
121
- return adjust({
122
- focusedDate: startDate,
123
- startDate
124
- });
125
- }
126
- if (visibleDuration.weeks) {
127
- return adjust({
128
- focusedDate: (0, import_date.startOfWeek)(focusedDate, locale),
129
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
141
- const endDate = (0, import_duration.getEndDate)(startDate, visibleDuration);
142
- if (visibleDuration.days) {
143
- return adjust({
144
- focusedDate: endDate,
145
- startDate
146
- });
147
- }
148
- if (visibleDuration.weeks) {
149
- return adjust({
150
- focusedDate: (0, import_date.endOfWeek)(focusedDate, locale),
151
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
163
- if (!larger && !visibleDuration.days) {
164
- return adjust({
165
- focusedDate: focusedDate.add((0, import_duration.getUnitDuration)(visibleDuration)),
166
- startDate
167
- });
168
- }
169
- if (visibleDuration.days) {
170
- return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
171
- }
172
- if (visibleDuration.weeks) {
173
- return adjust({
174
- focusedDate: focusedDate.add({ months: 1 }),
175
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
187
- if (!larger && !visibleDuration.days) {
188
- return adjust({
189
- focusedDate: focusedDate.subtract((0, import_duration.getUnitDuration)(visibleDuration)),
190
- startDate
191
- });
192
- }
193
- if (visibleDuration.days) {
194
- return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
195
- }
196
- if (visibleDuration.weeks) {
197
- return adjust({
198
- focusedDate: focusedDate.subtract({ months: 1 }),
199
- startDate
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
- // Annotate the CommonJS export names for ESM import in node:
210
- 0 && (module.exports = {
211
- getAdjustedDateFn,
212
- getNextPage,
213
- getNextRow,
214
- getNextSection,
215
- getPreviousPage,
216
- getPreviousRow,
217
- getPreviousSection,
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;
@@ -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
- return function getDate(options) {
8
- const { startDate, focusedDate } = options;
9
- const endDate = getEndDate(startDate, visibleDuration);
10
- if (isDateOutsideRange(focusedDate, minValue, maxValue)) {
11
- return {
12
- startDate,
13
- focusedDate: constrainValue(focusedDate, minValue, maxValue),
14
- endDate
15
- };
16
- }
17
- if (focusedDate.compare(startDate) < 0) {
18
- return {
19
- startDate: alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue),
20
- focusedDate: constrainValue(focusedDate, minValue, maxValue),
21
- endDate
22
- };
23
- }
24
- if (focusedDate.compare(endDate) > 0) {
25
- return {
26
- startDate: alignStart(focusedDate, visibleDuration, locale, minValue, maxValue),
27
- endDate,
28
- focusedDate: constrainValue(focusedDate, minValue, maxValue)
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
40
- const start = startDate.add(visibleDuration);
41
- return adjust({
42
- focusedDate: focusedDate.add(visibleDuration),
43
- startDate: alignStart(
44
- constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
52
- let start = startDate.subtract(visibleDuration);
53
- return adjust({
54
- focusedDate: focusedDate.subtract(visibleDuration),
55
- startDate: alignStart(
56
- constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
64
- if (visibleDuration.days) {
65
- return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
66
- }
67
- if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {
68
- return adjust({
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
76
- if (visibleDuration.days) {
77
- return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
78
- }
79
- if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {
80
- return adjust({
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
88
- if (visibleDuration.days) {
89
- return adjust({
90
- focusedDate: startDate,
91
- startDate
92
- });
93
- }
94
- if (visibleDuration.weeks) {
95
- return adjust({
96
- focusedDate: startOfWeek(focusedDate, locale),
97
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
109
- const endDate = getEndDate(startDate, visibleDuration);
110
- if (visibleDuration.days) {
111
- return adjust({
112
- focusedDate: endDate,
113
- startDate
114
- });
115
- }
116
- if (visibleDuration.weeks) {
117
- return adjust({
118
- focusedDate: endOfWeek(focusedDate, locale),
119
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
131
- if (!larger && !visibleDuration.days) {
132
- return adjust({
133
- focusedDate: focusedDate.add(getUnitDuration(visibleDuration)),
134
- startDate
135
- });
136
- }
137
- if (visibleDuration.days) {
138
- return getNextPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
139
- }
140
- if (visibleDuration.weeks) {
141
- return adjust({
142
- focusedDate: focusedDate.add({ months: 1 }),
143
- startDate
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
- const adjust = getAdjustedDateFn(visibleDuration, locale, minValue, maxValue);
155
- if (!larger && !visibleDuration.days) {
156
- return adjust({
157
- focusedDate: focusedDate.subtract(getUnitDuration(visibleDuration)),
158
- startDate
159
- });
160
- }
161
- if (visibleDuration.days) {
162
- return getPreviousPage(focusedDate, startDate, visibleDuration, locale, minValue, maxValue);
163
- }
164
- if (visibleDuration.weeks) {
165
- return adjust({
166
- focusedDate: focusedDate.subtract({ months: 1 }),
167
- startDate
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 };
@@ -1,6 +1,2 @@
1
- import { DateValue } from './types.mjs';
2
- import '@internationalized/date';
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;
@@ -1,6 +1,2 @@
1
- import { DateValue } from './types.js';
2
- import '@internationalized/date';
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;