@internationalized/date 3.5.3-nightly.4555 → 3.5.3-nightly.4558

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 (96) hide show
  1. package/dist/BuddhistCalendar.main.js +54 -0
  2. package/dist/BuddhistCalendar.main.js.map +1 -0
  3. package/dist/BuddhistCalendar.mjs +49 -0
  4. package/dist/BuddhistCalendar.module.js +49 -0
  5. package/dist/BuddhistCalendar.module.js.map +1 -0
  6. package/dist/CalendarDate.main.js +260 -0
  7. package/dist/CalendarDate.main.js.map +1 -0
  8. package/dist/CalendarDate.mjs +252 -0
  9. package/dist/CalendarDate.module.js +252 -0
  10. package/dist/CalendarDate.module.js.map +1 -0
  11. package/dist/DateFormatter.main.js +145 -0
  12. package/dist/DateFormatter.main.js.map +1 -0
  13. package/dist/DateFormatter.mjs +140 -0
  14. package/dist/DateFormatter.module.js +140 -0
  15. package/dist/DateFormatter.module.js.map +1 -0
  16. package/dist/EthiopicCalendar.main.js +170 -0
  17. package/dist/EthiopicCalendar.main.js.map +1 -0
  18. package/dist/EthiopicCalendar.mjs +163 -0
  19. package/dist/EthiopicCalendar.module.js +163 -0
  20. package/dist/EthiopicCalendar.module.js.map +1 -0
  21. package/dist/GregorianCalendar.main.js +143 -0
  22. package/dist/GregorianCalendar.main.js.map +1 -0
  23. package/dist/GregorianCalendar.mjs +134 -0
  24. package/dist/GregorianCalendar.module.js +134 -0
  25. package/dist/GregorianCalendar.module.js.map +1 -0
  26. package/dist/HebrewCalendar.main.js +149 -0
  27. package/dist/HebrewCalendar.main.js.map +1 -0
  28. package/dist/HebrewCalendar.mjs +144 -0
  29. package/dist/HebrewCalendar.module.js +144 -0
  30. package/dist/HebrewCalendar.module.js.map +1 -0
  31. package/dist/IndianCalendar.main.js +107 -0
  32. package/dist/IndianCalendar.main.js.map +1 -0
  33. package/dist/IndianCalendar.mjs +102 -0
  34. package/dist/IndianCalendar.module.js +102 -0
  35. package/dist/IndianCalendar.module.js.map +1 -0
  36. package/dist/IslamicCalendar.main.js +164 -0
  37. package/dist/IslamicCalendar.main.js.map +1 -0
  38. package/dist/IslamicCalendar.mjs +157 -0
  39. package/dist/IslamicCalendar.module.js +157 -0
  40. package/dist/IslamicCalendar.module.js.map +1 -0
  41. package/dist/JapaneseCalendar.main.js +180 -0
  42. package/dist/JapaneseCalendar.main.js.map +1 -0
  43. package/dist/JapaneseCalendar.mjs +175 -0
  44. package/dist/JapaneseCalendar.module.js +175 -0
  45. package/dist/JapaneseCalendar.module.js.map +1 -0
  46. package/dist/PersianCalendar.main.js +81 -0
  47. package/dist/PersianCalendar.main.js.map +1 -0
  48. package/dist/PersianCalendar.mjs +76 -0
  49. package/dist/PersianCalendar.module.js +76 -0
  50. package/dist/PersianCalendar.module.js.map +1 -0
  51. package/dist/TaiwanCalendar.main.js +81 -0
  52. package/dist/TaiwanCalendar.main.js.map +1 -0
  53. package/dist/TaiwanCalendar.mjs +76 -0
  54. package/dist/TaiwanCalendar.module.js +76 -0
  55. package/dist/TaiwanCalendar.module.js.map +1 -0
  56. package/dist/conversion.main.js +236 -0
  57. package/dist/conversion.main.js.map +1 -0
  58. package/dist/conversion.mjs +218 -0
  59. package/dist/conversion.module.js +218 -0
  60. package/dist/conversion.module.js.map +1 -0
  61. package/dist/createCalendar.main.js +69 -0
  62. package/dist/createCalendar.main.js.map +1 -0
  63. package/dist/createCalendar.mjs +64 -0
  64. package/dist/createCalendar.module.js +64 -0
  65. package/dist/createCalendar.module.js.map +1 -0
  66. package/dist/import.mjs +15 -2534
  67. package/dist/main.js +75 -2594
  68. package/dist/main.js.map +1 -1
  69. package/dist/manipulation.main.js +362 -0
  70. package/dist/manipulation.main.js.map +1 -0
  71. package/dist/manipulation.mjs +344 -0
  72. package/dist/manipulation.module.js +344 -0
  73. package/dist/manipulation.module.js.map +1 -0
  74. package/dist/module.js +15 -2534
  75. package/dist/module.js.map +1 -1
  76. package/dist/queries.main.js +287 -0
  77. package/dist/queries.main.js.map +1 -0
  78. package/dist/queries.mjs +256 -0
  79. package/dist/queries.module.js +256 -0
  80. package/dist/queries.module.js.map +1 -0
  81. package/dist/string.main.js +171 -0
  82. package/dist/string.main.js.map +1 -0
  83. package/dist/string.mjs +156 -0
  84. package/dist/string.module.js +156 -0
  85. package/dist/string.module.js.map +1 -0
  86. package/dist/utils.main.js +33 -0
  87. package/dist/utils.main.js.map +1 -0
  88. package/dist/utils.mjs +28 -0
  89. package/dist/utils.module.js +28 -0
  90. package/dist/utils.module.js.map +1 -0
  91. package/dist/weekStartData.main.js +118 -0
  92. package/dist/weekStartData.main.js.map +1 -0
  93. package/dist/weekStartData.mjs +113 -0
  94. package/dist/weekStartData.module.js +113 -0
  95. package/dist/weekStartData.module.js.map +1 -0
  96. package/package.json +2 -2
@@ -0,0 +1,344 @@
1
+ import {epochFromDate as $11d87f3f76e88657$export$bd4fb2bc8bb06fb, fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484} from "./conversion.mjs";
2
+ import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ const $735220c2d4774dd3$var$ONE_HOUR = 3600000;
17
+ function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
18
+ let mutableDate = date.copy();
19
+ let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
20
+ $735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
21
+ if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
22
+ mutableDate.month += duration.months || 0;
23
+ $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
24
+ $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
25
+ mutableDate.day += (duration.weeks || 0) * 7;
26
+ mutableDate.day += duration.days || 0;
27
+ mutableDate.day += days;
28
+ $735220c2d4774dd3$var$balanceDay(mutableDate);
29
+ if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
30
+ // Constrain in case adding ended up with a date outside the valid range for the calendar system.
31
+ // The behavior here is slightly different than when constraining in the `set` function in that
32
+ // we adjust smaller fields to their minimum/maximum values rather than constraining each field
33
+ // individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.
34
+ if (mutableDate.year < 1) {
35
+ mutableDate.year = 1;
36
+ mutableDate.month = 1;
37
+ mutableDate.day = 1;
38
+ }
39
+ let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
40
+ if (mutableDate.year > maxYear) {
41
+ var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
42
+ let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
43
+ mutableDate.year = maxYear;
44
+ mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
45
+ mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
46
+ }
47
+ if (mutableDate.month < 1) {
48
+ mutableDate.month = 1;
49
+ mutableDate.day = 1;
50
+ }
51
+ let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
52
+ if (mutableDate.month > maxMonth) {
53
+ mutableDate.month = maxMonth;
54
+ mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
55
+ }
56
+ mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
57
+ return mutableDate;
58
+ }
59
+ function $735220c2d4774dd3$var$addYears(date, years) {
60
+ var _date_calendar_isInverseEra, _date_calendar;
61
+ if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
62
+ date.year += years;
63
+ }
64
+ function $735220c2d4774dd3$var$balanceYearMonth(date) {
65
+ while(date.month < 1){
66
+ $735220c2d4774dd3$var$addYears(date, -1);
67
+ date.month += date.calendar.getMonthsInYear(date);
68
+ }
69
+ let monthsInYear = 0;
70
+ while(date.month > (monthsInYear = date.calendar.getMonthsInYear(date))){
71
+ date.month -= monthsInYear;
72
+ $735220c2d4774dd3$var$addYears(date, 1);
73
+ }
74
+ }
75
+ function $735220c2d4774dd3$var$balanceDay(date) {
76
+ while(date.day < 1){
77
+ date.month--;
78
+ $735220c2d4774dd3$var$balanceYearMonth(date);
79
+ date.day += date.calendar.getDaysInMonth(date);
80
+ }
81
+ while(date.day > date.calendar.getDaysInMonth(date)){
82
+ date.day -= date.calendar.getDaysInMonth(date);
83
+ date.month++;
84
+ $735220c2d4774dd3$var$balanceYearMonth(date);
85
+ }
86
+ }
87
+ function $735220c2d4774dd3$var$constrainMonthDay(date) {
88
+ date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
89
+ date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
90
+ }
91
+ function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
92
+ if (date.calendar.constrainDate) date.calendar.constrainDate(date);
93
+ date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
94
+ $735220c2d4774dd3$var$constrainMonthDay(date);
95
+ }
96
+ function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
97
+ let inverseDuration = {};
98
+ for(let key in duration)if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
99
+ return inverseDuration;
100
+ }
101
+ function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
102
+ return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
103
+ }
104
+ function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
105
+ let mutableDate = date.copy();
106
+ if (fields.era != null) mutableDate.era = fields.era;
107
+ if (fields.year != null) mutableDate.year = fields.year;
108
+ if (fields.month != null) mutableDate.month = fields.month;
109
+ if (fields.day != null) mutableDate.day = fields.day;
110
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
111
+ return mutableDate;
112
+ }
113
+ function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
114
+ let mutableValue = value.copy();
115
+ if (fields.hour != null) mutableValue.hour = fields.hour;
116
+ if (fields.minute != null) mutableValue.minute = fields.minute;
117
+ if (fields.second != null) mutableValue.second = fields.second;
118
+ if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
119
+ $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
120
+ return mutableValue;
121
+ }
122
+ function $735220c2d4774dd3$var$balanceTime(time) {
123
+ time.second += Math.floor(time.millisecond / 1000);
124
+ time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
125
+ time.minute += Math.floor(time.second / 60);
126
+ time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
127
+ time.hour += Math.floor(time.minute / 60);
128
+ time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
129
+ let days = Math.floor(time.hour / 24);
130
+ time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
131
+ return days;
132
+ }
133
+ function $735220c2d4774dd3$export$7555de1e070510cb(time) {
134
+ time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
135
+ time.second = Math.max(0, Math.min(time.second, 59));
136
+ time.minute = Math.max(0, Math.min(time.minute, 59));
137
+ time.hour = Math.max(0, Math.min(time.hour, 23));
138
+ }
139
+ function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
140
+ let result = a % b;
141
+ if (result < 0) result += b;
142
+ return result;
143
+ }
144
+ function $735220c2d4774dd3$var$addTimeFields(time, duration) {
145
+ time.hour += duration.hours || 0;
146
+ time.minute += duration.minutes || 0;
147
+ time.second += duration.seconds || 0;
148
+ time.millisecond += duration.milliseconds || 0;
149
+ return $735220c2d4774dd3$var$balanceTime(time);
150
+ }
151
+ function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
152
+ let res = time.copy();
153
+ $735220c2d4774dd3$var$addTimeFields(res, duration);
154
+ return res;
155
+ }
156
+ function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
157
+ return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
158
+ }
159
+ function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
160
+ let mutable = value.copy();
161
+ switch(field){
162
+ case "era":
163
+ {
164
+ let eras = value.calendar.getEras();
165
+ let eraIndex = eras.indexOf(value.era);
166
+ if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
167
+ eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
168
+ mutable.era = eras[eraIndex];
169
+ // Constrain the year and other fields within the era, so the era doesn't change when we balance below.
170
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
171
+ break;
172
+ }
173
+ case "year":
174
+ var _mutable_calendar_isInverseEra, _mutable_calendar;
175
+ if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
176
+ // The year field should not cycle within the era as that can cause weird behavior affecting other fields.
177
+ // We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
178
+ // we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
179
+ mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
180
+ if (mutable.year === -Infinity) mutable.year = 1;
181
+ if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
182
+ break;
183
+ case "month":
184
+ mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
185
+ break;
186
+ case "day":
187
+ mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
188
+ break;
189
+ default:
190
+ throw new Error("Unsupported field " + field);
191
+ }
192
+ if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
193
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
194
+ return mutable;
195
+ }
196
+ function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
197
+ let mutable = value.copy();
198
+ switch(field){
199
+ case "hour":
200
+ {
201
+ let hours = value.hour;
202
+ let min = 0;
203
+ let max = 23;
204
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
205
+ let isPM = hours >= 12;
206
+ min = isPM ? 12 : 0;
207
+ max = isPM ? 23 : 11;
208
+ }
209
+ mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
210
+ break;
211
+ }
212
+ case "minute":
213
+ mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
214
+ break;
215
+ case "second":
216
+ mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
217
+ break;
218
+ case "millisecond":
219
+ mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
220
+ break;
221
+ default:
222
+ throw new Error("Unsupported field " + field);
223
+ }
224
+ return mutable;
225
+ }
226
+ function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
227
+ if (round) {
228
+ value += Math.sign(amount);
229
+ if (value < min) value = max;
230
+ let div = Math.abs(amount);
231
+ if (amount > 0) value = Math.ceil(value / div) * div;
232
+ else value = Math.floor(value / div) * div;
233
+ if (value > max) value = min;
234
+ } else {
235
+ value += amount;
236
+ if (value < min) value = max - (min - value - 1);
237
+ else if (value > max) value = min + (value - max - 1);
238
+ }
239
+ return value;
240
+ }
241
+ function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
242
+ let ms;
243
+ if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
244
+ let res = $735220c2d4774dd3$export$e16d8520af44a096((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), {
245
+ years: duration.years,
246
+ months: duration.months,
247
+ weeks: duration.weeks,
248
+ days: duration.days
249
+ });
250
+ // Changing the date may change the timezone offset, so we need to recompute
251
+ // using the 'compatible' disambiguation.
252
+ ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
253
+ } else // Otherwise, preserve the offset of the original date.
254
+ ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
255
+ // Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
256
+ // For example, adding one hour during a DST transition may result in the hour field staying the same or
257
+ // skipping an hour. This results in the offset field changing value instead of the specified field.
258
+ ms += duration.milliseconds || 0;
259
+ ms += (duration.seconds || 0) * 1000;
260
+ ms += (duration.minutes || 0) * 60000;
261
+ ms += (duration.hours || 0) * 3600000;
262
+ let res = (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone);
263
+ return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(res, dateTime.calendar);
264
+ }
265
+ function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
266
+ return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
267
+ }
268
+ function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
269
+ // For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
270
+ // For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
271
+ // offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
272
+ switch(field){
273
+ case "hour":
274
+ {
275
+ let min = 0;
276
+ let max = 23;
277
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
278
+ let isPM = dateTime.hour >= 12;
279
+ min = isPM ? 12 : 0;
280
+ max = isPM ? 23 : 11;
281
+ }
282
+ // The minimum and maximum hour may be affected by daylight saving time.
283
+ // For example, it might jump forward at midnight, and skip 1am.
284
+ // Or it might end at midnight and repeat the 11pm hour. To handle this, we get
285
+ // the possible absolute times for the min and max, and find the maximum range
286
+ // that is within the current day.
287
+ let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
288
+ let minDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
289
+ hour: min
290
+ }), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
291
+ let minAbsolute = [
292
+ (0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, "earlier"),
293
+ (0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, "later")
294
+ ].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === minDate.day)[0];
295
+ let maxDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
296
+ hour: max
297
+ }), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
298
+ let maxAbsolute = [
299
+ (0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, "earlier"),
300
+ (0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, "later")
301
+ ].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === maxDate.day).pop();
302
+ // Since hours may repeat, we need to operate on the absolute time in milliseconds.
303
+ // This is done in hours from the Unix epoch so that cycleValue works correctly,
304
+ // and then converted back to milliseconds.
305
+ let ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
306
+ let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
307
+ let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
308
+ ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
309
+ // Now compute the new timezone offset, and convert the absolute time back to local time.
310
+ return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
311
+ }
312
+ case "minute":
313
+ case "second":
314
+ case "millisecond":
315
+ // @ts-ignore
316
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
317
+ case "era":
318
+ case "year":
319
+ case "month":
320
+ case "day":
321
+ {
322
+ let res = $735220c2d4774dd3$export$d52ced6badfb9a4c((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), field, amount, options);
323
+ let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
324
+ return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
325
+ }
326
+ default:
327
+ throw new Error("Unsupported field " + field);
328
+ }
329
+ }
330
+ function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
331
+ // Set the date/time fields, and recompute the UTC offset to account for DST changes.
332
+ // We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
333
+ let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
334
+ let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
335
+ // If the resulting plain date time values are equal, return the original time.
336
+ // We don't want to change the offset when setting the time to the same value.
337
+ if (res.compare(plainDateTime) === 0) return dateTime;
338
+ let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone, disambiguation);
339
+ return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
340
+ }
341
+
342
+
343
+ export {$735220c2d4774dd3$export$e16d8520af44a096 as add, $735220c2d4774dd3$export$c4e2ecac49351ef2 as constrain, $735220c2d4774dd3$export$3e2544e88a25bff8 as invertDuration, $735220c2d4774dd3$export$4e2d2ead65e5f7e3 as subtract, $735220c2d4774dd3$export$adaa4cf7ef1b65be as set, $735220c2d4774dd3$export$e5d5e1c1822b6e56 as setTime, $735220c2d4774dd3$export$7555de1e070510cb as constrainTime, $735220c2d4774dd3$export$7ed87b6bc2506470 as addTime, $735220c2d4774dd3$export$fe34d3a381cd7501 as subtractTime, $735220c2d4774dd3$export$d52ced6badfb9a4c as cycleDate, $735220c2d4774dd3$export$dd02b3e0007dfe28 as cycleTime, $735220c2d4774dd3$export$96b1d28349274637 as addZoned, $735220c2d4774dd3$export$6814caac34ca03c7 as subtractZoned, $735220c2d4774dd3$export$9a297d111fc86b79 as cycleZoned, $735220c2d4774dd3$export$31b5430eb18be4f8 as setZoned};
344
+ //# sourceMappingURL=manipulation.mjs.map