@hebcal/core 6.9.2 → 6.10.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.
- package/README.md +8 -7
- package/dist/bundle.js +1140 -1010
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -18
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.js +3 -3
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.d.ts +8 -0
- package/dist/esm/TimedEvent.js +9 -1
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/ashkenazi.po.js.map +1 -1
- package/dist/esm/calendar.js +15 -12
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.js +7 -7
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/cities.json.js.map +1 -1
- package/dist/esm/event.d.ts +47 -0
- package/dist/esm/event.js +63 -4
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.js +3 -5
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he-x-NoNikud.po.js.map +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/he.po.js.map +1 -1
- package/dist/esm/hebcal.d.ts +2 -2
- package/dist/esm/hebcal.js +4 -5
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.js +2 -2
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +3 -5
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isAveilut.js.map +1 -1
- package/dist/esm/isFastDay.js +2 -8
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/modern.js.map +1 -1
- package/dist/esm/molad.js +1 -1
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladBase.js.map +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaName.js.map +1 -1
- package/dist/esm/parshaYear.js +1 -1
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.js +1 -1
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/sefira.json.js.map +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/staticHolidays.js.map +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/string.js.map +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +11 -11
package/dist/bundle.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
6
|
-
const version = '6.
|
|
6
|
+
const version = '6.10.0';
|
|
7
7
|
|
|
8
|
-
/*! @hebcal/hdate v0.22.
|
|
8
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
9
9
|
/** @private */
|
|
10
10
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
11
11
|
/** @private */
|
|
@@ -189,7 +189,7 @@ function abs2greg(abs) {
|
|
|
189
189
|
return dt;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
/*! @hebcal/hdate v0.22.
|
|
192
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
193
193
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
194
194
|
/**
|
|
195
195
|
* Gregorian date helper functions.
|
|
@@ -219,7 +219,7 @@ exports.greg.greg2abs = greg2abs;
|
|
|
219
219
|
exports.greg.isDate = isDate;
|
|
220
220
|
exports.greg.isLeapYear = isGregLeapYear;
|
|
221
221
|
|
|
222
|
-
/*! @hebcal/hdate v0.22.
|
|
222
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
223
223
|
/**
|
|
224
224
|
* Removes niqqud from Hebrew string
|
|
225
225
|
* @example
|
|
@@ -235,7 +235,7 @@ function hebrewStripNikkud(str) {
|
|
|
235
235
|
return a.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
/*! @hebcal/hdate v0.22.
|
|
238
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
239
239
|
/*
|
|
240
240
|
* More minimal HDate
|
|
241
241
|
*/
|
|
@@ -743,7 +743,7 @@ function monthFromName(monthName) {
|
|
|
743
743
|
throw new RangeError(`bad monthName: ${monthName}`);
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
/*! @hebcal/hdate v0.22.
|
|
746
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
747
747
|
const NISAN$4 = months.NISAN;
|
|
748
748
|
const CHESHVAN$1 = months.CHESHVAN;
|
|
749
749
|
const KISLEV$1 = months.KISLEV;
|
|
@@ -964,7 +964,7 @@ function getBirthdayHD(hyear, date) {
|
|
|
964
964
|
return { yy: hyear, mm: month, dd: day };
|
|
965
965
|
}
|
|
966
966
|
|
|
967
|
-
/*! @hebcal/hdate v0.22.
|
|
967
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
968
968
|
const GERESH = '׳';
|
|
969
969
|
const GERSHAYIM = '״';
|
|
970
970
|
const heb2num = {
|
|
@@ -1083,7 +1083,7 @@ function gematriyaStrToNum(str) {
|
|
|
1083
1083
|
return num;
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
-
/*! @hebcal/hdate v0.22.
|
|
1086
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1087
1087
|
/**
|
|
1088
1088
|
* Formats a number with leading zeros so the resulting string is 4 digits long.
|
|
1089
1089
|
* Similar to `string.padStart(4, '0')` but will also format
|
|
@@ -1123,7 +1123,7 @@ function pad2(num) {
|
|
|
1123
1123
|
return String(num);
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
/*! @hebcal/hdate v0.22.
|
|
1126
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1127
1127
|
const _formatters = new Map();
|
|
1128
1128
|
/**
|
|
1129
1129
|
* @private
|
|
@@ -1204,13 +1204,13 @@ function isoDateString(dt) {
|
|
|
1204
1204
|
pad2(dt.getDate()));
|
|
1205
1205
|
}
|
|
1206
1206
|
|
|
1207
|
-
/*! @hebcal/hdate v0.22.
|
|
1207
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1208
1208
|
var poAshkenazi$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "und-x-ashkenaz" }, "contexts": { "": { "Tevet": ["Teves"] } } };
|
|
1209
1209
|
|
|
1210
|
-
/*! @hebcal/hdate v0.22.
|
|
1210
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1211
1211
|
var poHe$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he" }, "contexts": { "": { "Adar": ["אֲדָר"], "Adar I": ["אֲדָר א׳"], "Adar II": ["אֲדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָּיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tammuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
|
|
1212
1212
|
|
|
1213
|
-
/*! @hebcal/hdate v0.22.
|
|
1213
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1214
1214
|
const noopLocale = {
|
|
1215
1215
|
headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
|
|
1216
1216
|
contexts: { '': {} },
|
|
@@ -1494,7 +1494,7 @@ Locale.addLocale('he', poHe$1);
|
|
|
1494
1494
|
const poHeNoNikud$1 = Locale.copyLocaleNoNikud(poHe$1);
|
|
1495
1495
|
Locale.addLocale('he-x-NoNikud', poHeNoNikud$1);
|
|
1496
1496
|
|
|
1497
|
-
/*! @hebcal/hdate v0.22.
|
|
1497
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
1498
1498
|
/*
|
|
1499
1499
|
Hebcal - A Jewish Calendar Generator
|
|
1500
1500
|
Copyright (c) 1994-2020 Danny Sadinoff
|
|
@@ -2163,7 +2163,10 @@ class HDate {
|
|
|
2163
2163
|
* HDate.dayOnOrBefore(6, 733359 + 6); // 733361 (Saturday 15 November 2008)
|
|
2164
2164
|
*/
|
|
2165
2165
|
static dayOnOrBefore(dayOfWeek, absdate) {
|
|
2166
|
-
|
|
2166
|
+
// Use a floored modulo: R.D. numbers are negative before the common
|
|
2167
|
+
// era, and JavaScript's `%` truncates toward zero, which would return
|
|
2168
|
+
// a day *after* absdate for those negative inputs.
|
|
2169
|
+
return absdate - mod(absdate - dayOfWeek, 7);
|
|
2167
2170
|
}
|
|
2168
2171
|
/**
|
|
2169
2172
|
* Tests if the object is an instance of `HDate`
|
|
@@ -2326,7 +2329,7 @@ function onOrBefore(day, t, offset) {
|
|
|
2326
2329
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
2327
2330
|
}
|
|
2328
2331
|
|
|
2329
|
-
/*! @hebcal/hdate v0.22.
|
|
2332
|
+
/*! @hebcal/hdate v0.22.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2330
2333
|
/**
|
|
2331
2334
|
* Calculates yahrzeit, the anniversary of a death, and returns it as an
|
|
2332
2335
|
* {@link HDate}.
|
|
@@ -2484,6 +2487,13 @@ const flags = {
|
|
|
2484
2487
|
/** BeHaB fast days on Monday, Thursday and Monday after Pesach and Sukkot */
|
|
2485
2488
|
BEHAB: 0x10000000,
|
|
2486
2489
|
};
|
|
2490
|
+
const flagEntries = Object.entries(flags);
|
|
2491
|
+
function flagBit(name) {
|
|
2492
|
+
if (!Object.hasOwn(flags, name)) {
|
|
2493
|
+
throw new RangeError(`Unknown flag name: ${String(name)}`);
|
|
2494
|
+
}
|
|
2495
|
+
return flags[name];
|
|
2496
|
+
}
|
|
2487
2497
|
const flagToCategory = [
|
|
2488
2498
|
[flags.MAJOR_FAST, 'holiday', 'major', 'fast'],
|
|
2489
2499
|
[flags.CHANUKAH_CANDLES, 'holiday', 'minor'],
|
|
@@ -2564,10 +2574,62 @@ class Event {
|
|
|
2564
2574
|
}
|
|
2565
2575
|
/**
|
|
2566
2576
|
* Bitmask of optional event flags. See {@link flags}
|
|
2577
|
+
* @deprecated Use {@link Event.hasFlag} to test for a flag, or
|
|
2578
|
+
* {@link Event.flagNames} to list them. Code that genuinely needs the
|
|
2579
|
+
* raw bitmask can read {@link Event.mask}.
|
|
2567
2580
|
*/
|
|
2568
2581
|
getFlags() {
|
|
2569
2582
|
return this.mask;
|
|
2570
2583
|
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Does this event have the given flag?
|
|
2586
|
+
*
|
|
2587
|
+
* A readable alternative to testing the bitmask with `&`.
|
|
2588
|
+
* @example
|
|
2589
|
+
* import {Event, HDate, flags} from '@hebcal/core';
|
|
2590
|
+
* const ev = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II',
|
|
2591
|
+
* flags.CHAG | flags.CHUL_ONLY);
|
|
2592
|
+
* ev.hasFlag('CHAG'); // true
|
|
2593
|
+
* ev.hasFlag('CHUL_ONLY'); // true
|
|
2594
|
+
* ev.hasFlag('MINOR_FAST'); // false
|
|
2595
|
+
* @param name flag name, one of the keys of {@link flags}
|
|
2596
|
+
* @throws {RangeError} if `name` is not a key of {@link flags}
|
|
2597
|
+
*/
|
|
2598
|
+
hasFlag(name) {
|
|
2599
|
+
return (this.mask & flagBit(name)) !== 0;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Does this event have at least one of the given flags?
|
|
2603
|
+
*
|
|
2604
|
+
* Returns `false` when called with no arguments.
|
|
2605
|
+
* @example
|
|
2606
|
+
* import {Event, HDate, flags} from '@hebcal/core';
|
|
2607
|
+
* const ev = new Event(new HDate(10, 'Tishrei', 5784), 'Yom Kippur',
|
|
2608
|
+
* flags.CHAG | flags.MAJOR_FAST);
|
|
2609
|
+
* ev.hasAnyFlag('MAJOR_FAST', 'MINOR_FAST'); // true
|
|
2610
|
+
* ev.hasAnyFlag('ROSH_CHODESH', 'MINOR_FAST'); // false
|
|
2611
|
+
* @param names flag names, each one of the keys of {@link flags}
|
|
2612
|
+
* @throws {RangeError} if any name is not a key of {@link flags}
|
|
2613
|
+
*/
|
|
2614
|
+
hasAnyFlag(...names) {
|
|
2615
|
+
let bits = 0;
|
|
2616
|
+
for (const name of names) {
|
|
2617
|
+
bits |= flagBit(name);
|
|
2618
|
+
}
|
|
2619
|
+
return (this.mask & bits) !== 0;
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Names of all {@link flags} set on this event, in ascending bit order.
|
|
2623
|
+
* Returns an empty array for an event with no flags.
|
|
2624
|
+
* @example
|
|
2625
|
+
* import {Event, HDate, flags} from '@hebcal/core';
|
|
2626
|
+
* const ev = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II',
|
|
2627
|
+
* flags.CHAG | flags.CHUL_ONLY);
|
|
2628
|
+
* ev.flagNames(); // ['CHAG', 'CHUL_ONLY']
|
|
2629
|
+
*/
|
|
2630
|
+
flagNames() {
|
|
2631
|
+
return flagEntries.filter(([, bit]) => this.mask & bit).map(([name]) => name);
|
|
2632
|
+
}
|
|
2571
2633
|
/**
|
|
2572
2634
|
* Returns (translated) description of this event
|
|
2573
2635
|
* @example
|
|
@@ -2642,7 +2704,7 @@ class Event {
|
|
|
2642
2704
|
* ev2.observedInIsrael(); // true
|
|
2643
2705
|
*/
|
|
2644
2706
|
observedInIsrael() {
|
|
2645
|
-
return !
|
|
2707
|
+
return !this.hasFlag('CHUL_ONLY');
|
|
2646
2708
|
}
|
|
2647
2709
|
/**
|
|
2648
2710
|
* Is this event observed in the Diaspora?
|
|
@@ -2653,7 +2715,7 @@ class Event {
|
|
|
2653
2715
|
* ev2.observedInDiaspora(); // true
|
|
2654
2716
|
*/
|
|
2655
2717
|
observedInDiaspora() {
|
|
2656
|
-
return !
|
|
2718
|
+
return !this.hasFlag('IL_ONLY');
|
|
2657
2719
|
}
|
|
2658
2720
|
/**
|
|
2659
2721
|
* Is this event observed in Israel/Diaspora?
|
|
@@ -2684,7 +2746,7 @@ class Event {
|
|
|
2684
2746
|
* .getCategories(); // ['roshchodesh']
|
|
2685
2747
|
*/
|
|
2686
2748
|
getCategories() {
|
|
2687
|
-
const mask = this.
|
|
2749
|
+
const mask = this.mask;
|
|
2688
2750
|
for (const attrs of flagToCategory) {
|
|
2689
2751
|
const attr0 = attrs[0];
|
|
2690
2752
|
if (mask & attr0) {
|
|
@@ -2826,6 +2888,259 @@ function requireObjectLike(arg) {
|
|
|
2826
2888
|
return arg;
|
|
2827
2889
|
}
|
|
2828
2890
|
|
|
2891
|
+
function normalizeOptionsOrString(options, optionName) {
|
|
2892
|
+
return "string" == typeof options ? ((optionName, optionVal) => {
|
|
2893
|
+
const res = Object.create(null);
|
|
2894
|
+
return res[optionName] = optionVal, res;
|
|
2895
|
+
})(optionName, options) : requireObjectLike(options);
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
const smallestUnitStr = "smallestUnit";
|
|
2899
|
+
|
|
2900
|
+
const overflowMap = {
|
|
2901
|
+
constrain: 0,
|
|
2902
|
+
reject: 1
|
|
2903
|
+
};
|
|
2904
|
+
|
|
2905
|
+
const epochDisambigMap = {
|
|
2906
|
+
compatible: 0,
|
|
2907
|
+
reject: 1,
|
|
2908
|
+
earlier: 2,
|
|
2909
|
+
later: 3
|
|
2910
|
+
};
|
|
2911
|
+
|
|
2912
|
+
const offsetDisambigMap = {
|
|
2913
|
+
reject: 0,
|
|
2914
|
+
use: 1,
|
|
2915
|
+
prefer: 2,
|
|
2916
|
+
ignore: 3
|
|
2917
|
+
};
|
|
2918
|
+
|
|
2919
|
+
const calendarDisplayMap = {
|
|
2920
|
+
auto: 0,
|
|
2921
|
+
never: 1,
|
|
2922
|
+
critical: 2,
|
|
2923
|
+
always: 3
|
|
2924
|
+
};
|
|
2925
|
+
|
|
2926
|
+
const timeZoneDisplayMap = {
|
|
2927
|
+
auto: 0,
|
|
2928
|
+
never: 1,
|
|
2929
|
+
critical: 2
|
|
2930
|
+
};
|
|
2931
|
+
|
|
2932
|
+
const offsetDisplayMap = {
|
|
2933
|
+
auto: 0,
|
|
2934
|
+
never: 1
|
|
2935
|
+
};
|
|
2936
|
+
|
|
2937
|
+
const roundingModeMap = {
|
|
2938
|
+
floor: 0,
|
|
2939
|
+
halfFloor: 1,
|
|
2940
|
+
ceil: 2,
|
|
2941
|
+
halfCeil: 3,
|
|
2942
|
+
trunc: 4,
|
|
2943
|
+
halfTrunc: 5,
|
|
2944
|
+
expand: 6,
|
|
2945
|
+
halfExpand: 7,
|
|
2946
|
+
halfEven: 8
|
|
2947
|
+
};
|
|
2948
|
+
|
|
2949
|
+
const roundingModeFuncs = [ Math.floor, roundHalfFloor, Math.ceil, roundHalfCeil, Math.trunc, roundHalfTrunc, roundExpand, roundHalfExpand, roundHalfEven ];
|
|
2950
|
+
|
|
2951
|
+
const directionMap = {
|
|
2952
|
+
previous: -1,
|
|
2953
|
+
next: 1
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
function coerceRoundingIncInteger(options) {
|
|
2957
|
+
const roundingInc = options.roundingIncrement;
|
|
2958
|
+
return void 0 === roundingInc ? 1 : toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
function coerceFractionalSecondDigits(options) {
|
|
2962
|
+
let subsecDigits = options.fractionalSecondDigits;
|
|
2963
|
+
if (void 0 !== subsecDigits) {
|
|
2964
|
+
if ("number" != typeof subsecDigits) {
|
|
2965
|
+
if ("auto" === toString(subsecDigits)) {
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
throwRangeError(invalidEntity("fractionalSecondDigits", subsecDigits));
|
|
2969
|
+
}
|
|
2970
|
+
subsecDigits = clampEntity("fractionalSecondDigits", Math.floor(subsecDigits), 0, 9, 1);
|
|
2971
|
+
}
|
|
2972
|
+
return subsecDigits;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
function coerceUnitOption(optionName, options, minUnit = 0, ensureDefined) {
|
|
2976
|
+
let unitStr = options[optionName];
|
|
2977
|
+
if (void 0 === unitStr) {
|
|
2978
|
+
return ensureDefined ? minUnit : void 0;
|
|
2979
|
+
}
|
|
2980
|
+
if (unitStr = toString(unitStr), "auto" === unitStr) {
|
|
2981
|
+
return ensureDefined ? minUnit : null;
|
|
2982
|
+
}
|
|
2983
|
+
let unit = unitNameMap[unitStr];
|
|
2984
|
+
return void 0 === unit && (unit = durationFieldNamesAsc.indexOf(unitStr)), unit < 0 && throwRangeError(invalidChoice(optionName, unitStr, unitNameMap)),
|
|
2985
|
+
unit;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
2989
|
+
const enumArg = options[optionName];
|
|
2990
|
+
if (void 0 === enumArg) {
|
|
2991
|
+
return defaultChoice;
|
|
2992
|
+
}
|
|
2993
|
+
const enumStr = toString(enumArg);
|
|
2994
|
+
const enumNum = enumNameMap[enumStr];
|
|
2995
|
+
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)),
|
|
2996
|
+
enumNum;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
const coerceSmallestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, smallestUnitStr);
|
|
3000
|
+
|
|
3001
|
+
const coerceLargestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "largestUnit");
|
|
3002
|
+
|
|
3003
|
+
const coerceTotalUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "unit");
|
|
3004
|
+
|
|
3005
|
+
const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
3006
|
+
|
|
3007
|
+
const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
|
|
3008
|
+
|
|
3009
|
+
const coerceOffsetDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
|
|
3010
|
+
|
|
3011
|
+
const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
3012
|
+
|
|
3013
|
+
const coerceTimeZoneDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
|
|
3014
|
+
|
|
3015
|
+
const coerceOffsetDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
|
|
3016
|
+
|
|
3017
|
+
const coerceRoundingMode = /*@__PURE__*/ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
|
|
3018
|
+
|
|
3019
|
+
const coerceDirection = /*@__PURE__*/ bindArgs(coerceChoiceOption, "direction", directionMap);
|
|
3020
|
+
|
|
3021
|
+
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
3022
|
+
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
3023
|
+
if (upUnitNano) {
|
|
3024
|
+
const unitNano = unitNanoMap[smallestUnit];
|
|
3025
|
+
upUnitNano % ((roundingInc = clampEntity("roundingIncrement", roundingInc, 1, upUnitNano / unitNano - (solarMode ? 0 : 1), 1)) * unitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3026
|
+
} else {
|
|
3027
|
+
roundingInc = clampEntity("roundingIncrement", roundingInc, 1, allowManyLargeUnits ? 10 ** 9 : 1, 1);
|
|
3028
|
+
}
|
|
3029
|
+
return roundingInc;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
function validateUnitRange(optionName, unit, minUnit, maxUnit) {
|
|
3033
|
+
return null != unit && clampEntity(optionName, unit, minUnit, maxUnit, 1, unitNamesAsc),
|
|
3034
|
+
unit;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
function checkLargestSmallestUnit(largestUnit, smallestUnit) {
|
|
3038
|
+
smallestUnit > largestUnit && throwRangeError(flippedSmallestLargestUnit);
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
function refineDiffOptions(roundingModeInvert, options, defaultLargestUnit, maxUnit = 9, minUnit = 0, defaultRoundingMode = 4) {
|
|
3042
|
+
options = normalizeOptions(options);
|
|
3043
|
+
let largestUnit = coerceLargestUnit(options, minUnit);
|
|
3044
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
3045
|
+
let roundingMode = coerceRoundingMode(options, defaultRoundingMode);
|
|
3046
|
+
let smallestUnit = coerceSmallestUnit(options, minUnit, 1);
|
|
3047
|
+
return largestUnit = validateUnitRange("largestUnit", largestUnit, minUnit, maxUnit),
|
|
3048
|
+
smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, minUnit, maxUnit),
|
|
3049
|
+
null == largestUnit ? largestUnit = Math.max(defaultLargestUnit, smallestUnit) : checkLargestSmallestUnit(largestUnit, smallestUnit),
|
|
3050
|
+
roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingModeInvert && (roundingMode = (roundingMode => roundingMode < 4 ? (roundingMode + 2) % 4 : roundingMode)(roundingMode)),
|
|
3051
|
+
[ largestUnit, smallestUnit, roundingInc, roundingMode ];
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
function refineDurationRoundOptions(options, defaultLargestUnit, refineRelativeTo) {
|
|
3055
|
+
options = normalizeOptionsOrString(options, smallestUnitStr);
|
|
3056
|
+
let largestUnit = coerceLargestUnit(options);
|
|
3057
|
+
const relativeToInternals = refineRelativeTo(options.relativeTo);
|
|
3058
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
3059
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
3060
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
3061
|
+
return void 0 === largestUnit && void 0 === smallestUnit && throwRangeError(missingSmallestLargestUnit),
|
|
3062
|
+
null == smallestUnit && (smallestUnit = 0), null == largestUnit && (largestUnit = Math.max(smallestUnit, defaultLargestUnit)),
|
|
3063
|
+
checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1),
|
|
3064
|
+
roundingInc > 1 && smallestUnit > 5 && largestUnit !== smallestUnit && throwRangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit"),
|
|
3065
|
+
[ largestUnit, smallestUnit, roundingInc, roundingMode, relativeToInternals ];
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
function refineRoundingOptions(options, maxUnit = 6, solarMode) {
|
|
3069
|
+
let roundingInc = coerceRoundingIncInteger(options = normalizeOptionsOrString(options, smallestUnitStr));
|
|
3070
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
3071
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
3072
|
+
return smallestUnit = requirePropDefined(smallestUnitStr, smallestUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, 0, maxUnit),
|
|
3073
|
+
roundingInc = validateRoundingInc(roundingInc, smallestUnit, void 0, solarMode),
|
|
3074
|
+
[ smallestUnit, roundingInc, roundingMode ];
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
function refineTotalOptions(options, refineRelativeTo) {
|
|
3078
|
+
const relativeToInternals = refineRelativeTo((options = normalizeOptionsOrString(options, "unit")).relativeTo);
|
|
3079
|
+
let totalUnit = coerceTotalUnit(options);
|
|
3080
|
+
return totalUnit = requirePropDefined("unit", totalUnit), [ totalUnit, relativeToInternals ];
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
function refineOverflowOptions(options) {
|
|
3084
|
+
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
|
|
3088
|
+
options = normalizeOptions(options);
|
|
3089
|
+
const epochDisambig = coerceEpochDisambig(options);
|
|
3090
|
+
const offsetDisambig = coerceOffsetDisambig(options, defaultOffsetDisambig);
|
|
3091
|
+
return [ coerceOverflow(options), offsetDisambig, epochDisambig ];
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
function refineEpochDisambigOptions(options) {
|
|
3095
|
+
return coerceEpochDisambig(normalizeOptions(options));
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
3099
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
3100
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
3101
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
3102
|
+
return [ roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, maxSmallestUnit), subsecDigits) ];
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
function refineDateTimeDisplayOptions(options) {
|
|
3106
|
+
return options = normalizeOptions(options), [ coerceCalendarDisplay(options), ...refineTimeDisplayTuple(options) ];
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
function refineDateDisplayOptions(options) {
|
|
3110
|
+
return coerceCalendarDisplay(normalizeOptions(options));
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
function refineTimeDisplayOptions(options, maxSmallestUnit) {
|
|
3114
|
+
return refineTimeDisplayTuple(normalizeOptions(options), maxSmallestUnit);
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
function refineZonedDateTimeDisplayOptions(options) {
|
|
3118
|
+
options = normalizeOptions(options);
|
|
3119
|
+
const calendarDisplay = coerceCalendarDisplay(options);
|
|
3120
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
3121
|
+
const offsetDisplay = coerceOffsetDisplay(options);
|
|
3122
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
3123
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
3124
|
+
return [ calendarDisplay, coerceTimeZoneDisplay(options), offsetDisplay, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
function refineInstantDisplayOptions(options) {
|
|
3128
|
+
const subsecDigits = coerceFractionalSecondDigits(options = normalizeOptions(options));
|
|
3129
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
3130
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
3131
|
+
return [ options.timeZone, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
function resolveSmallestUnitAndSubsecDigits(smallestUnit, subsecDigits) {
|
|
3135
|
+
return null != smallestUnit ? [ unitNanoMap[smallestUnit], smallestUnit < 4 ? 9 - 3 * smallestUnit : -1 ] : [ void 0 === subsecDigits ? 1 : 10 ** (9 - subsecDigits), subsecDigits ];
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
function refineDirectionOptions(options) {
|
|
3139
|
+
const normalizedOptions = normalizeOptionsOrString(options, "direction");
|
|
3140
|
+
const res = coerceDirection(normalizedOptions, 0);
|
|
3141
|
+
return res || throwRangeError(invalidEntity("direction", res)), res;
|
|
3142
|
+
}
|
|
3143
|
+
|
|
2829
3144
|
const invalidEntity = invalidEntity$1;
|
|
2830
3145
|
|
|
2831
3146
|
const missingField = fieldName => `Missing ${fieldName}`;
|
|
@@ -2852,6 +3167,10 @@ const invalidTimeZone = calendarId => invalidEntity$1("TimeZone", calendarId);
|
|
|
2852
3167
|
|
|
2853
3168
|
const outOfBoundsDate = "Out-of-bounds date";
|
|
2854
3169
|
|
|
3170
|
+
const missingSmallestLargestUnit = "Required smallestUnit or largestUnit";
|
|
3171
|
+
|
|
3172
|
+
const flippedSmallestLargestUnit = "smallestUnit > largestUnit";
|
|
3173
|
+
|
|
2855
3174
|
const failedParse = s => `Cannot parse: ${s}`;
|
|
2856
3175
|
|
|
2857
3176
|
const invalidSubstring = substring => `Invalid substring: ${substring}`;
|
|
@@ -3037,21 +3356,45 @@ function modTrunc(num, divisor) {
|
|
|
3037
3356
|
return num % divisor || 0;
|
|
3038
3357
|
}
|
|
3039
3358
|
|
|
3359
|
+
function roundExpand(num) {
|
|
3360
|
+
return num < 0 ? Math.floor(num) : Math.ceil(num);
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3040
3363
|
function fabricateNearHalfFraction(halfCompare, sign = 1) {
|
|
3041
3364
|
return sign * (.5 + halfCompare / 5);
|
|
3042
3365
|
}
|
|
3043
3366
|
|
|
3044
|
-
function
|
|
3045
|
-
return .
|
|
3367
|
+
function roundHalfExpand(num) {
|
|
3368
|
+
return Math.sign(num) * Math.round(Math.abs(num)) || 0;
|
|
3046
3369
|
}
|
|
3047
3370
|
|
|
3048
|
-
|
|
3371
|
+
function roundHalfFloor(num) {
|
|
3372
|
+
return hasHalf(num) ? Math.floor(num) : Math.round(num);
|
|
3373
|
+
}
|
|
3049
3374
|
|
|
3050
|
-
|
|
3375
|
+
function roundHalfCeil(num) {
|
|
3376
|
+
return hasHalf(num) ? Math.ceil(num) : Math.round(num);
|
|
3377
|
+
}
|
|
3051
3378
|
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3379
|
+
function roundHalfTrunc(num) {
|
|
3380
|
+
return hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num);
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
function roundHalfEven(num) {
|
|
3384
|
+
return hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num);
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
function hasHalf(num) {
|
|
3388
|
+
return .5 === Math.abs(num % 1);
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
const isoCalendarId = "iso8601";
|
|
3392
|
+
|
|
3393
|
+
const gregoryCalendarId = "gregory";
|
|
3394
|
+
|
|
3395
|
+
const gregoryEraOrigins = {
|
|
3396
|
+
"bce": -1,
|
|
3397
|
+
"ce": 0
|
|
3055
3398
|
};
|
|
3056
3399
|
|
|
3057
3400
|
function normalizeEraName(era) {
|
|
@@ -3252,6 +3595,10 @@ function epochNanoToSecMod(epochNano) {
|
|
|
3252
3595
|
return [ Number(epochSec), Number(nano) ];
|
|
3253
3596
|
}
|
|
3254
3597
|
|
|
3598
|
+
function epochNanoToMilli(epochNano) {
|
|
3599
|
+
return Number(divFloorBigInt(epochNano, bigNanoInMilli));
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3255
3602
|
function isoDateTimeToEpochNano(isoDateTime) {
|
|
3256
3603
|
return isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime));
|
|
3257
3604
|
}
|
|
@@ -3269,10 +3616,10 @@ function isoDateToEpochMilli(isoDate) {
|
|
|
3269
3616
|
}
|
|
3270
3617
|
|
|
3271
3618
|
function isoDateToEpochDays(isoDate) {
|
|
3272
|
-
return
|
|
3619
|
+
return isoPartsToEpochDays(isoDate.year, isoDate.month, isoDate.day);
|
|
3273
3620
|
}
|
|
3274
3621
|
|
|
3275
|
-
function
|
|
3622
|
+
function isoPartsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) {
|
|
3276
3623
|
const monthIndex = isoMonth - 1;
|
|
3277
3624
|
return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12),
|
|
3278
3625
|
Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay;
|
|
@@ -3352,23 +3699,23 @@ function diffIsoMonthSlots(year0, month0, year1, month1) {
|
|
|
3352
3699
|
return 12 * (year1 - year0) + month1 - month0;
|
|
3353
3700
|
}
|
|
3354
3701
|
|
|
3355
|
-
function computeIsoDayOfWeek(
|
|
3356
|
-
return modFloor(
|
|
3702
|
+
function computeIsoDayOfWeek(isoDate) {
|
|
3703
|
+
return modFloor(isoPartsToEpochDays(isoDate.year, isoDate.month, isoDate.day) + 4, 7) || 7;
|
|
3357
3704
|
}
|
|
3358
3705
|
|
|
3359
|
-
function computeIsoDayOfYear(
|
|
3360
|
-
return
|
|
3706
|
+
function computeIsoDayOfYear(isoDate) {
|
|
3707
|
+
return isoPartsToEpochDays(isoDate.year, isoDate.month, isoDate.day) - isoPartsToEpochDays(isoDate.year) + 1;
|
|
3361
3708
|
}
|
|
3362
3709
|
|
|
3363
|
-
function computeIsoWeekFields(
|
|
3364
|
-
let yearOfWeek =
|
|
3365
|
-
let weekOfYear = Math.floor((computeIsoDayOfYear(
|
|
3710
|
+
function computeIsoWeekFields(isoDate) {
|
|
3711
|
+
let yearOfWeek = isoDate.year;
|
|
3712
|
+
let weekOfYear = Math.floor((computeIsoDayOfYear(isoDate) - computeIsoDayOfWeek(isoDate) + 10) / 7);
|
|
3366
3713
|
let weeksInYear = computeIsoWeeksInYear(yearOfWeek);
|
|
3367
3714
|
return weekOfYear < 1 ? weekOfYear = weeksInYear = computeIsoWeeksInYear(--yearOfWeek) : weekOfYear > weeksInYear && (weekOfYear = 1,
|
|
3368
3715
|
weeksInYear = computeIsoWeeksInYear(++yearOfWeek)), {
|
|
3369
3716
|
weekOfYear: weekOfYear,
|
|
3370
3717
|
yearOfWeek: yearOfWeek,
|
|
3371
|
-
|
|
3718
|
+
De: weeksInYear
|
|
3372
3719
|
};
|
|
3373
3720
|
}
|
|
3374
3721
|
|
|
@@ -3414,11 +3761,11 @@ function constrainIsoDateFields(isoDate, overflow) {
|
|
|
3414
3761
|
}
|
|
3415
3762
|
|
|
3416
3763
|
function computeCalendarDateFields(calendar, isoDate) {
|
|
3417
|
-
return calendar ? calendar.
|
|
3764
|
+
return calendar ? calendar.de(isoDate) : isoDate;
|
|
3418
3765
|
}
|
|
3419
3766
|
|
|
3420
3767
|
function computeCalendarMonthCodeParts(calendar, year, month) {
|
|
3421
|
-
return calendar ? calendar.
|
|
3768
|
+
return calendar ? calendar.N(year, month) : computeIsoMonthCodeParts(month);
|
|
3422
3769
|
}
|
|
3423
3770
|
|
|
3424
3771
|
function computeCalendarEraFields(calendar, isoDate) {
|
|
@@ -3426,7 +3773,7 @@ function computeCalendarEraFields(calendar, isoDate) {
|
|
|
3426
3773
|
}
|
|
3427
3774
|
|
|
3428
3775
|
function computeCalendarIsoFieldsFromParts(calendar, year, month, day) {
|
|
3429
|
-
return calendar ? calendar.
|
|
3776
|
+
return calendar ? calendar.fe(year, month, day) : computeIsoFieldsFromParts(year, month, day);
|
|
3430
3777
|
}
|
|
3431
3778
|
|
|
3432
3779
|
function computeCalendarMonthsInYearForYear(calendar, year) {
|
|
@@ -3519,8 +3866,17 @@ function toString(arg) {
|
|
|
3519
3866
|
String(arg);
|
|
3520
3867
|
}
|
|
3521
3868
|
|
|
3522
|
-
function
|
|
3523
|
-
|
|
3869
|
+
function toPrimitiveWithStringHint(arg) {
|
|
3870
|
+
if (!isObjectLike$1(arg)) {
|
|
3871
|
+
return arg;
|
|
3872
|
+
}
|
|
3873
|
+
const exoticToPrimitive = arg[Symbol.toPrimitive];
|
|
3874
|
+
if (null != exoticToPrimitive) {
|
|
3875
|
+
"function" != typeof exoticToPrimitive && throwTypeError();
|
|
3876
|
+
const primitive = Reflect.apply(exoticToPrimitive, arg, [ "string" ]);
|
|
3877
|
+
return isObjectLike$1(primitive) && throwTypeError(), primitive;
|
|
3878
|
+
}
|
|
3879
|
+
return Date.prototype[Symbol.toPrimitive].call(arg, "string");
|
|
3524
3880
|
}
|
|
3525
3881
|
|
|
3526
3882
|
function toBigInt(bi) {
|
|
@@ -3532,193 +3888,10 @@ function toStrictInteger(arg, entityName) {
|
|
|
3532
3888
|
return requireNumberIsInteger(toFiniteNumber(arg, entityName), entityName);
|
|
3533
3889
|
}
|
|
3534
3890
|
|
|
3535
|
-
function normalizeOptionsOrString(options, optionName) {
|
|
3536
|
-
return "string" == typeof options ? ((optionName, optionVal) => {
|
|
3537
|
-
const res = Object.create(null);
|
|
3538
|
-
return res[optionName] = optionVal, res;
|
|
3539
|
-
})(optionName, options) : requireObjectLike(options);
|
|
3540
|
-
}
|
|
3541
|
-
|
|
3542
|
-
const smallestUnitStr = "smallestUnit";
|
|
3543
|
-
|
|
3544
|
-
const overflowMap = {
|
|
3545
|
-
constrain: 0,
|
|
3546
|
-
reject: 1
|
|
3547
|
-
};
|
|
3548
|
-
|
|
3549
|
-
const epochDisambigMap = {
|
|
3550
|
-
compatible: 0,
|
|
3551
|
-
reject: 1,
|
|
3552
|
-
earlier: 2,
|
|
3553
|
-
later: 3
|
|
3554
|
-
};
|
|
3555
|
-
|
|
3556
|
-
const offsetDisambigMap = {
|
|
3557
|
-
reject: 0,
|
|
3558
|
-
use: 1,
|
|
3559
|
-
prefer: 2,
|
|
3560
|
-
ignore: 3
|
|
3561
|
-
};
|
|
3562
|
-
|
|
3563
|
-
const calendarDisplayMap = {
|
|
3564
|
-
auto: 0,
|
|
3565
|
-
never: 1,
|
|
3566
|
-
critical: 2,
|
|
3567
|
-
always: 3
|
|
3568
|
-
};
|
|
3569
|
-
|
|
3570
|
-
const timeZoneDisplayMap = {
|
|
3571
|
-
auto: 0,
|
|
3572
|
-
never: 1,
|
|
3573
|
-
critical: 2
|
|
3574
|
-
};
|
|
3575
|
-
|
|
3576
|
-
const offsetDisplayMap = {
|
|
3577
|
-
auto: 0,
|
|
3578
|
-
never: 1
|
|
3579
|
-
};
|
|
3580
|
-
|
|
3581
|
-
const roundingModeMap = {
|
|
3582
|
-
floor: 0,
|
|
3583
|
-
halfFloor: 1,
|
|
3584
|
-
ceil: 2,
|
|
3585
|
-
halfCeil: 3,
|
|
3586
|
-
trunc: 4,
|
|
3587
|
-
halfTrunc: 5,
|
|
3588
|
-
expand: 6,
|
|
3589
|
-
halfExpand: 7,
|
|
3590
|
-
halfEven: 8
|
|
3591
|
-
};
|
|
3592
|
-
|
|
3593
|
-
const roundingModeFuncs = [ Math.floor, num => hasHalf(num) ? Math.floor(num) : Math.round(num), Math.ceil, num => hasHalf(num) ? Math.ceil(num) : Math.round(num), Math.trunc, num => hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num), num => num < 0 ? Math.floor(num) : Math.ceil(num), num => Math.sign(num) * Math.round(Math.abs(num)) || 0, num => hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num) ];
|
|
3594
|
-
|
|
3595
|
-
const directionMap = {
|
|
3596
|
-
previous: -1,
|
|
3597
|
-
next: 1
|
|
3598
|
-
};
|
|
3599
|
-
|
|
3600
|
-
function coerceRoundingIncInteger(options) {
|
|
3601
|
-
const roundingInc = options.roundingIncrement;
|
|
3602
|
-
return void 0 === roundingInc ? 1 : toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
|
-
function coerceFractionalSecondDigits(options) {
|
|
3606
|
-
let subsecDigits = options.fractionalSecondDigits;
|
|
3607
|
-
if (void 0 !== subsecDigits) {
|
|
3608
|
-
if ("number" != typeof subsecDigits) {
|
|
3609
|
-
if ("auto" === toString(subsecDigits)) {
|
|
3610
|
-
return;
|
|
3611
|
-
}
|
|
3612
|
-
throwRangeError(invalidEntity("fractionalSecondDigits", subsecDigits));
|
|
3613
|
-
}
|
|
3614
|
-
subsecDigits = clampEntity("fractionalSecondDigits", Math.floor(subsecDigits), 0, 9, 1);
|
|
3615
|
-
}
|
|
3616
|
-
return subsecDigits;
|
|
3617
|
-
}
|
|
3618
|
-
|
|
3619
|
-
function coerceUnitOption(optionName, options, minUnit = 0, ensureDefined) {
|
|
3620
|
-
let unitStr = options[optionName];
|
|
3621
|
-
if (void 0 === unitStr) {
|
|
3622
|
-
return ensureDefined ? minUnit : void 0;
|
|
3623
|
-
}
|
|
3624
|
-
if (unitStr = toString(unitStr), "auto" === unitStr) {
|
|
3625
|
-
return ensureDefined ? minUnit : null;
|
|
3626
|
-
}
|
|
3627
|
-
let unit = unitNameMap[unitStr];
|
|
3628
|
-
return void 0 === unit && (unit = durationFieldNamesAsc.indexOf(unitStr)), unit < 0 && throwRangeError(invalidChoice(optionName, unitStr, unitNameMap)),
|
|
3629
|
-
unit;
|
|
3630
|
-
}
|
|
3631
|
-
|
|
3632
|
-
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
3633
|
-
const enumArg = options[optionName];
|
|
3634
|
-
if (void 0 === enumArg) {
|
|
3635
|
-
return defaultChoice;
|
|
3636
|
-
}
|
|
3637
|
-
const enumStr = toString(enumArg);
|
|
3638
|
-
const enumNum = enumNameMap[enumStr];
|
|
3639
|
-
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)),
|
|
3640
|
-
enumNum;
|
|
3641
|
-
}
|
|
3642
|
-
|
|
3643
|
-
const coerceSmallestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, smallestUnitStr);
|
|
3644
|
-
|
|
3645
|
-
const coerceLargestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "largestUnit");
|
|
3646
|
-
|
|
3647
|
-
const coerceTotalUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "unit");
|
|
3648
|
-
|
|
3649
|
-
const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
3650
|
-
|
|
3651
|
-
const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
|
|
3652
|
-
|
|
3653
|
-
const coerceOffsetDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
|
|
3654
|
-
|
|
3655
|
-
const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
3656
|
-
|
|
3657
|
-
const coerceTimeZoneDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
|
|
3658
|
-
|
|
3659
|
-
const coerceOffsetDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
|
|
3660
|
-
|
|
3661
|
-
const coerceRoundingMode = /*@__PURE__*/ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
|
|
3662
|
-
|
|
3663
|
-
const coerceDirection = /*@__PURE__*/ bindArgs(coerceChoiceOption, "direction", directionMap);
|
|
3664
|
-
|
|
3665
|
-
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
3666
|
-
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
3667
|
-
if (upUnitNano) {
|
|
3668
|
-
const unitNano = unitNanoMap[smallestUnit];
|
|
3669
|
-
upUnitNano % ((roundingInc = clampEntity("roundingIncrement", roundingInc, 1, upUnitNano / unitNano - (solarMode ? 0 : 1), 1)) * unitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3670
|
-
} else {
|
|
3671
|
-
roundingInc = clampEntity("roundingIncrement", roundingInc, 1, allowManyLargeUnits ? 10 ** 9 : 1, 1);
|
|
3672
|
-
}
|
|
3673
|
-
return roundingInc;
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
function validateUnitRange(optionName, unit, minUnit, maxUnit) {
|
|
3677
|
-
return null != unit && clampEntity(optionName, unit, minUnit, maxUnit, 1, unitNamesAsc),
|
|
3678
|
-
unit;
|
|
3679
|
-
}
|
|
3680
|
-
|
|
3681
|
-
function checkLargestSmallestUnit(largestUnit, smallestUnit) {
|
|
3682
|
-
smallestUnit > largestUnit && throwRangeError("smallestUnit > largestUnit");
|
|
3683
|
-
}
|
|
3684
|
-
|
|
3685
|
-
function refineDiffOptions(roundingModeInvert, options, defaultLargestUnit, maxUnit = 9, minUnit = 0, defaultRoundingMode = 4) {
|
|
3686
|
-
options = normalizeOptions(options);
|
|
3687
|
-
let largestUnit = coerceLargestUnit(options, minUnit);
|
|
3688
|
-
let roundingInc = coerceRoundingIncInteger(options);
|
|
3689
|
-
let roundingMode = coerceRoundingMode(options, defaultRoundingMode);
|
|
3690
|
-
let smallestUnit = coerceSmallestUnit(options, minUnit, 1);
|
|
3691
|
-
return largestUnit = validateUnitRange("largestUnit", largestUnit, minUnit, maxUnit),
|
|
3692
|
-
smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, minUnit, maxUnit),
|
|
3693
|
-
null == largestUnit ? largestUnit = Math.max(defaultLargestUnit, smallestUnit) : checkLargestSmallestUnit(largestUnit, smallestUnit),
|
|
3694
|
-
roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingModeInvert && (roundingMode = (roundingMode => roundingMode < 4 ? (roundingMode + 2) % 4 : roundingMode)(roundingMode)),
|
|
3695
|
-
[ largestUnit, smallestUnit, roundingInc, roundingMode ];
|
|
3696
|
-
}
|
|
3697
|
-
|
|
3698
|
-
function refineRoundingOptions(options, maxUnit = 6, solarMode) {
|
|
3699
|
-
let roundingInc = coerceRoundingIncInteger(options = normalizeOptionsOrString(options, smallestUnitStr));
|
|
3700
|
-
const roundingMode = coerceRoundingMode(options, 7);
|
|
3701
|
-
let smallestUnit = coerceSmallestUnit(options);
|
|
3702
|
-
return smallestUnit = requirePropDefined(smallestUnitStr, smallestUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, 0, maxUnit),
|
|
3703
|
-
roundingInc = validateRoundingInc(roundingInc, smallestUnit, void 0, solarMode),
|
|
3704
|
-
[ smallestUnit, roundingInc, roundingMode ];
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
3891
|
function combineDateAndTime(isoDate, time) {
|
|
3708
3892
|
return pluckProps(calendarDateFieldNamesAsc, isoDate, pluckProps(timeFieldNamesAsc, time));
|
|
3709
3893
|
}
|
|
3710
3894
|
|
|
3711
|
-
function refineOverflowOptions(options) {
|
|
3712
|
-
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
3713
|
-
}
|
|
3714
|
-
|
|
3715
|
-
function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
|
|
3716
|
-
options = normalizeOptions(options);
|
|
3717
|
-
const epochDisambig = coerceEpochDisambig(options);
|
|
3718
|
-
const offsetDisambig = coerceOffsetDisambig(options, defaultOffsetDisambig);
|
|
3719
|
-
return [ coerceOverflow(options), offsetDisambig, epochDisambig ];
|
|
3720
|
-
}
|
|
3721
|
-
|
|
3722
3895
|
const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay;
|
|
3723
3896
|
|
|
3724
3897
|
const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
|
|
@@ -3734,18 +3907,18 @@ function checkIsoYearMonthInBounds(isoDate) {
|
|
|
3734
3907
|
}
|
|
3735
3908
|
|
|
3736
3909
|
function checkIsoDateInBounds(isoDate, allowPlainDateLowerEdge = 1) {
|
|
3737
|
-
|
|
3910
|
+
const epochNano = isoDateToEpochNano(isoDate);
|
|
3911
|
+
return (epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError(outOfBoundsDate),
|
|
3738
3912
|
isoDate;
|
|
3739
3913
|
}
|
|
3740
3914
|
|
|
3741
3915
|
function checkIsoDateTimeInBounds(isoDateTime) {
|
|
3742
|
-
|
|
3743
|
-
return checkIsoDateEpochNanoInBounds(epochNano), epochNano !== plainDateEpochNanoMin || timeFieldsToNano(isoDateTime) || throwRangeError(outOfBoundsDate),
|
|
3744
|
-
isoDateTime;
|
|
3916
|
+
return checkIsoDateTimeEpochNanoInBounds(isoDateTimeToEpochNano(isoDateTime)), isoDateTime;
|
|
3745
3917
|
}
|
|
3746
3918
|
|
|
3747
|
-
function
|
|
3748
|
-
(epochNano
|
|
3919
|
+
function checkIsoDateTimeEpochNanoInBounds(epochNano) {
|
|
3920
|
+
return (epochNano <= plainDateEpochNanoMin || epochNano >= epochNanoMax + bigNanoInUtcDay) && throwRangeError(outOfBoundsDate),
|
|
3921
|
+
epochNano;
|
|
3749
3922
|
}
|
|
3750
3923
|
|
|
3751
3924
|
function checkEpochNanoInBounds(epochNano) {
|
|
@@ -3757,108 +3930,41 @@ function isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano) {
|
|
|
3757
3930
|
return checkEpochNanoInBounds(isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime) - offsetNano));
|
|
3758
3931
|
}
|
|
3759
3932
|
|
|
3760
|
-
function
|
|
3761
|
-
return
|
|
3762
|
-
epochNanoseconds: epochNano
|
|
3763
|
-
};
|
|
3764
|
-
}
|
|
3765
|
-
|
|
3766
|
-
function createZonedEpochNanoSlots(epochNano, timeZone, calendar) {
|
|
3767
|
-
return {
|
|
3768
|
-
calendar: calendar,
|
|
3769
|
-
timeZone: timeZone,
|
|
3770
|
-
epochNanoseconds: epochNano
|
|
3771
|
-
};
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3774
|
-
function createDateTimeSlots(isoDateTime, calendar) {
|
|
3775
|
-
return pluckProps(timeFieldNamesAsc, isoDateTime, createDateSlots(isoDateTime, calendar));
|
|
3776
|
-
}
|
|
3777
|
-
|
|
3778
|
-
function createDateSlots(isoDate, calendar) {
|
|
3779
|
-
return pluckProps(calendarDateFieldNamesAsc, isoDate, {
|
|
3780
|
-
calendar: calendar
|
|
3781
|
-
});
|
|
3782
|
-
}
|
|
3783
|
-
|
|
3784
|
-
function createTimeSlots(time) {
|
|
3785
|
-
return pluckProps(timeFieldNamesAsc, time);
|
|
3786
|
-
}
|
|
3787
|
-
|
|
3788
|
-
function createDurationSlots(durationFields) {
|
|
3789
|
-
return pluckProps(durationFieldNamesAsc, durationFields, {
|
|
3790
|
-
sign: computeDurationSign(durationFields)
|
|
3791
|
-
});
|
|
3792
|
-
}
|
|
3793
|
-
|
|
3794
|
-
function getEpochMilli(slots) {
|
|
3795
|
-
return epochNano = slots.epochNanoseconds, Number(divFloorBigInt(epochNano, bigNanoInMilli));
|
|
3796
|
-
var epochNano;
|
|
3933
|
+
function roundNumberToInc(num, roundingInc, roundingMode) {
|
|
3934
|
+
return roundWithMode(num / roundingInc, roundingMode) * roundingInc;
|
|
3797
3935
|
}
|
|
3798
3936
|
|
|
3799
|
-
function
|
|
3800
|
-
return
|
|
3937
|
+
function roundWithMode(num, roundingMode) {
|
|
3938
|
+
return roundingModeFuncs[roundingMode](num);
|
|
3801
3939
|
}
|
|
3802
3940
|
|
|
3803
|
-
function
|
|
3804
|
-
const
|
|
3805
|
-
|
|
3806
|
-
const relativeToInternals = refineRelativeTo((options = normalizeOptionsOrString(options, "unit")).relativeTo);
|
|
3807
|
-
let totalUnit = coerceTotalUnit(options);
|
|
3808
|
-
return totalUnit = requirePropDefined("unit", totalUnit), [ totalUnit, relativeToInternals ];
|
|
3809
|
-
})(options, refineRelativeTo);
|
|
3810
|
-
const maxUnit = Math.max(totalUnit, maxDurationUnit);
|
|
3811
|
-
const isZoned = relativeToSlots && isZonedEpochSlots(relativeToSlots);
|
|
3812
|
-
if (!relativeToSlots && isUniformUnit(maxUnit, isZoned)) {
|
|
3813
|
-
return totalDayTimeDuration(slots, totalUnit);
|
|
3814
|
-
}
|
|
3815
|
-
if (relativeToSlots || throwRangeError("Missing relativeTo"), !slots.sign && isUniformUnit(totalUnit, isZoned)) {
|
|
3816
|
-
return 0;
|
|
3817
|
-
}
|
|
3818
|
-
const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, totalUnit);
|
|
3819
|
-
return isUniformUnit(totalUnit, isZoned) ? totalDayTimeDuration(balancedDuration, totalUnit) : totalRelativeDuration(balancedDuration, endEpochNano, totalUnit, relativeOps);
|
|
3941
|
+
function totalRelativeUnit(wholeValue, sign, endEpochNano, moveValueToEpochNano) {
|
|
3942
|
+
const unitWindow = clampRelativeUnitValue(wholeValue, sign, moveValueToEpochNano, endEpochNano);
|
|
3943
|
+
return interpolateRelativeUnitWindow(unitWindow, Number(endEpochNano - unitWindow.I) / Number(unitWindow.O - unitWindow.I));
|
|
3820
3944
|
}
|
|
3821
3945
|
|
|
3822
|
-
function
|
|
3823
|
-
|
|
3824
|
-
const nudgeWindow = clampRelativeDuration(clearDurationFields(totalUnit, durationFields), totalUnit, sign, relativeOps, endEpochNano);
|
|
3825
|
-
const epochNano0 = nudgeWindow.ee;
|
|
3826
|
-
const epochNano1 = nudgeWindow.te;
|
|
3827
|
-
const denom = Number(epochNano1 - epochNano0);
|
|
3828
|
-
const numerator = Number(endEpochNano - epochNano0);
|
|
3829
|
-
return nudgeWindow.pe[durationFieldNamesAsc[totalUnit]] + numerator / denom * sign;
|
|
3946
|
+
function roundRelativeUnitWindow(unitWindow, endEpochNano, roundingInc, roundingMode) {
|
|
3947
|
+
return roundNumberToInc(interpolateRelativeUnitWindow(unitWindow, computeEpochNanoFrac(endEpochNano, unitWindow.I, unitWindow.O)), roundingInc, roundingMode);
|
|
3830
3948
|
}
|
|
3831
3949
|
|
|
3832
|
-
function
|
|
3833
|
-
|
|
3950
|
+
function clampRelativeUnitValue(startValue, valueDelta, moveValueToEpochNano, epochNanoProgress) {
|
|
3951
|
+
let unitWindow = computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano);
|
|
3952
|
+
return ((epochNanoProgress, epochNano0, epochNano1, sign) => sign > 0 ? epochNano0 <= epochNanoProgress && epochNanoProgress <= epochNano1 : epochNano1 <= epochNanoProgress && epochNanoProgress <= epochNano0)(epochNanoProgress, unitWindow.I, unitWindow.O, Math.sign(valueDelta)) || (unitWindow = computeRelativeUnitWindow(startValue + valueDelta, valueDelta, moveValueToEpochNano)),
|
|
3953
|
+
unitWindow;
|
|
3834
3954
|
}
|
|
3835
3955
|
|
|
3836
|
-
function
|
|
3837
|
-
const
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
[unitName]: durationFields[unitName] + clampDistance
|
|
3844
|
-
}, shifted = 1, window = computeRelativeDurationWindow(startDurationFields, unitName, clampDistance, relativeOps)),
|
|
3845
|
-
{
|
|
3846
|
-
...window,
|
|
3847
|
-
pe: startDurationFields,
|
|
3848
|
-
Ae: shifted
|
|
3956
|
+
function computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano) {
|
|
3957
|
+
const endValue = startValue + valueDelta;
|
|
3958
|
+
return {
|
|
3959
|
+
ve: startValue,
|
|
3960
|
+
qe: endValue,
|
|
3961
|
+
I: moveValueToEpochNano(startValue),
|
|
3962
|
+
O: moveValueToEpochNano(endValue)
|
|
3849
3963
|
};
|
|
3850
3964
|
}
|
|
3851
3965
|
|
|
3852
|
-
function
|
|
3853
|
-
|
|
3854
|
-
...startDurationFields,
|
|
3855
|
-
[unitName]: startDurationFields[unitName] + clampDistance
|
|
3856
|
-
};
|
|
3857
|
-
return {
|
|
3858
|
-
ee: moveRelativeToEpochNano(relativeOps, startDurationFields),
|
|
3859
|
-
te: moveRelativeToEpochNano(relativeOps, endDurationFields),
|
|
3860
|
-
se: endDurationFields
|
|
3861
|
-
};
|
|
3966
|
+
function interpolateRelativeUnitWindow(unitWindow, fraction) {
|
|
3967
|
+
return unitWindow.ve + fraction * (unitWindow.qe - unitWindow.ve);
|
|
3862
3968
|
}
|
|
3863
3969
|
|
|
3864
3970
|
function computeEpochNanoFrac(epochNanoProgress, epochNano0, epochNano1) {
|
|
@@ -3873,76 +3979,52 @@ function computeEpochNanoFrac(epochNanoProgress, epochNano0, epochNano1) {
|
|
|
3873
3979
|
return compareBigInts(absNumerator, absDenom) <= 0 ? absNumerator === absDenom ? fracSign : fabricateNearHalfFraction(compareBigInts(2n * absNumerator, absDenom), fracSign) : Number(numeratorBig) / Number(denomBig);
|
|
3874
3980
|
}
|
|
3875
3981
|
|
|
3876
|
-
function
|
|
3877
|
-
let {epochNanoseconds: epochNanoseconds} = slots;
|
|
3878
|
-
const {timeZone: timeZone, calendar: calendar} = slots;
|
|
3879
|
-
if (0 === smallestUnit && 1 === roundingInc) {
|
|
3880
|
-
return {
|
|
3881
|
-
epochNanoseconds: epochNanoseconds,
|
|
3882
|
-
timeZone: timeZone,
|
|
3883
|
-
calendar: calendar
|
|
3884
|
-
};
|
|
3885
|
-
}
|
|
3886
|
-
if (6 === smallestUnit) {
|
|
3887
|
-
const isoFields0 = combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults);
|
|
3888
|
-
const isoFields1 = combineDateAndTime(moveByDays(isoFields0, 1), timeFieldDefaults);
|
|
3889
|
-
const epochNano0 = getStartOfDayInstantFor(timeZone, isoFields0);
|
|
3890
|
-
const epochNano1 = getStartOfDayInstantFor(timeZone, isoFields1);
|
|
3891
|
-
epochNanoseconds = roundWithMode(computeZonedDayRoundFrac(epochNanoseconds, epochNano0, epochNano1), roundingMode) ? epochNano1 : epochNano0;
|
|
3892
|
-
} else {
|
|
3893
|
-
const isoDateTime = zonedEpochSlotsToIso(slots);
|
|
3894
|
-
const offsetNano = isoDateTime.offsetNanoseconds;
|
|
3895
|
-
epochNanoseconds = getMatchingInstantFor(timeZone, roundDateTimeToNano(isoDateTime, computeNanoInc(smallestUnit, roundingInc), roundingMode), offsetNano, 2, 0, 1);
|
|
3896
|
-
}
|
|
3982
|
+
function createEpochNanoSlots(epochNano) {
|
|
3897
3983
|
return {
|
|
3898
|
-
epochNanoseconds:
|
|
3899
|
-
timeZone: timeZone,
|
|
3900
|
-
calendar: calendar
|
|
3984
|
+
epochNanoseconds: epochNano
|
|
3901
3985
|
};
|
|
3902
3986
|
}
|
|
3903
3987
|
|
|
3904
|
-
function
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
}
|
|
3911
|
-
|
|
3912
|
-
function computeZonedStartOfDay(slots) {
|
|
3913
|
-
const {timeZone: timeZone, calendar: calendar} = slots;
|
|
3914
|
-
return createZonedEpochNanoSlots(getStartOfDayInstantFor(timeZone, combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults)), timeZone, calendar);
|
|
3988
|
+
function createZonedEpochNanoSlots(epochNano, timeZone, calendar) {
|
|
3989
|
+
return {
|
|
3990
|
+
calendar: calendar,
|
|
3991
|
+
timeZone: timeZone,
|
|
3992
|
+
epochNanoseconds: epochNano
|
|
3993
|
+
};
|
|
3915
3994
|
}
|
|
3916
3995
|
|
|
3917
|
-
function
|
|
3918
|
-
return
|
|
3996
|
+
function createDateTimeSlots(isoDateTime, calendar) {
|
|
3997
|
+
return pluckProps(timeFieldNamesAsc, isoDateTime, createDateSlots(isoDateTime, calendar));
|
|
3919
3998
|
}
|
|
3920
3999
|
|
|
3921
|
-
function
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
4000
|
+
function createDateSlots(isoDate, calendar) {
|
|
4001
|
+
return pluckProps(calendarDateFieldNamesAsc, isoDate, {
|
|
4002
|
+
calendar: calendar
|
|
4003
|
+
});
|
|
3925
4004
|
}
|
|
3926
4005
|
|
|
3927
|
-
function
|
|
3928
|
-
return
|
|
4006
|
+
function createTimeSlots(time) {
|
|
4007
|
+
return pluckProps(timeFieldNamesAsc, time);
|
|
3929
4008
|
}
|
|
3930
4009
|
|
|
3931
|
-
function
|
|
3932
|
-
return
|
|
4010
|
+
function createDurationSlots(durationFields) {
|
|
4011
|
+
return pluckProps(durationFieldNamesAsc, durationFields, {
|
|
4012
|
+
sign: computeDurationSign(durationFields)
|
|
4013
|
+
});
|
|
3933
4014
|
}
|
|
3934
4015
|
|
|
3935
|
-
function
|
|
3936
|
-
return
|
|
4016
|
+
function roundZonedEpochSlotsToUnit(slots, smallestUnit, roundingInc, roundingMode) {
|
|
4017
|
+
return createZonedEpochNanoSlots(6 === smallestUnit ? roundZonedEpochToDay(slots, roundingMode) : roundZonedEpochToTime(slots, smallestUnit, roundingInc, roundingMode), slots.timeZone, slots.calendar);
|
|
3937
4018
|
}
|
|
3938
4019
|
|
|
3939
|
-
function
|
|
3940
|
-
|
|
4020
|
+
function computeZonedHoursInDay(slots) {
|
|
4021
|
+
const [epochNano0, epochNano1] = computeZonedDayEpochInterval(slots);
|
|
4022
|
+
return divideBigNanoToExactNumber(epochNano1 - epochNano0, nanoInHour);
|
|
3941
4023
|
}
|
|
3942
4024
|
|
|
3943
|
-
function
|
|
3944
|
-
const
|
|
3945
|
-
return
|
|
4025
|
+
function computeZonedStartOfDay(slots) {
|
|
4026
|
+
const {timeZone: timeZone, calendar: calendar} = slots;
|
|
4027
|
+
return createZonedEpochNanoSlots(getStartOfDayInstantFor(timeZone, combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults)), timeZone, calendar);
|
|
3946
4028
|
}
|
|
3947
4029
|
|
|
3948
4030
|
function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps, isZoned) {
|
|
@@ -3959,7 +4041,7 @@ function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smalle
|
|
|
3959
4041
|
}
|
|
3960
4042
|
const baseDurationFields = clearDurationFields(currentUnit, durationFields);
|
|
3961
4043
|
baseDurationFields[durationFieldNamesAsc[currentUnit]] += sign;
|
|
3962
|
-
const thresholdCompare = compareBigInts(endEpochNano,
|
|
4044
|
+
const thresholdCompare = compareBigInts(endEpochNano, moveRelativeMarkerToEpochNano(relativeOps, baseDurationFields));
|
|
3963
4045
|
if (thresholdCompare && thresholdCompare !== sign) {
|
|
3964
4046
|
break;
|
|
3965
4047
|
}
|
|
@@ -3970,55 +4052,60 @@ function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smalle
|
|
|
3970
4052
|
roundedDurationFields;
|
|
3971
4053
|
}
|
|
3972
4054
|
|
|
3973
|
-
function
|
|
3974
|
-
|
|
4055
|
+
function roundDayTimeDurationByInc(durationFields, nanoInc, roundingMode) {
|
|
4056
|
+
const maxUnit = Math.min(getMaxDurationUnit(durationFields), 6);
|
|
4057
|
+
return nanoToDurationDayTimeFields(roundBigNanoToInc(durationDayTimeToBigNano(durationFields), BigInt(nanoInc), roundingMode), maxUnit);
|
|
3975
4058
|
}
|
|
3976
4059
|
|
|
3977
|
-
function
|
|
3978
|
-
const [
|
|
3979
|
-
|
|
3980
|
-
return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode, (dayOriginNano / bigNanoInc + timeNano / bigNanoInc) % 2n);
|
|
4060
|
+
function roundZonedEpochToDay(slots, roundingMode) {
|
|
4061
|
+
const [epochNano0, epochNano1] = computeZonedDayEpochInterval(slots);
|
|
4062
|
+
return roundZonedEpochToBounds(slots.epochNanoseconds, epochNano0, epochNano1, roundingMode);
|
|
3981
4063
|
}
|
|
3982
4064
|
|
|
3983
|
-
function
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
return (quotient - quotientTail + BigInt(roundedTail)) * bigNanoInc;
|
|
4065
|
+
function roundZonedEpochToTime(slots, smallestUnit, roundingInc, roundingMode) {
|
|
4066
|
+
if (0 === smallestUnit && 1 === roundingInc) {
|
|
4067
|
+
return slots.epochNanoseconds;
|
|
4068
|
+
}
|
|
4069
|
+
const isoDateTime = zonedEpochSlotsToIso(slots);
|
|
4070
|
+
return getMatchingInstantFor(slots.timeZone, roundDateTimeToInc(isoDateTime, computeNanoInc(smallestUnit, roundingInc), roundingMode), isoDateTime.offsetNanoseconds, 2, 0, 1);
|
|
3990
4071
|
}
|
|
3991
4072
|
|
|
3992
|
-
function
|
|
3993
|
-
|
|
4073
|
+
function roundDateTimeToInc(isoDateTime, nanoInc, roundingMode) {
|
|
4074
|
+
const [roundedTimeFields, dayDelta] = roundTimeToInc(isoDateTime, nanoInc, roundingMode);
|
|
4075
|
+
const roundedIsoDateTime = combineDateAndTime(moveDateByDays(isoDateTime, dayDelta), roundedTimeFields);
|
|
4076
|
+
return checkIsoDateTimeInBounds(roundedIsoDateTime), roundedIsoDateTime;
|
|
3994
4077
|
}
|
|
3995
4078
|
|
|
3996
|
-
function
|
|
3997
|
-
return
|
|
4079
|
+
function roundTimeToInc(timeFields, nanoInc, roundingMode) {
|
|
4080
|
+
return nanoToTimeAndDay(roundNumberToInc(timeFieldsToNano(timeFields), nanoInc, roundingMode));
|
|
3998
4081
|
}
|
|
3999
4082
|
|
|
4000
|
-
function
|
|
4001
|
-
const
|
|
4002
|
-
const
|
|
4003
|
-
|
|
4004
|
-
const expandedBigUnit = Math.sign(Number(roundedBigNano / bigNanoInUtcDay) - Number(bigNano / bigNanoInUtcDay)) === sign;
|
|
4005
|
-
const roundedDayTimeFields = nanoToDurationDayTimeFields(roundedBigNano, Math.min(largestUnit, 6));
|
|
4006
|
-
return [ {
|
|
4083
|
+
function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps) {
|
|
4084
|
+
const smallestUnitFieldName = durationFieldNamesAsc[smallestUnit];
|
|
4085
|
+
const baseDurationFields = clearDurationFields(smallestUnit, durationFields);
|
|
4086
|
+
7 === smallestUnit && (durationFields = {
|
|
4007
4087
|
...durationFields,
|
|
4008
|
-
|
|
4009
|
-
}
|
|
4088
|
+
weeks: durationFields.weeks + Math.trunc(durationFields.days / 7)
|
|
4089
|
+
});
|
|
4090
|
+
const truncedVal = divTrunc(durationFields[smallestUnitFieldName], roundingInc) * roundingInc;
|
|
4091
|
+
const nudgeWindow = clampRelativeUnitValue(truncedVal, roundingInc * sign, value => (baseDurationFields[smallestUnitFieldName] = value,
|
|
4092
|
+
moveRelativeMarkerToEpochNano(relativeOps, baseDurationFields)), endEpochNano);
|
|
4093
|
+
const roundedVal = roundRelativeUnitWindow(nudgeWindow, endEpochNano, roundingInc, roundingMode);
|
|
4094
|
+
return baseDurationFields[smallestUnitFieldName] = roundedVal, [ baseDurationFields, roundedVal === nudgeWindow.qe ? nudgeWindow.O : nudgeWindow.I, roundedVal !== truncedVal ];
|
|
4010
4095
|
}
|
|
4011
4096
|
|
|
4012
4097
|
function nudgeZonedTimeDuration(sign, durationFields, endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps) {
|
|
4013
4098
|
const timeNano = Number(durationTimeToBigNano(durationFields));
|
|
4014
4099
|
const nanoInc = computeNanoInc(smallestUnit, roundingInc);
|
|
4015
4100
|
let roundedTimeNano = roundNumberToInc(timeNano, nanoInc, roundingMode);
|
|
4016
|
-
const
|
|
4101
|
+
const dateDurationFields = {
|
|
4017
4102
|
...durationFields,
|
|
4018
4103
|
...durationTimeFieldDefaults
|
|
4019
|
-
}
|
|
4020
|
-
const
|
|
4021
|
-
|
|
4104
|
+
};
|
|
4105
|
+
const dayWindow = clampRelativeUnitValue(dateDurationFields.days, sign, days => (dateDurationFields.days = days,
|
|
4106
|
+
moveRelativeMarkerToEpochNano(relativeOps, dateDurationFields)), endEpochNano);
|
|
4107
|
+
const dayEpochNano0 = dayWindow.I;
|
|
4108
|
+
const dayEpochNano1 = dayWindow.O;
|
|
4022
4109
|
const beyondDayNano = roundedTimeNano - Number(dayEpochNano1 - dayEpochNano0);
|
|
4023
4110
|
let dayDelta = 0;
|
|
4024
4111
|
beyondDayNano && Math.sign(beyondDayNano) !== sign ? endEpochNano = dayEpochNano0 + BigInt(roundedTimeNano) : (dayDelta += sign,
|
|
@@ -4031,32 +4118,58 @@ function nudgeZonedTimeDuration(sign, durationFields, endEpochNano, _largestUnit
|
|
|
4031
4118
|
}, endEpochNano, Boolean(dayDelta) ];
|
|
4032
4119
|
}
|
|
4033
4120
|
|
|
4034
|
-
function
|
|
4035
|
-
const
|
|
4036
|
-
const
|
|
4037
|
-
|
|
4121
|
+
function nudgeDayTimeDuration(sign, durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4122
|
+
const bigNano = durationDayTimeToBigNano(durationFields);
|
|
4123
|
+
const roundedBigNano = roundBigNanoToInc(bigNano, computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
4124
|
+
const nanoDiff = roundedBigNano - bigNano;
|
|
4125
|
+
const expandedBigUnit = Math.sign(Number(roundedBigNano / bigNanoInUtcDay) - Number(bigNano / bigNanoInUtcDay)) === sign;
|
|
4126
|
+
const roundedDayTimeFields = nanoToDurationDayTimeFields(roundedBigNano, Math.min(largestUnit, 6));
|
|
4127
|
+
return [ {
|
|
4038
4128
|
...durationFields,
|
|
4039
|
-
|
|
4040
|
-
}
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
const
|
|
4045
|
-
const
|
|
4046
|
-
const
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
return
|
|
4052
|
-
}
|
|
4053
|
-
|
|
4054
|
-
function
|
|
4055
|
-
return
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4129
|
+
...roundedDayTimeFields
|
|
4130
|
+
}, endEpochNano + nanoDiff, expandedBigUnit ];
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
function computeZonedDayEpochInterval(slots) {
|
|
4134
|
+
const {timeZone: timeZone} = slots;
|
|
4135
|
+
const isoDateTime0 = combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults);
|
|
4136
|
+
const isoDateTime1 = combineDateAndTime(moveDateByDays(isoDateTime0, 1), timeFieldDefaults);
|
|
4137
|
+
return [ getStartOfDayInstantFor(timeZone, isoDateTime0), getStartOfDayInstantFor(timeZone, isoDateTime1) ];
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
function roundZonedEpochToBounds(epochNano, epochNano0, epochNano1, roundingMode) {
|
|
4141
|
+
return roundWithMode(computeEpochNanoFrac(epochNano < epochNano1 ? epochNano : epochNano1 - 1n, epochNano0, epochNano1), roundingMode) ? epochNano1 : epochNano0;
|
|
4142
|
+
}
|
|
4143
|
+
|
|
4144
|
+
function roundToMinute(offsetNano) {
|
|
4145
|
+
return roundNumberToInc(offsetNano, nanoInMinute, 7);
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
function roundBigNanoToInc(bigNano, bigNanoInc, roundingMode) {
|
|
4149
|
+
return roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, bigNano / bigNanoInc % 2n);
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
function roundBigNanoToDayOriginInc(bigNano, bigNanoInc, roundingMode) {
|
|
4153
|
+
const [day, timeNano] = divModFloorBigInt(bigNano, bigNanoInUtcDay);
|
|
4154
|
+
const dayOriginNano = day * bigNanoInUtcDay;
|
|
4155
|
+
return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode, (dayOriginNano / bigNanoInc + timeNano / bigNanoInc) % 2n);
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
function roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, quotientTail) {
|
|
4159
|
+
const quotient = bigNano / bigNanoInc;
|
|
4160
|
+
const remainder = bigNano % bigNanoInc;
|
|
4161
|
+
let fraction = 0;
|
|
4162
|
+
remainder && (fraction = fabricateNearHalfFraction(compareBigInts(2n * (remainder < 0n ? -remainder : remainder), bigNanoInc), Math.sign(Number(remainder))));
|
|
4163
|
+
const roundedTail = roundWithMode(Number(quotientTail) + fraction, roundingMode);
|
|
4164
|
+
return (quotient - quotientTail + BigInt(roundedTail)) * bigNanoInc;
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4167
|
+
function computeNanoInc(smallestUnit, roundingInc) {
|
|
4168
|
+
return unitNanoMap[smallestUnit] * roundingInc;
|
|
4169
|
+
}
|
|
4170
|
+
|
|
4171
|
+
function computeBigNanoInc(smallestUnit, roundingInc) {
|
|
4172
|
+
return BigInt(unitNanoMap[smallestUnit]) * BigInt(roundingInc);
|
|
4060
4173
|
}
|
|
4061
4174
|
|
|
4062
4175
|
const zonedEpochSlotsToIso = /*@__PURE__*/ memoize(_zonedEpochSlotsToIso, WeakMap);
|
|
@@ -4075,7 +4188,7 @@ function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig
|
|
|
4075
4188
|
return isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano);
|
|
4076
4189
|
}
|
|
4077
4190
|
2 !== offsetDisambig && 0 !== offsetDisambig || checkIsoDateInBounds(isoDateTime, 0);
|
|
4078
|
-
const possibleEpochNanos = timeZone.
|
|
4191
|
+
const possibleEpochNanos = timeZone.R(isoDateTime);
|
|
4079
4192
|
if (void 0 !== offsetNano && 3 !== offsetDisambig) {
|
|
4080
4193
|
const matchingEpochNano = ((possibleEpochNanos, isoDateTime, offsetNano, fuzzy) => {
|
|
4081
4194
|
const zonedEpochNano = isoDateTimeToEpochNano(isoDateTime);
|
|
@@ -4095,7 +4208,7 @@ function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig
|
|
|
4095
4208
|
return hasZ ? isoDateTimeToEpochNano(isoDateTime) : getSingleInstantFor(timeZone, isoDateTime, epochDisambig, possibleEpochNanos);
|
|
4096
4209
|
}
|
|
4097
4210
|
|
|
4098
|
-
function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.
|
|
4211
|
+
function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.R(isoDateTime)) {
|
|
4099
4212
|
if (1 === possibleEpochNanos.length) {
|
|
4100
4213
|
return possibleEpochNanos[0];
|
|
4101
4214
|
}
|
|
@@ -4109,32 +4222,25 @@ function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochN
|
|
|
4109
4222
|
gapNano))(timeZone.B(zonedEpochNano + bigNanoInUtcDay) - startOffsetNano);
|
|
4110
4223
|
})(timeZone, zonedEpochNano);
|
|
4111
4224
|
const shiftedIsoDateTime = epochNanoToIsoDateTime(zonedEpochNano + BigInt(gapNano * (2 === disambig ? -1 : 1)));
|
|
4112
|
-
return (possibleEpochNanos = timeZone.
|
|
4225
|
+
return (possibleEpochNanos = timeZone.R(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1];
|
|
4113
4226
|
}
|
|
4114
4227
|
|
|
4115
4228
|
function getStartOfDayInstantFor(timeZone, isoDateTime) {
|
|
4116
|
-
const possibleEpochNanos = timeZone.
|
|
4229
|
+
const possibleEpochNanos = timeZone.R(isoDateTime);
|
|
4117
4230
|
if (possibleEpochNanos.length) {
|
|
4118
4231
|
return possibleEpochNanos[0];
|
|
4119
4232
|
}
|
|
4120
4233
|
const zonedEpochNanoDayBefore = isoDateTimeToEpochNano(isoDateTime) - bigNanoInUtcDay;
|
|
4121
|
-
return timeZone.
|
|
4234
|
+
return timeZone.C(zonedEpochNanoDayBefore, 1);
|
|
4122
4235
|
}
|
|
4123
4236
|
|
|
4124
|
-
function moveYearMonth(
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
return moveToStartOfMonth(calendar, dateAddWithOverflow(calendar, startOfMonthFields, doSubtract ? negateDurationFields(durationSlots) : durationSlots, overflow));
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
|
-
function moveEpochNano(epochNano, durationFields) {
|
|
4132
|
-
return checkEpochNanoInBounds(epochNano + (durationHasDateParts(fields = durationFields) && throwRangeError("Cannot use large units"),
|
|
4133
|
-
durationTimeToBigNano(fields)));
|
|
4134
|
-
var fields;
|
|
4237
|
+
function moveYearMonth(calendar, isoDate, durationSlots, overflow = 0) {
|
|
4238
|
+
computeDurationSign(durationSlots) && getMaxDurationUnit(durationSlots) < 8 && throwRangeError("Cannot use small units");
|
|
4239
|
+
const first = checkIsoDateInBounds(moveToStartOfMonth(calendar, isoDate));
|
|
4240
|
+
return moveToStartOfMonth(calendar, moveDate(calendar, first, durationSlots, overflow));
|
|
4135
4241
|
}
|
|
4136
4242
|
|
|
4137
|
-
function moveZonedEpochSlots(slots, durationFields,
|
|
4243
|
+
function moveZonedEpochSlots(slots, durationFields, overflow = 0) {
|
|
4138
4244
|
const {calendar: calendar, epochNanoseconds: epochNano, timeZone: timeZone} = slots;
|
|
4139
4245
|
const timeOnlyNano = durationTimeToBigNano(durationFields);
|
|
4140
4246
|
let movedEpochNano = epochNano;
|
|
@@ -4143,9 +4249,9 @@ function moveZonedEpochSlots(slots, durationFields, options) {
|
|
|
4143
4249
|
movedEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, isoDateTime, {
|
|
4144
4250
|
...durationFields,
|
|
4145
4251
|
...durationTimeFieldDefaults
|
|
4146
|
-
},
|
|
4252
|
+
}, overflow), isoDateTime)) + timeOnlyNano;
|
|
4147
4253
|
} else {
|
|
4148
|
-
movedEpochNano += timeOnlyNano
|
|
4254
|
+
movedEpochNano += timeOnlyNano;
|
|
4149
4255
|
}
|
|
4150
4256
|
return {
|
|
4151
4257
|
...slots,
|
|
@@ -4153,77 +4259,86 @@ function moveZonedEpochSlots(slots, durationFields, options) {
|
|
|
4153
4259
|
};
|
|
4154
4260
|
}
|
|
4155
4261
|
|
|
4156
|
-
function moveDateTime(calendar,
|
|
4157
|
-
const [movedTimeFields, dayDelta] = moveTime(
|
|
4158
|
-
return checkIsoDateTimeInBounds(combineDateAndTime(moveDate(calendar,
|
|
4262
|
+
function moveDateTime(calendar, isoDateTime, durationFields, overflow = 0) {
|
|
4263
|
+
const [movedTimeFields, dayDelta] = moveTime(isoDateTime, durationFields);
|
|
4264
|
+
return checkIsoDateTimeInBounds(combineDateAndTime(moveDate(calendar, isoDateTime, {
|
|
4159
4265
|
...durationFields,
|
|
4160
4266
|
...durationTimeFieldDefaults,
|
|
4161
4267
|
days: durationFields.days + dayDelta
|
|
4162
|
-
},
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
function moveDate(calendar, isoDateFields, durationFields, options) {
|
|
4166
|
-
if (durationFields.years || durationFields.months || durationFields.weeks) {
|
|
4167
|
-
return dateAddWithOverflow(calendar, isoDateFields, durationFields, refineOverflowOptions(options));
|
|
4168
|
-
}
|
|
4169
|
-
refineOverflowOptions(options);
|
|
4170
|
-
const days = durationFields.days + Number(durationTimeToBigNano(durationFields) / bigNanoInUtcDay);
|
|
4171
|
-
return days ? checkIsoDateInBounds(moveByDays(isoDateFields, days)) : isoDateFields;
|
|
4172
|
-
}
|
|
4173
|
-
|
|
4174
|
-
function moveToStartOfMonth(calendar, isoDateFields) {
|
|
4175
|
-
return moveByDays(isoDateFields, 1 - computeCalendarDateFields(calendar, isoDateFields).day);
|
|
4268
|
+
}, overflow), movedTimeFields));
|
|
4176
4269
|
}
|
|
4177
4270
|
|
|
4178
4271
|
function moveTime(timeFields, durationFields) {
|
|
4179
|
-
|
|
4180
|
-
const durDays = Number(durationBigNano / bigNanoInUtcDay);
|
|
4181
|
-
const durTimeNano = Number(durationBigNano % bigNanoInUtcDay);
|
|
4182
|
-
const [newTimeFields, overflowDays] = nanoToTimeAndDay(timeFieldsToNano(timeFields) + durTimeNano);
|
|
4183
|
-
return [ newTimeFields, durDays + overflowDays ];
|
|
4272
|
+
return moveTimeByNano(timeFields, durationTimeToBigNano(durationFields));
|
|
4184
4273
|
}
|
|
4185
4274
|
|
|
4186
|
-
function
|
|
4187
|
-
return
|
|
4275
|
+
function moveEpochNano(epochNano, durationFields) {
|
|
4276
|
+
return moveEpochNanoByNano(epochNano, (durationHasDateParts(fields = durationFields) && throwRangeError("Cannot use large units"),
|
|
4277
|
+
durationTimeToBigNano(fields)));
|
|
4278
|
+
var fields;
|
|
4188
4279
|
}
|
|
4189
4280
|
|
|
4190
|
-
function
|
|
4281
|
+
function moveDate(calendar, isoDate, durationFields, overflow = 0) {
|
|
4191
4282
|
let {years: years, months: months, weeks: weeks, days: days} = durationFields;
|
|
4192
|
-
let
|
|
4283
|
+
let movedIsoDate;
|
|
4193
4284
|
if (days += Number(durationTimeToBigNano(durationFields) / bigNanoInUtcDay), years || months) {
|
|
4194
|
-
|
|
4285
|
+
movedIsoDate = moveDateByCalendarUnits(calendar, isoDate, years, months, overflow);
|
|
4195
4286
|
} else {
|
|
4196
4287
|
if (!weeks && !days) {
|
|
4197
|
-
return
|
|
4288
|
+
return isoDate;
|
|
4198
4289
|
}
|
|
4199
|
-
|
|
4290
|
+
movedIsoDate = isoDate;
|
|
4200
4291
|
}
|
|
4201
|
-
return (weeks || days) && (
|
|
4292
|
+
return (weeks || days) && (movedIsoDate = moveDateByDays(movedIsoDate, 7 * weeks + days)),
|
|
4293
|
+
checkIsoDateInBounds(movedIsoDate);
|
|
4202
4294
|
}
|
|
4203
4295
|
|
|
4204
|
-
function
|
|
4205
|
-
|
|
4296
|
+
function moveToStartOfMonth(calendar, isoDate) {
|
|
4297
|
+
return moveDateByDays(isoDate, 1 - computeCalendarDateFields(calendar, isoDate).day);
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
function moveDateByCalendarUnits(calendar, isoDate, years, months, overflow) {
|
|
4301
|
+
const dateParts = computeCalendarDateFields(calendar, isoDate);
|
|
4206
4302
|
let {year: year, month: month, day: day} = dateParts;
|
|
4207
4303
|
if (years) {
|
|
4208
4304
|
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
4209
|
-
year += years, month =
|
|
4305
|
+
year += years, month = resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth, calendar ? calendar.p(year) : void 0, overflow),
|
|
4210
4306
|
month = clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
4211
4307
|
}
|
|
4212
4308
|
if (months) {
|
|
4213
|
-
const yearMonthParts = calendar
|
|
4309
|
+
const yearMonthParts = addCalendarMonths(calendar, year, month, months);
|
|
4214
4310
|
({year: year, month: month} = yearMonthParts);
|
|
4215
4311
|
}
|
|
4216
4312
|
return day = clampEntity("day", day, 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow),
|
|
4217
4313
|
computeCalendarIsoFieldsFromParts(calendar, year, month, day);
|
|
4218
4314
|
}
|
|
4219
4315
|
|
|
4220
|
-
function
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4316
|
+
function addCalendarMonths(calendar, year, month, monthDelta) {
|
|
4317
|
+
return calendar ? calendar.ae(year, month, monthDelta) : addIsoMonths(year, month, monthDelta);
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
function resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
|
|
4321
|
+
if (isLeapMonth) {
|
|
4322
|
+
const leapMonthMeta = calendar ? calendar.l : void 0;
|
|
4323
|
+
return void 0 !== targetLeapMonth && (leapMonthMeta < 0 || targetLeapMonth === monthCodeNumber + 1) ? targetLeapMonth : (1 === overflow && throwRangeError(invalidLeapMonth),
|
|
4324
|
+
leapMonthMeta < 0 ? -leapMonthMeta : monthCodeNumber);
|
|
4325
|
+
}
|
|
4326
|
+
return monthCodeNumberToMonth(monthCodeNumber, 0, targetLeapMonth);
|
|
4327
|
+
}
|
|
4328
|
+
|
|
4329
|
+
function moveTimeByNano(timeFields, durationBigNano) {
|
|
4330
|
+
const durDays = Number(durationBigNano / bigNanoInUtcDay);
|
|
4331
|
+
const durTimeNano = Number(durationBigNano % bigNanoInUtcDay);
|
|
4332
|
+
const [newTimeFields, overflowDays] = nanoToTimeAndDay(timeFieldsToNano(timeFields) + durTimeNano);
|
|
4333
|
+
return [ newTimeFields, durDays + overflowDays ];
|
|
4334
|
+
}
|
|
4335
|
+
|
|
4336
|
+
function moveEpochNanoByNano(epochNano, deltaNano) {
|
|
4337
|
+
return checkEpochNanoInBounds(epochNano + deltaNano);
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
function moveDateByDays(isoDate, days) {
|
|
4341
|
+
return days ? epochDaysToIsoDate(isoDateToEpochDays(isoDate) + days) : isoDate;
|
|
4227
4342
|
}
|
|
4228
4343
|
|
|
4229
4344
|
function getCommonCalendar(a, b) {
|
|
@@ -4240,98 +4355,94 @@ function getZonedTimeZoneId(slots) {
|
|
|
4240
4355
|
return slots.timeZone.id;
|
|
4241
4356
|
}
|
|
4242
4357
|
|
|
4243
|
-
function
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4358
|
+
function diffZonedDateTimesRounded(calendar, startZoned, endZoned, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4359
|
+
return largestUnit < 6 ? diffEpochNanosRounded(startZoned.epochNanoseconds, endZoned.epochNanoseconds, largestUnit, smallestUnit, roundingInc, roundingMode) : ((calendar, startZoned, endZoned, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
4360
|
+
const endEpochNano = endZoned.epochNanoseconds;
|
|
4361
|
+
if (endEpochNano === startZoned.epochNanoseconds) {
|
|
4362
|
+
return durationFieldDefaults;
|
|
4363
|
+
}
|
|
4364
|
+
let durationFields;
|
|
4365
|
+
const timeZone = getCommonTimeZone(startZoned.timeZone, endZoned.timeZone);
|
|
4366
|
+
return durationFields = diffZonedEpochsExact(timeZone, calendar, startZoned, endZoned, largestUnit),
|
|
4367
|
+
durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createZonedRelativeOps(calendar, timeZone, startZoned), 1),
|
|
4368
|
+
durationFields;
|
|
4369
|
+
})(calendar, startZoned, endZoned, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
4247
4370
|
}
|
|
4248
4371
|
|
|
4249
|
-
function
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
if (largestUnit < 6) {
|
|
4256
|
-
durationFields = diffEpochNanos(epochNano0, epochNano1, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
4257
|
-
} else {
|
|
4258
|
-
const timeZone = getCommonTimeZone(slots0.timeZone, slots1.timeZone);
|
|
4259
|
-
durationFields = diffZonedEpochsExact(timeZone, calendar, slots0, slots1, largestUnit),
|
|
4260
|
-
durationFields = roundRelativeDuration(durationFields, epochNano1, largestUnit, smallestUnit, roundingInc, roundingMode, createZonedRelativeOps(calendar, timeZone, slots0), 1);
|
|
4372
|
+
function diffDateTimesRounded(calendar, startIsoDateTime, endIsoDateTime, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4373
|
+
return largestUnit <= 6 ? diffEpochNanosRounded(isoDateTimeToEpochNano(startIsoDateTime), isoDateTimeToEpochNano(endIsoDateTime), largestUnit, smallestUnit, roundingInc, roundingMode) : ((calendar, startIsoDateTime, endIsoDateTime, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
4374
|
+
const endEpochNano = isoDateTimeToEpochNano(endIsoDateTime);
|
|
4375
|
+
const sign = compareBigInts(endEpochNano, isoDateTimeToEpochNano(startIsoDateTime));
|
|
4376
|
+
if (!sign) {
|
|
4377
|
+
return durationFieldDefaults;
|
|
4261
4378
|
}
|
|
4262
|
-
|
|
4263
|
-
durationFields =
|
|
4264
|
-
|
|
4265
|
-
|
|
4379
|
+
let durationFields;
|
|
4380
|
+
return durationFields = diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit),
|
|
4381
|
+
durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, ((calendar, origin) => ({
|
|
4382
|
+
ne: isoDateTimeToEpochNano(origin),
|
|
4383
|
+
ke: duration => isoDateTimeToEpochNano(combineDateAndTime(moveDate(calendar, origin, duration), origin))
|
|
4384
|
+
}))(calendar, startIsoDateTime)), durationFields;
|
|
4385
|
+
})(calendar, startIsoDateTime, endIsoDateTime, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
4266
4386
|
}
|
|
4267
4387
|
|
|
4268
|
-
function
|
|
4269
|
-
const
|
|
4270
|
-
const
|
|
4271
|
-
|
|
4272
|
-
const sign = compareBigInts(endEpochNano, startEpochNano);
|
|
4273
|
-
let durationFields;
|
|
4274
|
-
return sign ? largestUnit <= 6 ? durationFields = diffEpochNanos(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) : (durationFields = diffDateTimesBig(calendar, plainDateTimeSlots0, plainDateTimeSlots1, sign, largestUnit),
|
|
4275
|
-
durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createDateTimeRelativeOps(calendar, plainDateTimeSlots0))) : durationFields = durationFieldDefaults,
|
|
4276
|
-
createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
4388
|
+
function diffYearMonthsRounded(calendar, startIsoDate, endIsoDate, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4389
|
+
const firstOfMonth0 = moveToStartOfMonth(calendar, startIsoDate);
|
|
4390
|
+
const firstOfMonth1 = moveToStartOfMonth(calendar, endIsoDate);
|
|
4391
|
+
return compareIsoDates(firstOfMonth0, firstOfMonth1) ? diffDateCalendarUnitsRounded(calendar, checkIsoDateInBounds(firstOfMonth0), checkIsoDateInBounds(firstOfMonth1), largestUnit, smallestUnit, roundingInc, roundingMode, 8) : durationFieldDefaults;
|
|
4277
4392
|
}
|
|
4278
4393
|
|
|
4279
|
-
function
|
|
4280
|
-
|
|
4281
|
-
return diffDateLike(invert, calendar, plainDateSlots0, plainDateSlots1, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
4394
|
+
function diffDatesRounded(calendar, startIsoDate, endIsoDate, largestUnit, smallestUnit, roundingInc, roundingMode, smallestPrecision = 6) {
|
|
4395
|
+
return 6 === largestUnit ? diffEpochNanosRounded(isoDateToEpochNano(startIsoDate), isoDateToEpochNano(endIsoDate), largestUnit, smallestUnit, roundingInc, roundingMode) : diffDateCalendarUnitsRounded(calendar, startIsoDate, endIsoDate, largestUnit, smallestUnit, roundingInc, roundingMode, smallestPrecision);
|
|
4282
4396
|
}
|
|
4283
4397
|
|
|
4284
|
-
function
|
|
4285
|
-
const
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4398
|
+
function diffTimesRounded(plainTimeSlots0, plainTimeSlots1, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4399
|
+
const timeDiffNano = roundNumberToInc(timeFieldsToNano(plainTimeSlots1) - timeFieldsToNano(plainTimeSlots0), computeNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
4400
|
+
return {
|
|
4401
|
+
...durationFieldDefaults,
|
|
4402
|
+
...nanoToDurationTimeFields(timeDiffNano, largestUnit)
|
|
4403
|
+
};
|
|
4289
4404
|
}
|
|
4290
4405
|
|
|
4291
|
-
function
|
|
4292
|
-
const startEpochNano = isoDateToEpochNano(startIsoDate);
|
|
4406
|
+
function diffDateCalendarUnitsRounded(calendar, startIsoDate, endIsoDate, largestUnit, smallestUnit, roundingInc, roundingMode, smallestPrecision = 6) {
|
|
4293
4407
|
const endEpochNano = isoDateToEpochNano(endIsoDate);
|
|
4408
|
+
if (!compareIsoDates(startIsoDate, endIsoDate)) {
|
|
4409
|
+
return durationFieldDefaults;
|
|
4410
|
+
}
|
|
4294
4411
|
let durationFields;
|
|
4295
|
-
return
|
|
4296
|
-
smallestUnit === smallestPrecision && 1 === roundingInc || (durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createDateRelativeOps(calendar, startIsoDate)))
|
|
4297
|
-
|
|
4412
|
+
return durationFields = diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit),
|
|
4413
|
+
smallestUnit === smallestPrecision && 1 === roundingInc || (durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createDateRelativeOps(calendar, startIsoDate))),
|
|
4414
|
+
durationFields;
|
|
4298
4415
|
}
|
|
4299
4416
|
|
|
4300
|
-
function
|
|
4301
|
-
|
|
4302
|
-
const timeDiffNano = roundNumberToInc(timeFieldsToNano(plainTimeSlots1) - timeFieldsToNano(plainTimeSlots0), computeNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
4303
|
-
const durationFields = {
|
|
4417
|
+
function diffEpochNanosRounded(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4418
|
+
return {
|
|
4304
4419
|
...durationFieldDefaults,
|
|
4305
|
-
...
|
|
4420
|
+
...nanoToDurationDayTimeFields(roundBigNanoToInc(endEpochNano - startEpochNano, computeBigNanoInc(smallestUnit, roundingInc), roundingMode), largestUnit)
|
|
4306
4421
|
};
|
|
4307
|
-
return createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
4308
4422
|
}
|
|
4309
4423
|
|
|
4310
|
-
function diffZonedEpochsExact(timeZone, calendar,
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
}
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4424
|
+
function diffZonedEpochsExact(timeZone, calendar, startZoned, endZoned, largestUnit) {
|
|
4425
|
+
return largestUnit < 6 ? {
|
|
4426
|
+
...durationFieldDefaults,
|
|
4427
|
+
...nanoToDurationDayTimeFields(endZoned.epochNanoseconds - startZoned.epochNanoseconds, largestUnit)
|
|
4428
|
+
} : ((timeZone, startZoned, endZoned) => {
|
|
4429
|
+
const sign = compareBigInts(endZoned.epochNanoseconds, startZoned.epochNanoseconds);
|
|
4430
|
+
if (!sign) {
|
|
4431
|
+
return durationFieldDefaults;
|
|
4432
|
+
}
|
|
4433
|
+
if (!compareIsoDates(zonedEpochSlotsToIso(startZoned), zonedEpochSlotsToIso(endZoned))) {
|
|
4434
|
+
return {
|
|
4435
|
+
...durationFieldDefaults,
|
|
4436
|
+
...nanoToDurationDayTimeFields(endZoned.epochNanoseconds - startZoned.epochNanoseconds, 5)
|
|
4437
|
+
};
|
|
4438
|
+
}
|
|
4439
|
+
const [startIsoDateTime, endIsoDate, remainderNano] = prepareZonedEpochDiff(timeZone, startZoned, endZoned, sign);
|
|
4322
4440
|
return {
|
|
4323
|
-
...
|
|
4324
|
-
...
|
|
4441
|
+
...(start = startIsoDateTime, end = endIsoDate, diffCalendarDates(calendar, start, end, largestUnit)),
|
|
4442
|
+
...nanoToDurationTimeFields(remainderNano)
|
|
4325
4443
|
};
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
return {
|
|
4329
|
-
...6 === largestUnit ? {
|
|
4330
|
-
...durationFieldDefaults,
|
|
4331
|
-
days: diffDays(isoFields0, isoFields1)
|
|
4332
|
-
} : diffCalendarDates(calendar, isoFields0, isoFields1, largestUnit),
|
|
4333
|
-
...nanoToDurationTimeFields(remainderNano)
|
|
4334
|
-
};
|
|
4444
|
+
var start, end;
|
|
4445
|
+
})(timeZone, startZoned, endZoned);
|
|
4335
4446
|
}
|
|
4336
4447
|
|
|
4337
4448
|
function diffDateTimesExact(calendar, startIsoDateTime, endIsoDateTime, largestUnit) {
|
|
@@ -4347,38 +4458,57 @@ function diffDateTimesExact(calendar, startIsoDateTime, endIsoDateTime, largestU
|
|
|
4347
4458
|
function diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit) {
|
|
4348
4459
|
let diffEndDate = endIsoDateTime;
|
|
4349
4460
|
let timeNano = timeFieldsToNano(endIsoDateTime) - timeFieldsToNano(startIsoDateTime);
|
|
4350
|
-
return Math.sign(timeNano) === -sign && (diffEndDate =
|
|
4461
|
+
return Math.sign(timeNano) === -sign && (diffEndDate = moveDateByDays(endIsoDateTime, -sign),
|
|
4351
4462
|
timeNano += nanoInUtcDay * sign), {
|
|
4352
4463
|
...diffCalendarDates(calendar, startIsoDateTime, diffEndDate, largestUnit),
|
|
4353
4464
|
...nanoToDurationTimeFields(timeNano)
|
|
4354
4465
|
};
|
|
4355
4466
|
}
|
|
4356
4467
|
|
|
4468
|
+
function prepareZonedEpochDiff(timeZone, startZoned, endZoned, sign) {
|
|
4469
|
+
const startIsoDate = zonedEpochSlotsToIso(startZoned);
|
|
4470
|
+
const endIsoDate = zonedEpochSlotsToIso(endZoned);
|
|
4471
|
+
const endEpochNano = endZoned.epochNanoseconds;
|
|
4472
|
+
let dayCorrection = 0;
|
|
4473
|
+
const timeDiffNano = timeFieldsToNano(endIsoDate) - timeFieldsToNano(startIsoDate);
|
|
4474
|
+
Math.sign(timeDiffNano) === -sign && dayCorrection++;
|
|
4475
|
+
const maxDayCorrection = dayCorrection + (sign > 0 ? 1 : 0);
|
|
4476
|
+
for (;;dayCorrection++) {
|
|
4477
|
+
const midIsoDate = moveDateByDays(endIsoDate, dayCorrection * -sign);
|
|
4478
|
+
const midEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(midIsoDate, startIsoDate));
|
|
4479
|
+
if (dayCorrection === maxDayCorrection || compareBigInts(endEpochNano, midEpochNano) !== -sign) {
|
|
4480
|
+
return [ startIsoDate, midIsoDate, Number(endEpochNano - midEpochNano) ];
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
|
|
4357
4485
|
function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
|
|
4358
4486
|
if (largestUnit <= 7) {
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4487
|
+
return ((asWeeks, start, end) => {
|
|
4488
|
+
const days = countIsoDays(start, end);
|
|
4489
|
+
return asWeeks ? {
|
|
4490
|
+
...durationFieldDefaults,
|
|
4491
|
+
weeks: divTrunc(days, 7),
|
|
4492
|
+
days: modTrunc(days, 7)
|
|
4493
|
+
} : {
|
|
4494
|
+
...durationFieldDefaults,
|
|
4495
|
+
days: days
|
|
4496
|
+
};
|
|
4497
|
+
})(7 === largestUnit, startIsoDate, endIsoDate);
|
|
4368
4498
|
}
|
|
4369
4499
|
const yearMonthDayStart = computeCalendarDateFields(calendar, startIsoDate);
|
|
4370
4500
|
const yearMonthDayEnd = computeCalendarDateFields(calendar, endIsoDate);
|
|
4371
4501
|
if (8 === largestUnit) {
|
|
4372
4502
|
const {year: year0, month: month0, day: day0} = yearMonthDayStart;
|
|
4373
4503
|
const {year: year1, month: month1, day: day1} = yearMonthDayEnd;
|
|
4374
|
-
const sign = Math.sign(compareNumbers(year1, year0) || compareNumbers(month1, month0) ||
|
|
4504
|
+
const sign = Math.sign(compareNumbers(year1, year0) || compareNumbers(month1, month0) || countIsoDays(startIsoDate, endIsoDate));
|
|
4375
4505
|
let months = 0;
|
|
4376
4506
|
let days = 0;
|
|
4377
4507
|
if (sign) {
|
|
4378
|
-
months = calendar ? calendar.
|
|
4379
|
-
let anchorIsoDate =
|
|
4380
|
-
sign * compareNumbers(day0, day1) > 0 && (months -= sign, anchorIsoDate =
|
|
4381
|
-
days =
|
|
4508
|
+
months = calendar ? calendar.ee(year0, month0, year1, month1) : diffIsoMonthSlots(year0, month0, year1, month1);
|
|
4509
|
+
let anchorIsoDate = moveDateByCalendarUnits(calendar, startIsoDate, 0, months, 0);
|
|
4510
|
+
sign * compareNumbers(day0, day1) > 0 && (months -= sign, anchorIsoDate = moveDateByCalendarUnits(calendar, startIsoDate, 0, months, 0)),
|
|
4511
|
+
days = countIsoDays(anchorIsoDate, endIsoDate);
|
|
4382
4512
|
}
|
|
4383
4513
|
return {
|
|
4384
4514
|
...durationFieldDefaults,
|
|
@@ -4397,7 +4527,7 @@ function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
|
|
|
4397
4527
|
let dayCorrect = 0;
|
|
4398
4528
|
if (Math.sign(day1 - day0) === -sign) {
|
|
4399
4529
|
const origDaysInMonth1 = daysInMonth1;
|
|
4400
|
-
const yearMonthParts = calendar
|
|
4530
|
+
const yearMonthParts = addCalendarMonths(calendar, year1, month1, -sign);
|
|
4401
4531
|
(({year: year1, month: month1} = yearMonthParts)), yearDiff = year1 - year0, monthDiff = month1 - month0,
|
|
4402
4532
|
daysInMonth1 = computeCalendarDaysInMonthForYearMonth(calendar, year1, month1),
|
|
4403
4533
|
dayCorrect = sign < 0 ? -origDaysInMonth1 : daysInMonth1;
|
|
@@ -4409,10 +4539,10 @@ function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
|
|
|
4409
4539
|
if (monthDiff = void 0 !== leapMonthMeta && isLeapMonth0 && !isLeapMonth1 && (leapMonthMeta < 0 ? sign > 0 && monthCodeNumber1 === -leapMonthMeta : sign < 0 && monthCodeNumber1 === monthCodeNumber0) ? 0 : monthCodeNumber1 - monthCodeNumber0 || Number(isLeapMonth1) - Number(isLeapMonth0),
|
|
4410
4540
|
Math.sign(monthDiff) === -sign) {
|
|
4411
4541
|
const monthCorrect = sign < 0 && -computeCalendarMonthsInYearForYear(calendar, year1);
|
|
4412
|
-
year1 -= sign, yearDiff = year1 - year0, monthDiff = month1 -
|
|
4542
|
+
year1 -= sign, yearDiff = year1 - year0, monthDiff = month1 - resolveMonthInMovedYear(calendar, monthCodeNumber0, isLeapMonth0, calendar ? calendar.p(year1) : void 0, 0) + (monthCorrect || computeCalendarMonthsInYearForYear(calendar, year1));
|
|
4413
4543
|
} else if (calendar) {
|
|
4414
|
-
const month0Projected =
|
|
4415
|
-
monthDiff = calendar.
|
|
4544
|
+
const month0Projected = resolveMonthInMovedYear(calendar, monthCodeNumber0, isLeapMonth0, calendar.p(year1), 0);
|
|
4545
|
+
monthDiff = calendar.ee(year1, month0Projected, year1, month1);
|
|
4416
4546
|
}
|
|
4417
4547
|
}
|
|
4418
4548
|
}
|
|
@@ -4424,84 +4554,48 @@ function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
|
|
|
4424
4554
|
};
|
|
4425
4555
|
}
|
|
4426
4556
|
|
|
4427
|
-
function
|
|
4557
|
+
function compareIsoDates(isoDate0, isoDate1) {
|
|
4428
4558
|
return compareNumbers(isoDate0.year, isoDate1.year) || compareNumbers(isoDate0.month, isoDate1.month) || compareNumbers(isoDate0.day, isoDate1.day);
|
|
4429
4559
|
}
|
|
4430
4560
|
|
|
4431
|
-
function
|
|
4432
|
-
|
|
4433
|
-
const endIsoDate = zonedEpochSlotsToIso(slots1);
|
|
4434
|
-
const endEpochNano = slots1.epochNanoseconds;
|
|
4435
|
-
let dayCorrection = 0;
|
|
4436
|
-
const timeDiffNano = timeFieldsToNano(endIsoDate) - timeFieldsToNano(startIsoDate);
|
|
4437
|
-
Math.sign(timeDiffNano) === -sign && dayCorrection++;
|
|
4438
|
-
const maxDayCorrection = dayCorrection + (sign > 0 ? 1 : 0);
|
|
4439
|
-
for (;dayCorrection <= maxDayCorrection; dayCorrection++) {
|
|
4440
|
-
const midIsoDate = moveByDays(endIsoDate, dayCorrection * -sign);
|
|
4441
|
-
const midEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(midIsoDate, startIsoDate));
|
|
4442
|
-
if (compareBigInts(endEpochNano, midEpochNano) !== -sign) {
|
|
4443
|
-
return [ startIsoDate, midIsoDate, Number(endEpochNano - midEpochNano) ];
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
}
|
|
4447
|
-
|
|
4448
|
-
function diffEpochNanos(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4449
|
-
return {
|
|
4450
|
-
...durationFieldDefaults,
|
|
4451
|
-
...nanoToDurationDayTimeFields(roundBigNanoToInc(endEpochNano - startEpochNano, computeBigNanoInc(smallestUnit, roundingInc), roundingMode), largestUnit)
|
|
4452
|
-
};
|
|
4561
|
+
function countIsoDays(startIsoDate, endIsoDate) {
|
|
4562
|
+
return isoDateToEpochDays(endIsoDate) - isoDateToEpochDays(startIsoDate);
|
|
4453
4563
|
}
|
|
4454
4564
|
|
|
4455
|
-
function
|
|
4456
|
-
return
|
|
4565
|
+
function spanRelativeDuration(relativeToSlots, durationFields, largestUnit) {
|
|
4566
|
+
return isZonedEpochSlots(relativeToSlots) ? ((relativeToSlots, durationFields, largestUnit) => {
|
|
4567
|
+
const {calendar: calendar, timeZone: timeZone} = relativeToSlots;
|
|
4568
|
+
const endSlots = moveZonedEpochSlots(relativeToSlots, durationFields);
|
|
4569
|
+
return [ diffZonedEpochsExact(timeZone, calendar, relativeToSlots, endSlots, largestUnit), endSlots.epochNanoseconds, createZonedRelativeOps(calendar, timeZone, relativeToSlots) ];
|
|
4570
|
+
})(relativeToSlots, durationFields, largestUnit) : ((relativeToSlots, durationFields, largestUnit) => {
|
|
4571
|
+
const {calendar: calendar} = relativeToSlots;
|
|
4572
|
+
const origin = checkIsoDateTimeInBounds(combineDateAndTime(relativeToSlots, timeFieldDefaults));
|
|
4573
|
+
const end = moveDateTime(calendar, origin, durationFields);
|
|
4574
|
+
return [ diffDateTimesExact(calendar, origin, end, largestUnit), isoDateTimeToEpochNano(end), createDateRelativeOps(calendar, relativeToSlots) ];
|
|
4575
|
+
})(relativeToSlots, durationFields, largestUnit);
|
|
4457
4576
|
}
|
|
4458
4577
|
|
|
4459
|
-
function
|
|
4460
|
-
return
|
|
4461
|
-
origin: origin,
|
|
4462
|
-
ie: isoDateToEpochNano(origin),
|
|
4463
|
-
calendar: calendar,
|
|
4464
|
-
he: isoDateToEpochNano
|
|
4465
|
-
};
|
|
4578
|
+
function moveRelativeEndpointToEpochNano(relativeToSlots, durationFields) {
|
|
4579
|
+
return isZonedEpochSlots(relativeToSlots) ? moveZonedEpochSlots(relativeToSlots, durationFields).epochNanoseconds : isoDateTimeToEpochNano(moveDateTime(relativeToSlots.calendar, combineDateAndTime(relativeToSlots, timeFieldDefaults), durationFields));
|
|
4466
4580
|
}
|
|
4467
4581
|
|
|
4468
|
-
function
|
|
4469
|
-
return
|
|
4470
|
-
origin: origin,
|
|
4471
|
-
ie: isoDateTimeToEpochNano(origin),
|
|
4472
|
-
calendar: calendar,
|
|
4473
|
-
he: movedIsoDate => isoDateTimeToEpochNano(combineDateAndTime(movedIsoDate, origin))
|
|
4474
|
-
};
|
|
4582
|
+
function moveRelativeMarkerToEpochNano(relativeOps, dateDuration) {
|
|
4583
|
+
return durationHasDateParts(dateDuration) ? relativeOps.ke(dateDuration) : relativeOps.ne;
|
|
4475
4584
|
}
|
|
4476
4585
|
|
|
4477
4586
|
function createZonedRelativeOps(calendar, timeZone, slots) {
|
|
4478
4587
|
const origin = zonedEpochSlotsToIso(slots);
|
|
4479
4588
|
return {
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
calendar: calendar,
|
|
4483
|
-
he: movedIsoDate => getSingleInstantFor(timeZone, combineDateAndTime(movedIsoDate, origin))
|
|
4589
|
+
ne: slots.epochNanoseconds,
|
|
4590
|
+
ke: duration => getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, origin, duration), origin))
|
|
4484
4591
|
};
|
|
4485
4592
|
}
|
|
4486
4593
|
|
|
4487
|
-
function
|
|
4488
|
-
return
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
const {calendar: calendar} = relativeToSlots;
|
|
4493
|
-
if (isZonedEpochSlots(relativeToSlots)) {
|
|
4494
|
-
const {timeZone: timeZone} = relativeToSlots;
|
|
4495
|
-
const endSlots = moveZonedEpochSlots(relativeToSlots, durationFields);
|
|
4496
|
-
return [ diffZonedEpochsExact(timeZone, calendar, relativeToSlots, endSlots, largestUnit), endSlots.epochNanoseconds, createZonedRelativeOps(calendar, timeZone, relativeToSlots) ];
|
|
4497
|
-
}
|
|
4498
|
-
const origin = checkIsoDateTimeInBounds(combineDateAndTime(relativeToSlots, timeFieldDefaults));
|
|
4499
|
-
const end = moveDateTime(calendar, origin, durationFields);
|
|
4500
|
-
return [ diffDateTimesExact(calendar, origin, end, largestUnit), isoDateTimeToEpochNano(end), createDateRelativeOps(calendar, relativeToSlots) ];
|
|
4501
|
-
}
|
|
4502
|
-
|
|
4503
|
-
function moveRelativeEndpointToEpochNano(relativeToSlots, durationFields) {
|
|
4504
|
-
return isZonedEpochSlots(relativeToSlots) ? moveZonedEpochSlots(relativeToSlots, durationFields).epochNanoseconds : isoDateTimeToEpochNano(moveDateTime(relativeToSlots.calendar, combineDateAndTime(relativeToSlots, timeFieldDefaults), durationFields));
|
|
4594
|
+
function createDateRelativeOps(calendar, origin) {
|
|
4595
|
+
return {
|
|
4596
|
+
ne: isoDateToEpochNano(origin),
|
|
4597
|
+
ke: duration => isoDateToEpochNano(moveDate(calendar, origin, duration))
|
|
4598
|
+
};
|
|
4505
4599
|
}
|
|
4506
4600
|
|
|
4507
4601
|
function isZonedEpochSlots(slots) {
|
|
@@ -4523,49 +4617,21 @@ function nanoToGivenFields(nano, largestUnit, fieldNames) {
|
|
|
4523
4617
|
|
|
4524
4618
|
const maxDurationSeconds = 2 ** 53;
|
|
4525
4619
|
|
|
4526
|
-
function
|
|
4527
|
-
const relativeToSlots = refineRelativeTo(normalizeOptions(options).relativeTo);
|
|
4620
|
+
function addDurationsWithoutRelativeTo(doSubtract, slots, otherSlots) {
|
|
4528
4621
|
const maxUnit = Math.max(getMaxDurationUnit(slots), getMaxDurationUnit(otherSlots));
|
|
4529
|
-
return
|
|
4530
|
-
doSubtract && (otherSlots = negateDurationFields(otherSlots)), createDurationSlots(((relativeToSlots, durationFields0, durationFields1, largestUnit) => {
|
|
4531
|
-
const {calendar: calendar} = relativeToSlots;
|
|
4532
|
-
if (isZonedEpochSlots(relativeToSlots)) {
|
|
4533
|
-
const {timeZone: timeZone} = relativeToSlots;
|
|
4534
|
-
const midSlots = moveZonedEpochSlots(relativeToSlots, durationFields0);
|
|
4535
|
-
return diffZonedEpochsExact(timeZone, calendar, relativeToSlots, moveZonedEpochSlots(midSlots, durationFields1), largestUnit);
|
|
4536
|
-
}
|
|
4537
|
-
const origin = combineDateAndTime(relativeToSlots, timeFieldDefaults);
|
|
4538
|
-
const mid = moveDateTime(calendar, origin, durationFields0);
|
|
4539
|
-
return diffDateTimesExact(calendar, origin, moveDateTime(calendar, mid, durationFields1), largestUnit);
|
|
4540
|
-
})(relativeToSlots, slots, otherSlots, maxUnit)));
|
|
4541
|
-
}
|
|
4542
|
-
|
|
4543
|
-
function addDayTimeDurationsChecked(doSubtract, slots, otherSlots, maxUnit) {
|
|
4544
|
-
return createDurationSlots(validateDurationFields(((a, b, largestUnit, doSubtract) => {
|
|
4622
|
+
return maxUnit > 6 && throwRangeError("Cannot use large units"), ((doSubtract, slots, otherSlots, maxUnit) => createDurationSlots(validateDurationFields(((a, b, largestUnit, doSubtract) => {
|
|
4545
4623
|
const combined = durationDayTimeToBigNano(a) + durationDayTimeToBigNano(b) * BigInt(doSubtract ? -1 : 1);
|
|
4546
4624
|
return Number.isFinite(Number(combined / bigNanoInUtcDay)) || throwRangeError(outOfBoundsDate),
|
|
4547
4625
|
{
|
|
4548
4626
|
...durationFieldDefaults,
|
|
4549
4627
|
...nanoToDurationDayTimeFields(combined, largestUnit)
|
|
4550
4628
|
};
|
|
4551
|
-
})(slots, otherSlots, maxUnit, doSubtract)));
|
|
4629
|
+
})(slots, otherSlots, maxUnit, doSubtract))))(doSubtract, slots, otherSlots, maxUnit);
|
|
4552
4630
|
}
|
|
4553
4631
|
|
|
4554
4632
|
function roundDuration(refineRelativeTo, slots, options) {
|
|
4555
4633
|
const durationLargestUnit = getMaxDurationUnit(slots);
|
|
4556
|
-
const [largestUnit, smallestUnit, roundingInc, roundingMode, relativeToSlots] = (
|
|
4557
|
-
options = normalizeOptionsOrString(options, smallestUnitStr);
|
|
4558
|
-
let largestUnit = coerceLargestUnit(options);
|
|
4559
|
-
const relativeToInternals = refineRelativeTo(options.relativeTo);
|
|
4560
|
-
let roundingInc = coerceRoundingIncInteger(options);
|
|
4561
|
-
const roundingMode = coerceRoundingMode(options, 7);
|
|
4562
|
-
let smallestUnit = coerceSmallestUnit(options);
|
|
4563
|
-
return void 0 === largestUnit && void 0 === smallestUnit && throwRangeError("Required smallestUnit or largestUnit"),
|
|
4564
|
-
null == smallestUnit && (smallestUnit = 0), null == largestUnit && (largestUnit = Math.max(smallestUnit, defaultLargestUnit)),
|
|
4565
|
-
checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1),
|
|
4566
|
-
roundingInc > 1 && smallestUnit > 5 && largestUnit !== smallestUnit && throwRangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit"),
|
|
4567
|
-
[ largestUnit, smallestUnit, roundingInc, roundingMode, relativeToInternals ];
|
|
4568
|
-
})(options, durationLargestUnit, refineRelativeTo);
|
|
4634
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode, relativeToSlots] = refineDurationRoundOptions(options, durationLargestUnit, refineRelativeTo);
|
|
4569
4635
|
if (!relativeToSlots && Math.max(durationLargestUnit, largestUnit) <= 6) {
|
|
4570
4636
|
return createDurationSlots(validateDurationFields(((durationFields, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
4571
4637
|
const roundedBigNano = roundBigNanoToInc(durationDayTimeToBigNano(durationFields), computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
@@ -4575,12 +4641,11 @@ function roundDuration(refineRelativeTo, slots, options) {
|
|
|
4575
4641
|
};
|
|
4576
4642
|
})(slots, largestUnit, smallestUnit, roundingInc, roundingMode)));
|
|
4577
4643
|
}
|
|
4578
|
-
|
|
4579
|
-
const
|
|
4580
|
-
if (!slots.sign && !
|
|
4644
|
+
relativeToSlots || throwRangeError("Missing relativeTo");
|
|
4645
|
+
const isZoned = isZonedEpochSlots(relativeToSlots);
|
|
4646
|
+
if (!slots.sign && (!isZoned || largestUnit < 6)) {
|
|
4581
4647
|
return slots;
|
|
4582
4648
|
}
|
|
4583
|
-
relativeToSlots || throwRangeError("Missing relativeTo");
|
|
4584
4649
|
const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, largestUnit);
|
|
4585
4650
|
return createDurationSlots(roundRelativeDuration(balancedDuration, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps, isZoned));
|
|
4586
4651
|
}
|
|
@@ -4613,12 +4678,16 @@ function computeDurationSign(fields, fieldNames = durationFieldNamesAsc) {
|
|
|
4613
4678
|
|
|
4614
4679
|
function validateDurationFields(fields) {
|
|
4615
4680
|
for (const calendarUnit of durationCalendarFieldNamesAsc) {
|
|
4616
|
-
|
|
4681
|
+
validateDurationCalendarUnit(calendarUnit, fields[calendarUnit]);
|
|
4617
4682
|
}
|
|
4618
4683
|
const bigNano = durationDayTimeToBigNano(fields);
|
|
4619
4684
|
return validateDurationTimeUnit(Number(bigNano / bigNanoInSec)), fields;
|
|
4620
4685
|
}
|
|
4621
4686
|
|
|
4687
|
+
function validateDurationCalendarUnit(unit, value) {
|
|
4688
|
+
return clampEntity(unit, value, -4294967295, 4294967295, 1);
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4622
4691
|
function validateDurationTimeUnit(n) {
|
|
4623
4692
|
Number.isSafeInteger(n) || throwRangeError("Out-of-bounds duration");
|
|
4624
4693
|
}
|
|
@@ -4674,12 +4743,12 @@ function compareIsoDateTimeFields(isoDateTime0, isoDateTime1) {
|
|
|
4674
4743
|
return compareIsoDateFields(isoDateTime0, isoDateTime1) || compareTimeFields(isoDateTime0, isoDateTime1);
|
|
4675
4744
|
}
|
|
4676
4745
|
|
|
4677
|
-
function compareIsoDateFields(
|
|
4678
|
-
return compareNumbers(isoDateToEpochDays(
|
|
4746
|
+
function compareIsoDateFields(isoDate0, isoDate1) {
|
|
4747
|
+
return compareNumbers(isoDateToEpochDays(isoDate0), isoDateToEpochDays(isoDate1));
|
|
4679
4748
|
}
|
|
4680
4749
|
|
|
4681
|
-
function compareTimeFields(
|
|
4682
|
-
return compareNumbers(timeFieldsToNano(
|
|
4750
|
+
function compareTimeFields(timeFields0, timeFields1) {
|
|
4751
|
+
return compareNumbers(timeFieldsToNano(timeFields0), timeFieldsToNano(timeFields1));
|
|
4683
4752
|
}
|
|
4684
4753
|
|
|
4685
4754
|
function instantsEqual(instantSlots0, instantSlots1) {
|
|
@@ -4718,7 +4787,7 @@ function getCalendarFieldNames(calendar, fieldNames, fieldNamesWithEra = fieldNa
|
|
|
4718
4787
|
return getCalendarEraOrigins(calendar) ? fieldNamesWithEra : fieldNames;
|
|
4719
4788
|
}
|
|
4720
4789
|
|
|
4721
|
-
function resolveCalendarYear(
|
|
4790
|
+
function resolveCalendarYear(fields, calendar) {
|
|
4722
4791
|
const exoticCalendar = calendar || void 0;
|
|
4723
4792
|
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
4724
4793
|
let {era: era, eraYear: eraYear, year: year} = fields;
|
|
@@ -4729,7 +4798,7 @@ function resolveCalendarYear(calendar, fields) {
|
|
|
4729
4798
|
const normalizedEra = normalizeEraName(era);
|
|
4730
4799
|
const eraOrigin = eraOrigins[normalizedEra];
|
|
4731
4800
|
void 0 === eraOrigin && throwRangeError((era => `Invalid era: ${era}`)(era));
|
|
4732
|
-
const yearByEra = exoticCalendar
|
|
4801
|
+
const yearByEra = exoticCalendar?._ ? exoticCalendar._(eraYear, normalizedEra, eraOrigin) : eraYearToYear(eraYear, eraOrigin);
|
|
4733
4802
|
void 0 !== year && year !== yearByEra && throwRangeError("Mismatching year/eraYear"),
|
|
4734
4803
|
year = yearByEra;
|
|
4735
4804
|
} else {
|
|
@@ -4738,7 +4807,7 @@ function resolveCalendarYear(calendar, fields) {
|
|
|
4738
4807
|
return year;
|
|
4739
4808
|
}
|
|
4740
4809
|
|
|
4741
|
-
function resolveCalendarMonth(
|
|
4810
|
+
function resolveCalendarMonth(fields, calendar, year, monthCodeParts, overflow) {
|
|
4742
4811
|
let {month: month, monthCode: monthCode} = fields;
|
|
4743
4812
|
if (void 0 !== monthCode) {
|
|
4744
4813
|
const monthByCode = ((calendar, monthCode, year, overflow, monthCodeParts = parseMonthCode(monthCode)) => {
|
|
@@ -4761,7 +4830,7 @@ function resolveCalendarMonth(calendar, fields, year, overflow, monthCodeParts)
|
|
|
4761
4830
|
return clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
4762
4831
|
}
|
|
4763
4832
|
|
|
4764
|
-
function resolveCalendarDay(calendar,
|
|
4833
|
+
function resolveCalendarDay(fields, calendar, year, month, overflow) {
|
|
4765
4834
|
return clampProp(fields, "day", 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow);
|
|
4766
4835
|
}
|
|
4767
4836
|
|
|
@@ -4804,19 +4873,10 @@ function parseOffsetNanoMaybe(s, onlyHourMinute) {
|
|
|
4804
4873
|
}
|
|
4805
4874
|
|
|
4806
4875
|
const dateFieldRefiners = {
|
|
4807
|
-
era:
|
|
4876
|
+
era: toString,
|
|
4808
4877
|
month: toPositiveIntegerWithTruncation,
|
|
4809
|
-
monthCode(monthCode,
|
|
4810
|
-
|
|
4811
|
-
return monthCode;
|
|
4812
|
-
}
|
|
4813
|
-
if (monthCode && "object" == typeof monthCode) {
|
|
4814
|
-
const monthCodeToString = monthCode.toString;
|
|
4815
|
-
if ("function" == typeof monthCodeToString) {
|
|
4816
|
-
return requireString(monthCodeToString.call(monthCode), entityName);
|
|
4817
|
-
}
|
|
4818
|
-
}
|
|
4819
|
-
return requireString(monthCode, entityName);
|
|
4878
|
+
monthCode(monthCode, fieldName) {
|
|
4879
|
+
return requireString(toPrimitiveWithStringHint(monthCode), fieldName);
|
|
4820
4880
|
},
|
|
4821
4881
|
day: toPositiveIntegerWithTruncation
|
|
4822
4882
|
};
|
|
@@ -4829,7 +4889,7 @@ const dateTimeFieldRefiners = /*@__PURE__*/ Object.assign({}, dateFieldRefiners,
|
|
|
4829
4889
|
|
|
4830
4890
|
const zonedDateTimeFieldRefiners = {
|
|
4831
4891
|
offset(offsetString) {
|
|
4832
|
-
return parseOffsetNano(
|
|
4892
|
+
return parseOffsetNano(requireString(toPrimitiveWithStringHint(offsetString)));
|
|
4833
4893
|
},
|
|
4834
4894
|
...dateTimeFieldRefiners
|
|
4835
4895
|
};
|
|
@@ -4851,75 +4911,68 @@ function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFie
|
|
|
4851
4911
|
res;
|
|
4852
4912
|
}
|
|
4853
4913
|
|
|
4854
|
-
function
|
|
4855
|
-
const
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
return
|
|
4861
|
-
}
|
|
4862
|
-
|
|
4863
|
-
function createPlainDateFromFieldsWithOptionsRefiner(calendar, fields, refineOptions) {
|
|
4864
|
-
const prepared = prepareDateFields(calendar, fields);
|
|
4865
|
-
const refinedOptions = refineOptions();
|
|
4866
|
-
return [ createPlainDateFromPreparedFields(calendar, fields, prepared, refinedOptions[0]), ...refinedOptions ];
|
|
4914
|
+
function refineCalendarDateFields(fields, calendar, allowMissingDay) {
|
|
4915
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
4916
|
+
void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)),
|
|
4917
|
+
void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode"),
|
|
4918
|
+
allowMissingDay || void 0 !== fields.day || throwTypeError(missingField("day"));
|
|
4919
|
+
const monthCodeParts = parseMonthCodeField(fields);
|
|
4920
|
+
return [ resolveCalendarYear(fields, calendar), monthCodeParts ];
|
|
4867
4921
|
}
|
|
4868
4922
|
|
|
4869
|
-
function
|
|
4870
|
-
const
|
|
4871
|
-
const
|
|
4872
|
-
|
|
4923
|
+
function refineMonthDayFields(fields, calendar) {
|
|
4924
|
+
const isIso = calendar === isoCalendarImpl;
|
|
4925
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
4926
|
+
void 0 === fields.day && throwTypeError(missingField("day")), isIso || void 0 === fields.month || void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins));
|
|
4927
|
+
const monthCodeParts = parseMonthCodeField(fields);
|
|
4928
|
+
return [ void 0 !== fields.eraYear || void 0 !== fields.year ? resolveCalendarYear(fields, calendar) : void 0, monthCodeParts ];
|
|
4873
4929
|
}
|
|
4874
4930
|
|
|
4875
|
-
function
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
}
|
|
4931
|
+
function createDateTimeFromRefinedFields(isoDate, timeFields = timeFieldDefaults, calendar) {
|
|
4932
|
+
const isoDateTime = combineDateAndTime(isoDate, timeFields);
|
|
4933
|
+
return checkIsoDateTimeInBounds(isoDateTime), createDateTimeSlots(isoDateTime, calendar);
|
|
4879
4934
|
}
|
|
4880
4935
|
|
|
4881
|
-
function
|
|
4882
|
-
const
|
|
4883
|
-
return
|
|
4884
|
-
void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode"),
|
|
4885
|
-
void 0 === fields.day && throwTypeError(missingField("day")), [ parseMonthCodeField(fields), resolveCalendarYear(calendar, fields) ];
|
|
4936
|
+
function createDateFromRefinedFields(fields, calendar, year, monthCodeParts, overflow) {
|
|
4937
|
+
const month = resolveCalendarMonth(fields, calendar, year, monthCodeParts, overflow);
|
|
4938
|
+
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, resolveCalendarDay(fields, calendar, year, month, overflow))), calendar);
|
|
4886
4939
|
}
|
|
4887
4940
|
|
|
4888
|
-
function
|
|
4889
|
-
|
|
4890
|
-
void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)),
|
|
4891
|
-
void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode");
|
|
4892
|
-
const monthCodeParts = parseMonthCodeField(fields);
|
|
4893
|
-
const year = resolveCalendarYear(calendar, fields);
|
|
4894
|
-
return createDateSlots(checkIsoYearMonthInBounds(computeCalendarIsoFieldsFromParts(calendar, year, resolveCalendarMonth(calendar, fields, year, refineOverflowOptions(options), monthCodeParts), 1)), calendar);
|
|
4941
|
+
function createYearMonthFromRefinedFields(fields, calendar, year, monthCodeParts, overflow) {
|
|
4942
|
+
return createYearMonthFromCalendarParts(calendar, year, resolveCalendarMonth(fields, calendar, year, monthCodeParts, overflow));
|
|
4895
4943
|
}
|
|
4896
4944
|
|
|
4897
|
-
function
|
|
4945
|
+
function createMonthDayFromRefinedFields(fields, calendar, year, monthCodeParts, overflow) {
|
|
4898
4946
|
const isIso = calendar === isoCalendarImpl;
|
|
4899
|
-
|
|
4900
|
-
void 0 === fields.day && throwTypeError(missingField("day")), isIso || void 0 === fields.month || void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins));
|
|
4901
|
-
const monthCodeParts = parseMonthCodeField(fields);
|
|
4902
|
-
let yearMaybe = void 0 !== fields.eraYear || void 0 !== fields.year ? resolveCalendarYear(calendar, fields) : void 0;
|
|
4903
|
-
const overflow = refineOverflowOptions(options);
|
|
4947
|
+
let yearMaybe = year;
|
|
4904
4948
|
let day;
|
|
4905
4949
|
let monthCodeNumber;
|
|
4906
4950
|
let isLeapMonth;
|
|
4907
4951
|
if (void 0 === yearMaybe && isIso && (yearMaybe = 1972), void 0 !== yearMaybe) {
|
|
4908
4952
|
isIso || checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, yearMaybe, 1, 1));
|
|
4909
|
-
const month = resolveCalendarMonth(
|
|
4910
|
-
day = resolveCalendarDay(calendar,
|
|
4953
|
+
const month = resolveCalendarMonth(fields, calendar, yearMaybe, monthCodeParts, overflow);
|
|
4954
|
+
day = resolveCalendarDay(fields, calendar, yearMaybe, month, overflow), [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, yearMaybe, month);
|
|
4911
4955
|
} else {
|
|
4912
4956
|
void 0 === fields.monthCode && throwTypeError("Missing month/monthCode"), [monthCodeNumber, isLeapMonth] = monthCodeParts;
|
|
4913
|
-
const referenceYear = calendar ? calendar.
|
|
4957
|
+
const referenceYear = calendar ? calendar.re : 1972;
|
|
4914
4958
|
if (void 0 !== referenceYear) {
|
|
4915
|
-
day = resolveCalendarDay(calendar,
|
|
4959
|
+
day = resolveCalendarDay(fields, calendar, referenceYear, resolveCalendarMonth(fields, calendar, referenceYear, monthCodeParts, overflow), overflow);
|
|
4916
4960
|
} else {
|
|
4917
|
-
const constrainedDay = 0 === overflow && calendar ? calendar.
|
|
4961
|
+
const constrainedDay = 0 === overflow && calendar ? calendar.ge?.(monthCodeNumber, isLeapMonth, fields.day) : void 0;
|
|
4918
4962
|
day = void 0 !== constrainedDay ? constrainedDay : fields.day;
|
|
4919
4963
|
}
|
|
4920
4964
|
}
|
|
4921
|
-
|
|
4922
|
-
|
|
4965
|
+
return createMonthDayFromMonthCodeParts(calendar, monthCodeNumber, isLeapMonth, day, fields.day, overflow);
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
function createYearMonthFromCalendarParts(calendar, year, month) {
|
|
4969
|
+
return createDateSlots(checkIsoYearMonthInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, 1)), calendar);
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
function createMonthDayFromMonthCodeParts(calendar, monthCodeNumber, isLeapMonthArg, day, requestedDay, overflow) {
|
|
4973
|
+
let isLeapMonth = isLeapMonthArg;
|
|
4974
|
+
isLeapMonth && ((calendar && calendar.V?.[monthCodeNumber]) ?? 1 / 0) < requestedDay && (1 === overflow && throwRangeError(invalidLeapMonth),
|
|
4975
|
+
isLeapMonth = 0, day = constrainToRange(requestedDay, 1, (calendar && calendar.U) ?? 1 / 0));
|
|
4923
4976
|
let res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
4924
4977
|
for (;!res && 0 === overflow && day > 1; ) {
|
|
4925
4978
|
day--, res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
@@ -4929,6 +4982,12 @@ function createPlainMonthDayFromFields(calendar, fields, options) {
|
|
|
4929
4982
|
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, finalYear, finalMonth, day)), calendar);
|
|
4930
4983
|
}
|
|
4931
4984
|
|
|
4985
|
+
function parseMonthCodeField(fields) {
|
|
4986
|
+
if (void 0 !== fields.monthCode) {
|
|
4987
|
+
return parseMonthCode(fields.monthCode);
|
|
4988
|
+
}
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4932
4991
|
const RawDateTimeFormat = Intl.DateTimeFormat;
|
|
4933
4992
|
|
|
4934
4993
|
function formatEpochMilliToPartsRecord(intlFormat, epochMilli) {
|
|
@@ -4961,32 +5020,8 @@ const timeZonePeriodDaysByName = {
|
|
|
4961
5020
|
|
|
4962
5021
|
const minPossibleTransitionSec = -388152e4;
|
|
4963
5022
|
|
|
4964
|
-
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
4965
|
-
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
4966
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
4967
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
4968
|
-
return [ roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, maxSmallestUnit), subsecDigits) ];
|
|
4969
|
-
}
|
|
4970
|
-
|
|
4971
|
-
function refineDateDisplayOptions(options) {
|
|
4972
|
-
return coerceCalendarDisplay(normalizeOptions(options));
|
|
4973
|
-
}
|
|
4974
|
-
|
|
4975
|
-
function refineTimeDisplayOptions(options, maxSmallestUnit) {
|
|
4976
|
-
return refineTimeDisplayTuple(normalizeOptions(options), maxSmallestUnit);
|
|
4977
|
-
}
|
|
4978
|
-
|
|
4979
|
-
function resolveSmallestUnitAndSubsecDigits(smallestUnit, subsecDigits) {
|
|
4980
|
-
return null != smallestUnit ? [ unitNanoMap[smallestUnit], smallestUnit < 4 ? 9 - 3 * smallestUnit : -1 ] : [ void 0 === subsecDigits ? 1 : 10 ** (9 - subsecDigits), subsecDigits ];
|
|
4981
|
-
}
|
|
4982
|
-
|
|
4983
5023
|
function formatInstantIso(refineTimeZoneString, instantSlots, options) {
|
|
4984
|
-
const [timeZoneArg, roundingMode, nanoInc, subsecDigits] = (options
|
|
4985
|
-
const subsecDigits = coerceFractionalSecondDigits(options = normalizeOptions(options));
|
|
4986
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
4987
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
4988
|
-
return [ options.timeZone, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
4989
|
-
})(options);
|
|
5024
|
+
const [timeZoneArg, roundingMode, nanoInc, subsecDigits] = refineInstantDisplayOptions(options);
|
|
4990
5025
|
const providedTimeZone = void 0 !== timeZoneArg;
|
|
4991
5026
|
return ((providedTimeZone, timeZone, epochNano, roundingMode, nanoInc, subsecDigits) => {
|
|
4992
5027
|
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
@@ -4996,15 +5031,7 @@ function formatInstantIso(refineTimeZoneString, instantSlots, options) {
|
|
|
4996
5031
|
}
|
|
4997
5032
|
|
|
4998
5033
|
function formatZonedDateTimeIso(zonedDateTimeSlots0, options) {
|
|
4999
|
-
const displayOptions = (options
|
|
5000
|
-
options = normalizeOptions(options);
|
|
5001
|
-
const calendarDisplay = coerceCalendarDisplay(options);
|
|
5002
|
-
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
5003
|
-
const offsetDisplay = coerceOffsetDisplay(options);
|
|
5004
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
5005
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
5006
|
-
return [ calendarDisplay, coerceTimeZoneDisplay(options), offsetDisplay, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
5007
|
-
})(options);
|
|
5034
|
+
const displayOptions = refineZonedDateTimeDisplayOptions(options);
|
|
5008
5035
|
return ((calendar, timeZoneId, timeZone, epochNano, calendarDisplay, timeZoneDisplay, offsetDisplay, roundingMode, nanoInc, subsecDigits) => {
|
|
5009
5036
|
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
5010
5037
|
const offsetNano = timeZone.B(epochNano);
|
|
@@ -5013,8 +5040,8 @@ function formatZonedDateTimeIso(zonedDateTimeSlots0, options) {
|
|
|
5013
5040
|
}
|
|
5014
5041
|
|
|
5015
5042
|
function formatPlainDateTimeIso(plainDateTimeSlots0, options) {
|
|
5016
|
-
const displayOptions = (options
|
|
5017
|
-
return ((calendar, isoDateTime, calendarDisplay, roundingMode, nanoInc, subsecDigits) => formatIsoDateTimeFields(
|
|
5043
|
+
const displayOptions = refineDateTimeDisplayOptions(options);
|
|
5044
|
+
return ((calendar, isoDateTime, calendarDisplay, roundingMode, nanoInc, subsecDigits) => formatIsoDateTimeFields(roundDateTimeToInc(isoDateTime, nanoInc, roundingMode), subsecDigits) + formatCalendar(calendar, calendarDisplay))(plainDateTimeSlots0.calendar, plainDateTimeSlots0, ...displayOptions);
|
|
5018
5045
|
}
|
|
5019
5046
|
|
|
5020
5047
|
function formatPlainDateIso(plainDateSlots, options) {
|
|
@@ -5037,7 +5064,7 @@ function formatDateLikeIso(calendar, formatSimple, isoDate, calendarDisplay) {
|
|
|
5037
5064
|
}
|
|
5038
5065
|
|
|
5039
5066
|
function formatPlainTimeIso(slots, options) {
|
|
5040
|
-
return ((fields, roundingMode, nanoInc, subsecDigits) => formatTimeFields(
|
|
5067
|
+
return ((fields, roundingMode, nanoInc, subsecDigits) => formatTimeFields(roundTimeToInc(fields, nanoInc, roundingMode)[0], subsecDigits))(slots, ...refineTimeDisplayOptions(options));
|
|
5041
5068
|
}
|
|
5042
5069
|
|
|
5043
5070
|
function formatDurationIso(slots, options) {
|
|
@@ -5091,17 +5118,17 @@ function formatIsoDateTimeFields(isoDateTime, subsecDigits) {
|
|
|
5091
5118
|
return formatIsoDateFields(isoDateTime) + "T" + formatTimeFields(isoDateTime, subsecDigits);
|
|
5092
5119
|
}
|
|
5093
5120
|
|
|
5094
|
-
function formatIsoDateFields(
|
|
5095
|
-
return formatIsoYearMonthFields(
|
|
5121
|
+
function formatIsoDateFields(isoDate) {
|
|
5122
|
+
return formatIsoYearMonthFields(isoDate) + "-" + padNumber2(isoDate.day);
|
|
5096
5123
|
}
|
|
5097
5124
|
|
|
5098
|
-
function formatIsoYearMonthFields(
|
|
5099
|
-
const {year: year} =
|
|
5100
|
-
return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(
|
|
5125
|
+
function formatIsoYearMonthFields(isoDate) {
|
|
5126
|
+
const {year: year} = isoDate;
|
|
5127
|
+
return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDate.month);
|
|
5101
5128
|
}
|
|
5102
5129
|
|
|
5103
|
-
function formatIsoMonthDayFields(
|
|
5104
|
-
return padNumber2(
|
|
5130
|
+
function formatIsoMonthDayFields(isoDate) {
|
|
5131
|
+
return padNumber2(isoDate.month) + "-" + padNumber2(isoDate.day);
|
|
5105
5132
|
}
|
|
5106
5133
|
|
|
5107
5134
|
function formatTimeFields(timeFields, subsecDigits) {
|
|
@@ -5163,7 +5190,7 @@ function resolveTimeZoneRecord(rawId) {
|
|
|
5163
5190
|
if (void 0 !== offsetNano) {
|
|
5164
5191
|
return {
|
|
5165
5192
|
id: formatOffsetNano(offsetNano),
|
|
5166
|
-
|
|
5193
|
+
Z: offsetNano,
|
|
5167
5194
|
m: offsetNano
|
|
5168
5195
|
};
|
|
5169
5196
|
}
|
|
@@ -5214,24 +5241,24 @@ function queryTimeZone(rawTimeZoneId) {
|
|
|
5214
5241
|
return queryTimeZoneRecord(record.id, record);
|
|
5215
5242
|
}
|
|
5216
5243
|
|
|
5217
|
-
const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.m, record.format) : new FixedTimeZone(normTimeZoneId, record.m, "fixed" === record.kind ? record.
|
|
5244
|
+
const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.m, record.format) : new FixedTimeZone(normTimeZoneId, record.m, "fixed" === record.kind ? record.Z : 0));
|
|
5218
5245
|
|
|
5219
5246
|
class FixedTimeZone {
|
|
5220
5247
|
constructor(id, compareKey, offsetNano) {
|
|
5221
|
-
this.id = id, this.m = compareKey, this.
|
|
5248
|
+
this.id = id, this.m = compareKey, this.Z = offsetNano;
|
|
5222
5249
|
}
|
|
5223
5250
|
B() {
|
|
5224
|
-
return this.
|
|
5251
|
+
return this.Z;
|
|
5225
5252
|
}
|
|
5226
|
-
|
|
5227
|
-
return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.
|
|
5253
|
+
R(isoDateTime) {
|
|
5254
|
+
return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.Z) ];
|
|
5228
5255
|
}
|
|
5229
|
-
|
|
5256
|
+
C() {}
|
|
5230
5257
|
}
|
|
5231
5258
|
|
|
5232
5259
|
class IntlTimeZone {
|
|
5233
5260
|
constructor(id, compareKey, format) {
|
|
5234
|
-
this.id = id, this.m = compareKey, this.
|
|
5261
|
+
this.id = id, this.m = compareKey, this.oe = ((computeOffsetSec, periodDays) => {
|
|
5235
5262
|
const getSample = memoize(computeOffsetSec);
|
|
5236
5263
|
const getSplit = memoize(createSplitTuple);
|
|
5237
5264
|
const periodSec = 86400 * periodDays;
|
|
@@ -5253,7 +5280,7 @@ class IntlTimeZone {
|
|
|
5253
5280
|
return offsetSec;
|
|
5254
5281
|
}
|
|
5255
5282
|
return {
|
|
5256
|
-
|
|
5283
|
+
Ae(zonedEpochSec) {
|
|
5257
5284
|
const wideOffsetSec0 = getOffsetSec(zonedEpochSec - 86400);
|
|
5258
5285
|
const wideOffsetSec1 = getOffsetSec(zonedEpochSec + 86400);
|
|
5259
5286
|
const wideUtcEpochSec0 = zonedEpochSec - wideOffsetSec0;
|
|
@@ -5264,8 +5291,8 @@ class IntlTimeZone {
|
|
|
5264
5291
|
const narrowOffsetSec0 = getOffsetSec(wideUtcEpochSec0);
|
|
5265
5292
|
return narrowOffsetSec0 === getOffsetSec(wideUtcEpochSec1) ? [ zonedEpochSec - narrowOffsetSec0 ] : wideOffsetSec0 > wideOffsetSec1 ? [ wideUtcEpochSec0, wideUtcEpochSec1 ] : [];
|
|
5266
5293
|
},
|
|
5267
|
-
|
|
5268
|
-
|
|
5294
|
+
ze: getOffsetSec,
|
|
5295
|
+
C: function getTransition(epochSec, direction) {
|
|
5269
5296
|
if (direction > 0 && epochSec >= 864e10) {
|
|
5270
5297
|
return;
|
|
5271
5298
|
}
|
|
@@ -5302,7 +5329,7 @@ class IntlTimeZone {
|
|
|
5302
5329
|
};
|
|
5303
5330
|
})((format => epochSec => {
|
|
5304
5331
|
const intlParts = formatEpochMilliToPartsRecord(format, 1e3 * epochSec);
|
|
5305
|
-
return 86400 *
|
|
5332
|
+
return 86400 * isoPartsToEpochDays((intlParts => {
|
|
5306
5333
|
const relatedYear = intlParts.relatedYear;
|
|
5307
5334
|
if (void 0 !== relatedYear) {
|
|
5308
5335
|
return parseInt(relatedYear);
|
|
@@ -5316,16 +5343,16 @@ class IntlTimeZone {
|
|
|
5316
5343
|
})(id));
|
|
5317
5344
|
}
|
|
5318
5345
|
B(epochNano) {
|
|
5319
|
-
return this.
|
|
5346
|
+
return this.oe.ze((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
|
|
5320
5347
|
}
|
|
5321
|
-
|
|
5348
|
+
R(isoDateTime) {
|
|
5322
5349
|
const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
|
|
5323
5350
|
const subsecNano = timeFieldsToSubsecNano(isoDateTime);
|
|
5324
|
-
return this.
|
|
5351
|
+
return this.oe.Ae(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
|
|
5325
5352
|
}
|
|
5326
|
-
|
|
5353
|
+
C(epochNano, direction) {
|
|
5327
5354
|
const [epochSec, subsecNano] = epochNanoToSecMod(epochNano);
|
|
5328
|
-
const resEpochSec = this.
|
|
5355
|
+
const resEpochSec = this.oe.C(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
|
|
5329
5356
|
if (void 0 !== resEpochSec) {
|
|
5330
5357
|
return BigInt(resEpochSec) * bigNanoInSec;
|
|
5331
5358
|
}
|
|
@@ -5351,46 +5378,56 @@ function clampIntlSampleEpochSec(epochSec) {
|
|
|
5351
5378
|
|
|
5352
5379
|
function refineMaybeZonedDateTimeObjectLike(refineTimeZoneString, calendar, bag) {
|
|
5353
5380
|
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeAndZoneFieldNamesAlpha, dateTimeAndZoneFieldNamesWithEraAlpha), zonedDateTimeFieldRefiners, [], 0);
|
|
5354
|
-
|
|
5355
|
-
|
|
5381
|
+
const isZoned = void 0 !== fields.timeZone;
|
|
5382
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar);
|
|
5383
|
+
const isoDate = createDateFromRefinedFields(fields, calendar, year, monthCodeParts, 0);
|
|
5384
|
+
if (isZoned) {
|
|
5356
5385
|
const timeFields = resolveTimeFields(fields);
|
|
5357
5386
|
const timeZone = queryTimeZone(refineTimeZoneString(fields.timeZone));
|
|
5358
5387
|
return {
|
|
5359
|
-
epochNanoseconds: getMatchingInstantFor(timeZone, combineDateAndTime(
|
|
5388
|
+
epochNanoseconds: getMatchingInstantFor(timeZone, combineDateAndTime(isoDate, timeFields), fields.offset),
|
|
5360
5389
|
timeZone: timeZone,
|
|
5361
5390
|
calendar: calendar
|
|
5362
5391
|
};
|
|
5363
5392
|
}
|
|
5364
|
-
return
|
|
5393
|
+
return isoDate;
|
|
5365
5394
|
}
|
|
5366
5395
|
|
|
5367
5396
|
function refineZonedDateTimeObjectLike(refineTimeZoneString, calendar, bag, options) {
|
|
5368
5397
|
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeAndZoneFieldNamesAlpha, dateTimeAndZoneFieldNamesWithEraAlpha), zonedDateTimeFieldRefiners, timeZoneFieldNames, 0);
|
|
5369
5398
|
const timeZoneId = refineTimeZoneString(fields.timeZone);
|
|
5370
|
-
const [
|
|
5399
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar);
|
|
5400
|
+
const [overflow, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options);
|
|
5401
|
+
const isoDate = createDateFromRefinedFields(fields, calendar, year, monthCodeParts, overflow);
|
|
5371
5402
|
const timeFields = resolveTimeFields(fields, overflow);
|
|
5372
5403
|
const timeZone = queryTimeZone(timeZoneId);
|
|
5373
|
-
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(
|
|
5404
|
+
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(isoDate, timeFields), fields.offset, offsetDisambig, epochDisambig), timeZone, calendar);
|
|
5374
5405
|
}
|
|
5375
5406
|
|
|
5376
5407
|
function refinePlainDateTimeObjectLike(calendar, bag, options) {
|
|
5377
5408
|
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeFieldNamesAlpha, dateTimeFieldNamesWithEraAlpha), dateTimeFieldRefiners, [], 0);
|
|
5378
|
-
const [
|
|
5379
|
-
|
|
5409
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar);
|
|
5410
|
+
const overflow = refineOverflowOptions(options);
|
|
5411
|
+
return createDateTimeFromRefinedFields(createDateFromRefinedFields(fields, calendar, year, monthCodeParts, overflow), resolveTimeFields(fields, overflow), calendar);
|
|
5380
5412
|
}
|
|
5381
5413
|
|
|
5382
5414
|
function refinePlainDateObjectLike(calendar, bag, options, requireFields = []) {
|
|
5383
|
-
|
|
5415
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha), dateFieldRefiners, requireFields);
|
|
5416
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar);
|
|
5417
|
+
return createDateFromRefinedFields(fields, calendar, year, monthCodeParts, refineOverflowOptions(options));
|
|
5384
5418
|
}
|
|
5385
5419
|
|
|
5386
5420
|
function refinePlainYearMonthObjectLike(calendar, bag, options, requireFields) {
|
|
5387
|
-
|
|
5421
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, yearMonthFieldNamesAlpha, yearMonthFieldNamesWithEraAlpha), dateFieldRefiners, requireFields);
|
|
5422
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar, 1);
|
|
5423
|
+
return createYearMonthFromRefinedFields(fields, calendar, year, monthCodeParts, refineOverflowOptions(options));
|
|
5388
5424
|
}
|
|
5389
5425
|
|
|
5390
5426
|
function refinePlainMonthDayObjectLike(calendar, calendarAbsent, bag, options) {
|
|
5391
5427
|
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha), dateFieldRefiners, dayFieldNamesAsc, 0);
|
|
5392
|
-
|
|
5393
|
-
|
|
5428
|
+
calendarAbsent && void 0 !== fields.month && void 0 === fields.monthCode && void 0 === fields.year && (fields.year = 1972);
|
|
5429
|
+
const [year, monthCodeParts] = refineMonthDayFields(fields, calendar);
|
|
5430
|
+
return createMonthDayFromRefinedFields(fields, calendar, year, monthCodeParts, refineOverflowOptions(options));
|
|
5394
5431
|
}
|
|
5395
5432
|
|
|
5396
5433
|
function refinePlainTimeObjectLike(bag, options) {
|
|
@@ -5410,16 +5447,16 @@ function throwFailedParse(s) {
|
|
|
5410
5447
|
}
|
|
5411
5448
|
|
|
5412
5449
|
function parseInstant(s) {
|
|
5413
|
-
const organized = parseDateTimeLike(s =
|
|
5450
|
+
const organized = parseDateTimeLike(s = requireString(toPrimitiveWithStringHint(s)));
|
|
5414
5451
|
let offsetNano;
|
|
5415
|
-
return organized || throwFailedParse(s), organized.
|
|
5452
|
+
return organized || throwFailedParse(s), organized.F ? offsetNano = 0 : organized.offset ? offsetNano = parseOffsetNano(organized.offset) : throwFailedParse(s),
|
|
5416
5453
|
organized.timeZoneId && parseOffsetNanoMaybe(organized.timeZoneId, 1), validateIsoDateTimeFields(organized),
|
|
5417
5454
|
createEpochNanoSlots(isoDateTimeAndOffsetToEpochNano(organized, offsetNano));
|
|
5418
5455
|
}
|
|
5419
5456
|
|
|
5420
5457
|
function parseRelativeToSlots(s, resolveCalendar) {
|
|
5421
5458
|
const organized = parseDateTimeLike(requireString(s));
|
|
5422
|
-
return organized || throwFailedParse(s), organized.timeZoneId ? finalizeZonedDateTime(organized, resolveCalendar, void 0) : (organized.
|
|
5459
|
+
return organized || throwFailedParse(s), organized.timeZoneId ? finalizeZonedDateTime(organized, resolveCalendar, void 0) : (organized.F && throwFailedParse(s),
|
|
5423
5460
|
finalizeDate(organized, resolveCalendar));
|
|
5424
5461
|
}
|
|
5425
5462
|
|
|
@@ -5430,7 +5467,7 @@ function parseZonedDateTime(s, resolveCalendar, options) {
|
|
|
5430
5467
|
|
|
5431
5468
|
function parsePlainDateTime(s, resolveCalendar) {
|
|
5432
5469
|
const organized = parseDateTimeLike(requireString(s));
|
|
5433
|
-
return organized && !organized.
|
|
5470
|
+
return organized && !organized.F || throwFailedParse(s), finalizeDateTime(organized, resolveCalendar);
|
|
5434
5471
|
}
|
|
5435
5472
|
|
|
5436
5473
|
function parsePlainDate(s, resolveCalendar) {
|
|
@@ -5475,7 +5512,7 @@ function parsePlainTime(s) {
|
|
|
5475
5512
|
})(s = requireString(s));
|
|
5476
5513
|
if (!organized) {
|
|
5477
5514
|
const dateTime = parseDateTimeLike(s);
|
|
5478
|
-
dateTime && dateTime.
|
|
5515
|
+
dateTime && dateTime.te || throwFailedParse(s), dateTime.F && throwRangeError(invalidSubstring("Z")),
|
|
5479
5516
|
requireIsoCalendar(dateTime), organized = dateTime;
|
|
5480
5517
|
}
|
|
5481
5518
|
let altParsed;
|
|
@@ -5527,17 +5564,17 @@ function parseCalendarId(s) {
|
|
|
5527
5564
|
|
|
5528
5565
|
function parseTimeZoneId(s) {
|
|
5529
5566
|
const parsed = parseDateTimeLike(s);
|
|
5530
|
-
return parsed && (parsed.timeZoneId || parsed.
|
|
5567
|
+
return parsed && (parsed.timeZoneId || parsed.F && "UTC" || parsed.offset) || s;
|
|
5531
5568
|
}
|
|
5532
5569
|
|
|
5533
5570
|
function parsePlainDateLike(s) {
|
|
5534
5571
|
const organized = parseDateTimeLike(s);
|
|
5535
|
-
return organized && !organized.
|
|
5572
|
+
return organized && !organized.F || throwFailedParse(s), organized;
|
|
5536
5573
|
}
|
|
5537
5574
|
|
|
5538
5575
|
function finalizeDateLike(organized, isoDateProjector, resolveCalendar) {
|
|
5539
5576
|
return isoDateProjector && "iso8601" === organized.calendarId ? (validateIsoDateFields(organized),
|
|
5540
|
-
organized.
|
|
5577
|
+
organized.te && validateTimeFields(organized), finalizeDate(isoDateProjector(organized), resolveCalendar)) : organized.te ? finalizeDateTime(organized, resolveCalendar) : finalizeDate(organized, resolveCalendar);
|
|
5541
5578
|
}
|
|
5542
5579
|
|
|
5543
5580
|
function projectIsoYearMonthDate(organized) {
|
|
@@ -5558,11 +5595,11 @@ function projectIsoMonthDayDate(organized) {
|
|
|
5558
5595
|
function finalizeZonedDateTime(organized, resolveCalendar, options) {
|
|
5559
5596
|
const timeZone = queryTimeZone(resolveTimeZoneId(organized.timeZoneId));
|
|
5560
5597
|
let epochNano;
|
|
5561
|
-
if (validateIsoDateTimeFields(organized), organized.
|
|
5598
|
+
if (validateIsoDateTimeFields(organized), organized.te) {
|
|
5562
5599
|
const offsetNano = organized.offset ? parseOffsetNano(organized.offset) : void 0;
|
|
5563
5600
|
const [, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options);
|
|
5564
|
-
epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone.
|
|
5565
|
-
offset.replace(/\D/g, "").length > 4)), organized.
|
|
5601
|
+
epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone.Z || void 0 === organized.offset || (offset = organized.offset,
|
|
5602
|
+
offset.replace(/\D/g, "").length > 4)), organized.F);
|
|
5566
5603
|
} else {
|
|
5567
5604
|
refineZonedFieldOptions(options), epochNano = getStartOfDayInstantFor(timeZone, organized);
|
|
5568
5605
|
}
|
|
@@ -5616,8 +5653,8 @@ function parseDateTimeLike(s) {
|
|
|
5616
5653
|
day: parseInt(parts[6]),
|
|
5617
5654
|
...organizeTimeParts(parts, 7),
|
|
5618
5655
|
...organizeAnnotationParts(parts[19]),
|
|
5619
|
-
|
|
5620
|
-
|
|
5656
|
+
te: Boolean(parts[7]),
|
|
5657
|
+
F: hasZ,
|
|
5621
5658
|
offset: hasZ ? void 0 : zOrOffset
|
|
5622
5659
|
};
|
|
5623
5660
|
})(parts) : void 0;
|
|
@@ -5687,7 +5724,7 @@ function organizeAnnotationParts(s) {
|
|
|
5687
5724
|
function mergeCalendarFields(calendar, baseFields, additionalFields) {
|
|
5688
5725
|
const merged = Object.assign(Object.create(null), baseFields);
|
|
5689
5726
|
return spliceFields(merged, additionalFields, monthFieldNames), getCalendarEraOrigins(calendar) && (spliceFields(merged, additionalFields, allYearFieldNames),
|
|
5690
|
-
calendar && calendar.
|
|
5727
|
+
calendar && calendar.je && spliceFields(merged, additionalFields, monthDayFieldNames, eraYearFieldNames)),
|
|
5691
5728
|
merged;
|
|
5692
5729
|
}
|
|
5693
5730
|
|
|
@@ -5704,8 +5741,7 @@ function spliceFields(dest, additional, allPropNames, deletablePropNames) {
|
|
|
5704
5741
|
}
|
|
5705
5742
|
}
|
|
5706
5743
|
|
|
5707
|
-
function mergeZonedDateTimeFields(zonedDateTimeSlots, modFields
|
|
5708
|
-
const {calendar: calendar, timeZone: timeZone} = zonedDateTimeSlots;
|
|
5744
|
+
function mergeZonedDateTimeFields(calendar, zonedDateTimeSlots, modFields) {
|
|
5709
5745
|
const validFieldNames = getCalendarFieldNames(calendar, dateTimeAndOffsetFieldNamesAlpha, dateTimeAndOffsetFieldNamesWithEraAlpha);
|
|
5710
5746
|
const zonedSlots = zonedEpochSlotsToIso(zonedDateTimeSlots);
|
|
5711
5747
|
const {year: year, month: month, day: day} = computeCalendarDateFields(calendar, zonedSlots);
|
|
@@ -5723,16 +5759,13 @@ function mergeZonedDateTimeFields(zonedDateTimeSlots, modFields, options) {
|
|
|
5723
5759
|
};
|
|
5724
5760
|
const partialFields = readAndRefineBagFields(modFields, validFieldNames, zonedDateTimeFieldRefiners);
|
|
5725
5761
|
const mergedCalendarFields = mergeCalendarFields(calendar, origFields, partialFields);
|
|
5726
|
-
|
|
5762
|
+
return [ {
|
|
5727
5763
|
...origFields,
|
|
5728
5764
|
...partialFields
|
|
5729
|
-
};
|
|
5730
|
-
const [isoDateFields, overflow, offsetDisambig, epochDisambig] = createPlainDateFromFieldsWithOptionsRefiner(calendar, mergedCalendarFields, () => refineZonedFieldOptions(options, 2));
|
|
5731
|
-
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(isoDateFields, constrainTimeFields(mergedAllFields, overflow)), mergedAllFields.offset, offsetDisambig, epochDisambig), timeZone, calendar);
|
|
5765
|
+
}, mergedCalendarFields ];
|
|
5732
5766
|
}
|
|
5733
5767
|
|
|
5734
|
-
function
|
|
5735
|
-
const {calendar: calendar} = plainDateTimeSlots;
|
|
5768
|
+
function mergeDateTimeFields(calendar, plainDateTimeSlots, modFields) {
|
|
5736
5769
|
const validFieldNames = getCalendarFieldNames(calendar, dateTimeFieldNamesAlpha, dateTimeFieldNamesWithEraAlpha);
|
|
5737
5770
|
const {year: year, month: month, day: day} = computeCalendarDateFields(calendar, plainDateTimeSlots);
|
|
5738
5771
|
const origFields = {
|
|
@@ -5748,50 +5781,54 @@ function mergePlainDateTimeFields(plainDateTimeSlots, modFields, options) {
|
|
|
5748
5781
|
};
|
|
5749
5782
|
const partialFields = readAndRefineBagFields(modFields, validFieldNames, dateTimeFieldRefiners);
|
|
5750
5783
|
const mergedCalendarFields = mergeCalendarFields(calendar, origFields, partialFields);
|
|
5751
|
-
|
|
5784
|
+
return [ {
|
|
5752
5785
|
...origFields,
|
|
5753
5786
|
...partialFields
|
|
5754
|
-
};
|
|
5755
|
-
const [plainDateSlots, overflow] = createPlainDateFromFieldsWithOptionsRefiner(calendar, mergedCalendarFields, () => [ refineOverflowOptions(options) ]);
|
|
5756
|
-
return createPlainDateTimeFromRefinedFields(plainDateSlots, constrainTimeFields(mergedAllFields, overflow), calendar);
|
|
5787
|
+
}, mergedCalendarFields ];
|
|
5757
5788
|
}
|
|
5758
5789
|
|
|
5759
|
-
function
|
|
5760
|
-
const {calendar: calendar} = plainDateSlots;
|
|
5790
|
+
function mergeDateFields(calendar, plainDateSlots, modFields) {
|
|
5761
5791
|
const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
|
|
5762
5792
|
const {year: year, month: month, day: day} = computeCalendarDateFields(calendar, plainDateSlots);
|
|
5763
|
-
return
|
|
5793
|
+
return mergeCalendarFields(calendar, {
|
|
5764
5794
|
year: year,
|
|
5765
5795
|
monthCode: computeMonthCode(calendar, year, month),
|
|
5766
5796
|
day: day
|
|
5767
|
-
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners))
|
|
5797
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners));
|
|
5768
5798
|
}
|
|
5769
5799
|
|
|
5770
|
-
function
|
|
5771
|
-
const {calendar: calendar} = plainYearMonthSlots;
|
|
5800
|
+
function mergeYearMonthFields(calendar, plainYearMonthSlots, modFields) {
|
|
5772
5801
|
const validFieldNames = getCalendarFieldNames(calendar, yearMonthFieldNamesAlpha, yearMonthFieldNamesWithEraAlpha);
|
|
5773
5802
|
const {year: year, month: month} = computeCalendarDateFields(calendar, plainYearMonthSlots);
|
|
5774
|
-
return
|
|
5803
|
+
return mergeCalendarFields(calendar, {
|
|
5775
5804
|
year: year,
|
|
5776
5805
|
monthCode: computeMonthCode(calendar, year, month)
|
|
5777
|
-
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners))
|
|
5806
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners));
|
|
5778
5807
|
}
|
|
5779
5808
|
|
|
5780
|
-
function
|
|
5781
|
-
const {calendar: calendar} = plainMonthDaySlots;
|
|
5809
|
+
function mergeMonthDayFields(calendar, plainMonthDaySlots, modFields) {
|
|
5782
5810
|
const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
|
|
5783
5811
|
const {year: year, month: month, day: day} = computeCalendarDateFields(calendar, plainMonthDaySlots);
|
|
5784
|
-
return
|
|
5812
|
+
return mergeCalendarFields(calendar, {
|
|
5785
5813
|
monthCode: computeMonthCode(calendar, year, month),
|
|
5786
5814
|
day: day
|
|
5787
|
-
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners))
|
|
5815
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners));
|
|
5816
|
+
}
|
|
5817
|
+
|
|
5818
|
+
function createZonedDateTimeFromMergedFields(zonedDateTimeSlots, mergedAllFields, calendarFields, year, monthCodeParts, overflow, offsetDisambig, epochDisambig) {
|
|
5819
|
+
const {calendar: calendar, timeZone: timeZone} = zonedDateTimeSlots;
|
|
5820
|
+
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(createDateFromRefinedFields(calendarFields, calendar, year, monthCodeParts, overflow), constrainTimeFields(mergedAllFields, overflow)), mergedAllFields.offset, offsetDisambig, epochDisambig), timeZone, calendar);
|
|
5788
5821
|
}
|
|
5789
5822
|
|
|
5790
|
-
function
|
|
5791
|
-
return ((
|
|
5823
|
+
function createDateTimeFromMergedFields(mergedAllFields, calendarFields, calendar, year, monthCodeParts, overflow) {
|
|
5824
|
+
return createDateTimeFromRefinedFields(createDateFromRefinedFields(calendarFields, calendar, year, monthCodeParts, overflow), constrainTimeFields(mergedAllFields, overflow), calendar);
|
|
5825
|
+
}
|
|
5826
|
+
|
|
5827
|
+
function mergeTimeFields(initialFields, modFields) {
|
|
5828
|
+
return {
|
|
5792
5829
|
...pluckProps(timeFieldNamesAlpha, initialFields),
|
|
5793
5830
|
...readAndRefineBagFields(modFields, timeFieldNamesAlpha, timeFieldRefiners)
|
|
5794
|
-
}
|
|
5831
|
+
};
|
|
5795
5832
|
}
|
|
5796
5833
|
|
|
5797
5834
|
function mergeDurationFields(slots, fields) {
|
|
@@ -5807,6 +5844,30 @@ function computeMonthCode(calendar, year, month) {
|
|
|
5807
5844
|
return formatMonthCode(monthCodeNumber, isLeapMonth);
|
|
5808
5845
|
}
|
|
5809
5846
|
|
|
5847
|
+
function totalDuration(refineRelativeTo, slots, options) {
|
|
5848
|
+
const [totalUnit, relativeToSlots] = refineTotalOptions(options, refineRelativeTo);
|
|
5849
|
+
const maxDurationUnit = getMaxDurationUnit(slots);
|
|
5850
|
+
const maxUnit = Math.max(totalUnit, maxDurationUnit);
|
|
5851
|
+
const isZoned = relativeToSlots && isZonedEpochSlots(relativeToSlots);
|
|
5852
|
+
if (!relativeToSlots && isUniformUnit(maxUnit, isZoned)) {
|
|
5853
|
+
return totalDayTimeDuration(slots, totalUnit);
|
|
5854
|
+
}
|
|
5855
|
+
if (relativeToSlots || throwRangeError("Missing relativeTo"), !slots.sign && (!isZoned || totalUnit < 6)) {
|
|
5856
|
+
return 0;
|
|
5857
|
+
}
|
|
5858
|
+
const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, totalUnit);
|
|
5859
|
+
return isUniformUnit(totalUnit, isZoned) ? totalDayTimeDuration(balancedDuration, totalUnit) : ((durationFields, endEpochNano, totalUnit, relativeOps) => {
|
|
5860
|
+
const fieldName = durationFieldNamesAsc[totalUnit];
|
|
5861
|
+
const baseDurationFields = clearDurationFields(totalUnit, durationFields);
|
|
5862
|
+
return totalRelativeUnit(durationFields[fieldName], computeDurationSign(durationFields) || 1, endEpochNano, value => (baseDurationFields[fieldName] = value,
|
|
5863
|
+
moveRelativeMarkerToEpochNano(relativeOps, baseDurationFields)));
|
|
5864
|
+
})(balancedDuration, endEpochNano, totalUnit, relativeOps);
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
function totalDayTimeDuration(durationFields, totalUnit) {
|
|
5868
|
+
return divideBigNanoToExactNumber(durationDayTimeToBigNano(durationFields), unitNanoMap[totalUnit]);
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5810
5871
|
function instantToZonedDateTime(instantSlots, timeZone, calendar) {
|
|
5811
5872
|
return createZonedEpochNanoSlots(instantSlots.epochNanoseconds, timeZone, calendar);
|
|
5812
5873
|
}
|
|
@@ -5815,55 +5876,55 @@ function zonedDateTimeToInstant(zonedDateTimeSlots0) {
|
|
|
5815
5876
|
return createEpochNanoSlots(zonedDateTimeSlots0.epochNanoseconds);
|
|
5816
5877
|
}
|
|
5817
5878
|
|
|
5818
|
-
function
|
|
5879
|
+
function zonedDateTimeToDateTime(zonedDateTimeSlots0) {
|
|
5819
5880
|
return createDateTimeSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0), zonedDateTimeSlots0.calendar);
|
|
5820
5881
|
}
|
|
5821
5882
|
|
|
5822
|
-
function
|
|
5883
|
+
function zonedDateTimeToDate(zonedDateTimeSlots0) {
|
|
5823
5884
|
return createDateSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0), zonedDateTimeSlots0.calendar);
|
|
5824
5885
|
}
|
|
5825
5886
|
|
|
5826
|
-
function
|
|
5887
|
+
function zonedDateTimeToTime(zonedDateTimeSlots0) {
|
|
5827
5888
|
return createTimeSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0));
|
|
5828
5889
|
}
|
|
5829
5890
|
|
|
5830
|
-
function
|
|
5831
|
-
|
|
5832
|
-
return createZonedEpochNanoSlots(checkEpochNanoInBounds(epochNano), timeZone, plainDateTimeSlots.calendar);
|
|
5891
|
+
function dateTimeToZonedDateTime(plainDateTimeSlots, timeZone, epochDisambig) {
|
|
5892
|
+
return createZonedEpochNanoSlots(checkEpochNanoInBounds(getSingleInstantFor(timeZone, plainDateTimeSlots, epochDisambig)), timeZone, plainDateTimeSlots.calendar);
|
|
5833
5893
|
}
|
|
5834
5894
|
|
|
5835
|
-
function
|
|
5836
|
-
const timeZoneId = refineTimeZoneString(options.timeZone);
|
|
5837
|
-
const plainTimeArg = options.plainTime;
|
|
5838
|
-
const timeFields = void 0 !== plainTimeArg ? refinePlainTimeArg(plainTimeArg) : void 0;
|
|
5839
|
-
const timeZone = queryTimeZone(timeZoneId);
|
|
5895
|
+
function dateToZonedDateTime(plainDateSlots, timeZone, timeFields) {
|
|
5840
5896
|
let epochNano;
|
|
5841
5897
|
return epochNano = timeFields ? getSingleInstantFor(timeZone, combineDateAndTime(plainDateSlots, timeFields)) : getStartOfDayInstantFor(timeZone, combineDateAndTime(plainDateSlots, timeFieldDefaults)),
|
|
5842
5898
|
createZonedEpochNanoSlots(epochNano, timeZone, plainDateSlots.calendar);
|
|
5843
5899
|
}
|
|
5844
5900
|
|
|
5845
|
-
function
|
|
5846
|
-
return
|
|
5901
|
+
function yearMonthToDate(calendar, input, bag) {
|
|
5902
|
+
return mergeFieldsIntoDate(calendar, pluckProps(getCalendarFieldNames(calendar, yearMonthCodeFieldNamesAlpha, yearMonthCodeFieldNamesWithEraAlpha), input), readAndRefineBagFields(requireObjectLike(bag), dayFieldNamesAsc, dateFieldRefiners, []));
|
|
5847
5903
|
}
|
|
5848
5904
|
|
|
5849
|
-
function
|
|
5905
|
+
function monthDayToDate(calendar, input, bag) {
|
|
5850
5906
|
const extraFieldNames = getCalendarFieldNames(calendar, yearFieldNamesAsc, yearFieldNamesWithEraAlpha);
|
|
5851
|
-
return
|
|
5907
|
+
return mergeFieldsIntoDate(calendar, pluckProps(monthCodeDayFieldNamesAlpha, input), readAndRefineBagFields(requireObjectLike(bag), extraFieldNames, dateFieldRefiners, []));
|
|
5852
5908
|
}
|
|
5853
5909
|
|
|
5854
|
-
function
|
|
5855
|
-
|
|
5910
|
+
function fieldsToMonthDay(calendar, input) {
|
|
5911
|
+
const refinedFields = readAndRefineBagFields(input, monthCodeDayFieldNamesAlpha, dateFieldRefiners);
|
|
5912
|
+
const [year, monthCodeParts] = refineMonthDayFields(refinedFields, calendar);
|
|
5913
|
+
return createMonthDayFromRefinedFields(refinedFields, calendar, year, monthCodeParts, 0);
|
|
5856
5914
|
}
|
|
5857
5915
|
|
|
5858
|
-
function
|
|
5859
|
-
|
|
5916
|
+
function fieldsToYearMonth(calendar, input) {
|
|
5917
|
+
const refinedFields = readAndRefineBagFields(input, getCalendarFieldNames(calendar, yearMonthCodeFieldNamesAlpha, yearMonthCodeFieldNamesWithEraAlpha), dateFieldRefiners);
|
|
5918
|
+
const [year, monthCodeParts] = refineCalendarDateFields(refinedFields, calendar, 1);
|
|
5919
|
+
return createYearMonthFromRefinedFields(refinedFields, calendar, year, monthCodeParts, 0);
|
|
5860
5920
|
}
|
|
5861
5921
|
|
|
5862
|
-
function
|
|
5922
|
+
function mergeFieldsIntoDate(calendar, inputFields, extraFields) {
|
|
5863
5923
|
const mergedFieldNames = getCalendarFieldNames(calendar, yearMonthCodeDayFieldNamesAlpha, yearMonthCodeDayFieldNamesWithEraAlpha);
|
|
5864
5924
|
let mergedFields = mergeCalendarFields(calendar, inputFields, extraFields);
|
|
5865
|
-
|
|
5866
|
-
|
|
5925
|
+
mergedFields = readAndRefineBagFields(mergedFields, mergedFieldNames, dateFieldRefiners, []);
|
|
5926
|
+
const [year, monthCodeParts] = refineCalendarDateFields(mergedFields, calendar);
|
|
5927
|
+
return createDateFromRefinedFields(mergedFields, calendar, year, monthCodeParts, 0);
|
|
5867
5928
|
}
|
|
5868
5929
|
|
|
5869
5930
|
function epochMilliToInstant(epochMilli) {
|
|
@@ -6046,24 +6107,24 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
|
|
|
6046
6107
|
const resolvedOptions = baseFormat.resolvedOptions();
|
|
6047
6108
|
const copiedOptions = pluckProps(observedOptionNames, resolvedOptions);
|
|
6048
6109
|
internalsMap.set(this, {
|
|
6049
|
-
|
|
6110
|
+
$: createArgsProvider({
|
|
6050
6111
|
t: baseFormat,
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6112
|
+
Ce: resolvedOptions.locale,
|
|
6113
|
+
G: copiedOptions,
|
|
6114
|
+
Ee: transformedOptions
|
|
6054
6115
|
}),
|
|
6055
6116
|
t: baseFormat
|
|
6056
6117
|
});
|
|
6057
6118
|
}
|
|
6058
6119
|
get format() {
|
|
6059
6120
|
const internals = getInternals(this);
|
|
6060
|
-
return internals.
|
|
6061
|
-
const [format, ...rest] = internals
|
|
6121
|
+
return internals.we || (internals.we = record => {
|
|
6122
|
+
const [format, ...rest] = internals.$.A(record);
|
|
6062
6123
|
return format.format(...rest);
|
|
6063
6124
|
});
|
|
6064
6125
|
}
|
|
6065
6126
|
formatToParts(record) {
|
|
6066
|
-
const {
|
|
6127
|
+
const {$: argsProvider} = getInternals(this);
|
|
6067
6128
|
const [format, ...rest] = argsProvider.A(record);
|
|
6068
6129
|
return format.formatToParts(...rest);
|
|
6069
6130
|
}
|
|
@@ -6077,12 +6138,12 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
|
|
|
6077
6138
|
}
|
|
6078
6139
|
RawDateTimeFormat.prototype.formatRange && Object.defineProperties(prototype, createPropDescriptors({
|
|
6079
6140
|
formatRange(record0, record1) {
|
|
6080
|
-
const {
|
|
6141
|
+
const {$: argsProvider} = getInternals(this);
|
|
6081
6142
|
const [format, epochMilli0, epochMilli1] = argsProvider.v(record0, record1);
|
|
6082
6143
|
return format.formatRange(epochMilli0, epochMilli1);
|
|
6083
6144
|
},
|
|
6084
6145
|
formatRangeToParts(record0, record1) {
|
|
6085
|
-
const {
|
|
6146
|
+
const {$: argsProvider} = getInternals(this);
|
|
6086
6147
|
const [format, epochMilli0, epochMilli1] = argsProvider.v(record0, record1);
|
|
6087
6148
|
return format.formatRangeToParts(epochMilli0, epochMilli1);
|
|
6088
6149
|
}
|
|
@@ -6228,11 +6289,89 @@ const dateDerivedGetters = {
|
|
|
6228
6289
|
}
|
|
6229
6290
|
};
|
|
6230
6291
|
|
|
6231
|
-
function
|
|
6232
|
-
|
|
6292
|
+
function diffInstants(invert, instantSlots0, instantSlots1, options) {
|
|
6293
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 3, 5);
|
|
6294
|
+
return createDiffDurationSlots(invert, diffEpochNanosRounded(instantSlots0.epochNanoseconds, instantSlots1.epochNanoseconds, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6295
|
+
}
|
|
6296
|
+
|
|
6297
|
+
function diffZonedDateTimes(invert, slots0, slots1, options) {
|
|
6298
|
+
const calendar = getCommonCalendar(slots0.calendar, slots1.calendar);
|
|
6299
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 5);
|
|
6300
|
+
return createDiffDurationSlots(invert, diffZonedDateTimesRounded(calendar, slots0, slots1, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6301
|
+
}
|
|
6302
|
+
|
|
6303
|
+
function diffDateTimes(invert, plainDateTimeSlots0, plainDateTimeSlots1, options) {
|
|
6304
|
+
const calendar = getCommonCalendar(plainDateTimeSlots0.calendar, plainDateTimeSlots1.calendar);
|
|
6305
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 6);
|
|
6306
|
+
return createDiffDurationSlots(invert, diffDateTimesRounded(calendar, plainDateTimeSlots0, plainDateTimeSlots1, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6307
|
+
}
|
|
6308
|
+
|
|
6309
|
+
function diffDates(invert, plainDateSlots0, plainDateSlots1, options) {
|
|
6310
|
+
const calendar = getCommonCalendar(plainDateSlots0.calendar, plainDateSlots1.calendar);
|
|
6311
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 6, 9, 6);
|
|
6312
|
+
return createDiffDurationSlots(invert, diffDatesRounded(calendar, plainDateSlots0, plainDateSlots1, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
function diffYearMonths(invert, plainYearMonthSlots0, plainYearMonthSlots1, options) {
|
|
6316
|
+
const calendar = getCommonCalendar(plainYearMonthSlots0.calendar, plainYearMonthSlots1.calendar);
|
|
6317
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 9, 9, 8);
|
|
6318
|
+
return createDiffDurationSlots(invert, diffYearMonthsRounded(calendar, plainYearMonthSlots0, plainYearMonthSlots1, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6321
|
+
function diffTimes(invert, plainTimeSlots0, plainTimeSlots1, options) {
|
|
6322
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 5, 5);
|
|
6323
|
+
return createDiffDurationSlots(invert, diffTimesRounded(plainTimeSlots0, plainTimeSlots1, largestUnit, smallestUnit, roundingInc, roundingMode));
|
|
6324
|
+
}
|
|
6325
|
+
|
|
6326
|
+
function createDiffDurationSlots(invert, durationFields) {
|
|
6327
|
+
return createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
6328
|
+
}
|
|
6329
|
+
|
|
6330
|
+
function withDateFields(slots, modFields, options) {
|
|
6331
|
+
const {calendar: calendar} = slots;
|
|
6332
|
+
const fields = mergeDateFields(calendar, slots, modFields);
|
|
6333
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar);
|
|
6334
|
+
const overflow = refineOverflowOptions(options);
|
|
6335
|
+
return createDateFromRefinedFields(fields, calendar, year, monthCodeParts, overflow);
|
|
6336
|
+
}
|
|
6337
|
+
|
|
6338
|
+
function withDateTimeFields(slots, modFields, options) {
|
|
6339
|
+
const {calendar: calendar} = slots;
|
|
6340
|
+
const [mergedFields, calendarFields] = mergeDateTimeFields(calendar, slots, modFields);
|
|
6341
|
+
const [year, monthCodeParts] = refineCalendarDateFields(calendarFields, calendar);
|
|
6342
|
+
const overflow = refineOverflowOptions(options);
|
|
6343
|
+
return createDateTimeFromMergedFields(mergedFields, calendarFields, calendar, year, monthCodeParts, overflow);
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6346
|
+
function withYearMonthFields(slots, modFields, options) {
|
|
6347
|
+
const {calendar: calendar} = slots;
|
|
6348
|
+
const fields = mergeYearMonthFields(calendar, slots, modFields);
|
|
6349
|
+
const [year, monthCodeParts] = refineCalendarDateFields(fields, calendar, 1);
|
|
6350
|
+
const overflow = refineOverflowOptions(options);
|
|
6351
|
+
return createYearMonthFromRefinedFields(fields, calendar, year, monthCodeParts, overflow);
|
|
6352
|
+
}
|
|
6353
|
+
|
|
6354
|
+
function withMonthDayFields(slots, modFields, options) {
|
|
6355
|
+
const {calendar: calendar} = slots;
|
|
6356
|
+
const fields = mergeMonthDayFields(calendar, slots, modFields);
|
|
6357
|
+
const [year, monthCodeParts] = refineMonthDayFields(fields, calendar);
|
|
6358
|
+
const overflow = refineOverflowOptions(options);
|
|
6359
|
+
return createMonthDayFromRefinedFields(fields, calendar, year, monthCodeParts, overflow);
|
|
6360
|
+
}
|
|
6361
|
+
|
|
6362
|
+
function withTimeFields(slots, modFields, options) {
|
|
6363
|
+
const refinedFields = mergeTimeFields(slots, modFields);
|
|
6364
|
+
const overflow = refineOverflowOptions(options);
|
|
6365
|
+
return resolveTimeFields(refinedFields, overflow);
|
|
6233
6366
|
}
|
|
6234
6367
|
|
|
6235
|
-
|
|
6368
|
+
function withZonedDateTimeFields(slots, modFields, options) {
|
|
6369
|
+
const {calendar: calendar} = slots;
|
|
6370
|
+
const [mergedFields, calendarFields] = mergeZonedDateTimeFields(calendar, slots, modFields);
|
|
6371
|
+
const [year, monthCodeParts] = refineCalendarDateFields(calendarFields, calendar);
|
|
6372
|
+
const [overflow, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options, 2);
|
|
6373
|
+
return createZonedDateTimeFromMergedFields(slots, mergedFields, calendarFields, year, monthCodeParts, overflow, offsetDisambig, epochDisambig);
|
|
6374
|
+
}
|
|
6236
6375
|
|
|
6237
6376
|
function createDateTimeFormatClass(getTemporalBrandingAndSlots) {
|
|
6238
6377
|
return createDateTimeFormatShell(internals => {
|
|
@@ -6240,33 +6379,33 @@ function createDateTimeFormatClass(getTemporalBrandingAndSlots) {
|
|
|
6240
6379
|
let options;
|
|
6241
6380
|
switch (branding) {
|
|
6242
6381
|
case InstantBranding:
|
|
6243
|
-
options = transformInstantOptions(internals.
|
|
6382
|
+
options = transformInstantOptions(internals.G, 1);
|
|
6244
6383
|
break;
|
|
6245
6384
|
|
|
6246
6385
|
case PlainDateTimeBranding:
|
|
6247
|
-
options = applyPlainFormatTimeZone(transformDateTimeOptions(internals.
|
|
6386
|
+
options = applyPlainFormatTimeZone(transformDateTimeOptions(internals.G, 1));
|
|
6248
6387
|
break;
|
|
6249
6388
|
|
|
6250
6389
|
case PlainDateBranding:
|
|
6251
|
-
options = applyPlainFormatTimeZone(transformDateOptions(internals.
|
|
6390
|
+
options = applyPlainFormatTimeZone(transformDateOptions(internals.G, 1));
|
|
6252
6391
|
break;
|
|
6253
6392
|
|
|
6254
6393
|
case PlainTimeBranding:
|
|
6255
|
-
options = applyPlainFormatTimeZone(transformTimeOptions(internals.
|
|
6394
|
+
options = applyPlainFormatTimeZone(transformTimeOptions(internals.G, 1));
|
|
6256
6395
|
break;
|
|
6257
6396
|
|
|
6258
6397
|
case PlainYearMonthBranding:
|
|
6259
|
-
options = applyPlainFormatTimeZone(transformYearMonthOptions(internals.
|
|
6398
|
+
options = applyPlainFormatTimeZone(transformYearMonthOptions(internals.G, 1));
|
|
6260
6399
|
break;
|
|
6261
6400
|
|
|
6262
6401
|
case PlainMonthDayBranding:
|
|
6263
|
-
options = applyPlainFormatTimeZone(transformMonthDayOptions(internals.
|
|
6402
|
+
options = applyPlainFormatTimeZone(transformMonthDayOptions(internals.G, 1));
|
|
6264
6403
|
break;
|
|
6265
6404
|
|
|
6266
6405
|
default:
|
|
6267
6406
|
throwTypeError(invalidFormatType(branding));
|
|
6268
6407
|
}
|
|
6269
|
-
return new RawDateTimeFormat(internals.
|
|
6408
|
+
return new RawDateTimeFormat(internals.Ce, options);
|
|
6270
6409
|
});
|
|
6271
6410
|
return {
|
|
6272
6411
|
A(formattable) {
|
|
@@ -6324,7 +6463,7 @@ function checkTemporalDateTimeFormatCompatible(format, branding, slots) {
|
|
|
6324
6463
|
function temporalDateTimeToEpochMilli(branding, slots) {
|
|
6325
6464
|
switch (branding) {
|
|
6326
6465
|
case InstantBranding:
|
|
6327
|
-
return
|
|
6466
|
+
return epochNanoToMilli(slots.epochNanoseconds);
|
|
6328
6467
|
|
|
6329
6468
|
case PlainDateTimeBranding:
|
|
6330
6469
|
return isoDateTimeToEpochMilli(slots);
|
|
@@ -6373,10 +6512,10 @@ const ZonedDateTime = /*@__PURE__*/ defineTemporalClass(ZonedDateTimeBranding, c
|
|
|
6373
6512
|
return getZonedDateTimeSlots(this).timeZone.id;
|
|
6374
6513
|
}
|
|
6375
6514
|
get epochMilliseconds() {
|
|
6376
|
-
return
|
|
6515
|
+
return epochNanoToMilli(getZonedDateTimeSlots(this).epochNanoseconds);
|
|
6377
6516
|
}
|
|
6378
6517
|
get epochNanoseconds() {
|
|
6379
|
-
return
|
|
6518
|
+
return getZonedDateTimeSlots(this).epochNanoseconds;
|
|
6380
6519
|
}
|
|
6381
6520
|
get offset() {
|
|
6382
6521
|
return formatOffsetNano(zonedEpochSlotsToIso(getZonedDateTimeSlots(this)).offsetNanoseconds);
|
|
@@ -6388,7 +6527,7 @@ const ZonedDateTime = /*@__PURE__*/ defineTemporalClass(ZonedDateTimeBranding, c
|
|
|
6388
6527
|
return computeZonedHoursInDay(getZonedDateTimeSlots(this));
|
|
6389
6528
|
}
|
|
6390
6529
|
with(mod, options = void 0) {
|
|
6391
|
-
return createZonedDateTime(
|
|
6530
|
+
return createZonedDateTime(withZonedDateTimeFields(getZonedDateTimeSlots(this), validateBag(mod), options));
|
|
6392
6531
|
}
|
|
6393
6532
|
withCalendar(calendarArg) {
|
|
6394
6533
|
return createZonedDateTime({
|
|
@@ -6407,23 +6546,21 @@ const ZonedDateTime = /*@__PURE__*/ defineTemporalClass(ZonedDateTimeBranding, c
|
|
|
6407
6546
|
}
|
|
6408
6547
|
add(durationArg, options = void 0) {
|
|
6409
6548
|
const slots = getZonedDateTimeSlots(this);
|
|
6410
|
-
return createZonedDateTime(moveZonedEpochSlots(slots, toDurationSlots(durationArg), options));
|
|
6549
|
+
return createZonedDateTime(moveZonedEpochSlots(slots, toDurationSlots(durationArg), refineOverflowOptions(options)));
|
|
6411
6550
|
}
|
|
6412
6551
|
subtract(durationArg, options = void 0) {
|
|
6413
6552
|
const slots = getZonedDateTimeSlots(this);
|
|
6414
|
-
return createZonedDateTime(moveZonedEpochSlots(slots, negateDurationFields(toDurationSlots(durationArg)), options));
|
|
6553
|
+
return createZonedDateTime(moveZonedEpochSlots(slots, negateDurationFields(toDurationSlots(durationArg)), refineOverflowOptions(options)));
|
|
6415
6554
|
}
|
|
6416
6555
|
until(otherArg, options = void 0) {
|
|
6417
6556
|
const slots = getZonedDateTimeSlots(this);
|
|
6418
6557
|
const other = toZonedDateTimeSlots(otherArg);
|
|
6419
|
-
|
|
6420
|
-
return createDuration(createDurationSlots(diffZonedDateTimes(0, calendar, slots, other, options)));
|
|
6558
|
+
return createDuration(diffZonedDateTimes(0, slots, other, options));
|
|
6421
6559
|
}
|
|
6422
6560
|
since(otherArg, options = void 0) {
|
|
6423
6561
|
const slots = getZonedDateTimeSlots(this);
|
|
6424
6562
|
const other = toZonedDateTimeSlots(otherArg);
|
|
6425
|
-
|
|
6426
|
-
return createDuration(createDurationSlots(diffZonedDateTimes(1, calendar, slots, other, options)));
|
|
6563
|
+
return createDuration(diffZonedDateTimes(1, slots, other, options));
|
|
6427
6564
|
}
|
|
6428
6565
|
round(options) {
|
|
6429
6566
|
const slots = getZonedDateTimeSlots(this);
|
|
@@ -6440,18 +6577,18 @@ const ZonedDateTime = /*@__PURE__*/ defineTemporalClass(ZonedDateTimeBranding, c
|
|
|
6440
6577
|
return createInstant(zonedDateTimeToInstant(getZonedDateTimeSlots(this)));
|
|
6441
6578
|
}
|
|
6442
6579
|
toPlainDateTime() {
|
|
6443
|
-
return createPlainDateTime(
|
|
6580
|
+
return createPlainDateTime(zonedDateTimeToDateTime(getZonedDateTimeSlots(this)));
|
|
6444
6581
|
}
|
|
6445
6582
|
toPlainDate() {
|
|
6446
|
-
return createPlainDate(
|
|
6583
|
+
return createPlainDate(zonedDateTimeToDate(getZonedDateTimeSlots(this)));
|
|
6447
6584
|
}
|
|
6448
6585
|
toPlainTime() {
|
|
6449
|
-
return createPlainTime(
|
|
6586
|
+
return createPlainTime(zonedDateTimeToTime(getZonedDateTimeSlots(this)));
|
|
6450
6587
|
}
|
|
6451
6588
|
toLocaleString(locales = void 0, options = {}) {
|
|
6452
6589
|
const slots = getZonedDateTimeSlots(this);
|
|
6453
6590
|
const format = new RawDateTimeFormat(locales, applyZonedFormatTimeZone(transformZonedOptions(options), getZonedTimeZoneId(slots)));
|
|
6454
|
-
return checkResolvedCalendarCompatible(format, slots), format.format(
|
|
6591
|
+
return checkResolvedCalendarCompatible(format, slots), format.format(epochNanoToMilli(slots.epochNanoseconds));
|
|
6455
6592
|
}
|
|
6456
6593
|
toString(options = void 0) {
|
|
6457
6594
|
return formatZonedDateTimeIso(getZonedDateTimeSlots(this), options);
|
|
@@ -6461,8 +6598,8 @@ const ZonedDateTime = /*@__PURE__*/ defineTemporalClass(ZonedDateTimeBranding, c
|
|
|
6461
6598
|
}
|
|
6462
6599
|
getTimeZoneTransition(options) {
|
|
6463
6600
|
const slots = getZonedDateTimeSlots(this);
|
|
6464
|
-
const newEpochNano =
|
|
6465
|
-
return newEpochNano ? createZonedDateTime({
|
|
6601
|
+
const newEpochNano = slots.timeZone.C(slots.epochNanoseconds, refineDirectionOptions(options));
|
|
6602
|
+
return void 0 !== newEpochNano ? createZonedDateTime({
|
|
6466
6603
|
...slots,
|
|
6467
6604
|
epochNanoseconds: newEpochNano
|
|
6468
6605
|
}) : null;
|
|
@@ -6537,10 +6674,10 @@ const Instant = /*@__PURE__*/ defineTemporalClass(InstantBranding, class {
|
|
|
6537
6674
|
return compareZonedEpochSlots(toInstantSlots(a), toInstantSlots(b));
|
|
6538
6675
|
}
|
|
6539
6676
|
get epochMilliseconds() {
|
|
6540
|
-
return
|
|
6677
|
+
return epochNanoToMilli(getInstantSlots(this).epochNanoseconds);
|
|
6541
6678
|
}
|
|
6542
6679
|
get epochNanoseconds() {
|
|
6543
|
-
return
|
|
6680
|
+
return getInstantSlots(this).epochNanoseconds;
|
|
6544
6681
|
}
|
|
6545
6682
|
add(durationArg) {
|
|
6546
6683
|
const slots = getInstantSlots(this);
|
|
@@ -6569,7 +6706,7 @@ const Instant = /*@__PURE__*/ defineTemporalClass(InstantBranding, class {
|
|
|
6569
6706
|
}
|
|
6570
6707
|
toLocaleString(locales = void 0, options = {}) {
|
|
6571
6708
|
const slots = getInstantSlots(this);
|
|
6572
|
-
return new RawDateTimeFormat(locales, transformInstantOptions(options)).format(
|
|
6709
|
+
return new RawDateTimeFormat(locales, transformInstantOptions(options)).format(epochNanoToMilli(slots.epochNanoseconds));
|
|
6573
6710
|
}
|
|
6574
6711
|
toString(options = void 0) {
|
|
6575
6712
|
return formatInstantIso(refineTimeZoneArg, getInstantSlots(this), options);
|
|
@@ -6641,14 +6778,14 @@ const PlainMonthDay = /*@__PURE__*/ defineTemporalClass(PlainMonthDayBranding, c
|
|
|
6641
6778
|
return getCalendarSlotId(getPlainMonthDaySlots(this).calendar);
|
|
6642
6779
|
}
|
|
6643
6780
|
with(mod, options = void 0) {
|
|
6644
|
-
return createPlainMonthDay(
|
|
6781
|
+
return createPlainMonthDay(withMonthDayFields(getPlainMonthDaySlots(this), validateBag(mod), options));
|
|
6645
6782
|
}
|
|
6646
6783
|
equals(otherArg) {
|
|
6647
6784
|
return plainMonthDaysEqual(getPlainMonthDaySlots(this), toPlainMonthDaySlots(otherArg));
|
|
6648
6785
|
}
|
|
6649
6786
|
toPlainDate(bag) {
|
|
6650
6787
|
const slots = getPlainMonthDaySlots(this);
|
|
6651
|
-
return createPlainDate(
|
|
6788
|
+
return createPlainDate(monthDayToDate(slots.calendar, this, bag));
|
|
6652
6789
|
}
|
|
6653
6790
|
toLocaleString(locales = void 0, options = {}) {
|
|
6654
6791
|
const slots = getPlainMonthDaySlots(this);
|
|
@@ -6721,34 +6858,32 @@ const PlainYearMonth = /*@__PURE__*/ defineTemporalClass(PlainYearMonthBranding,
|
|
|
6721
6858
|
return getCalendarSlotId(getPlainYearMonthSlots(this).calendar);
|
|
6722
6859
|
}
|
|
6723
6860
|
with(mod, options = void 0) {
|
|
6724
|
-
return createPlainYearMonth(
|
|
6861
|
+
return createPlainYearMonth(withYearMonthFields(getPlainYearMonthSlots(this), validateBag(mod), options));
|
|
6725
6862
|
}
|
|
6726
6863
|
add(durationArg, options = void 0) {
|
|
6727
6864
|
const slots = getPlainYearMonthSlots(this);
|
|
6728
|
-
return createPlainYearMonth(createDateSlots(moveYearMonth(
|
|
6865
|
+
return createPlainYearMonth(createDateSlots(moveYearMonth(slots.calendar, slots, toDurationSlots(durationArg), refineOverflowOptions(options)), slots.calendar));
|
|
6729
6866
|
}
|
|
6730
6867
|
subtract(durationArg, options = void 0) {
|
|
6731
6868
|
const slots = getPlainYearMonthSlots(this);
|
|
6732
|
-
return createPlainYearMonth(createDateSlots(moveYearMonth(
|
|
6869
|
+
return createPlainYearMonth(createDateSlots(moveYearMonth(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), refineOverflowOptions(options)), slots.calendar));
|
|
6733
6870
|
}
|
|
6734
6871
|
until(otherArg, options = void 0) {
|
|
6735
6872
|
const slots = getPlainYearMonthSlots(this);
|
|
6736
6873
|
const other = toPlainYearMonthSlots(otherArg);
|
|
6737
|
-
|
|
6738
|
-
return createDuration(diffPlainYearMonth(0, calendar, slots, other, options));
|
|
6874
|
+
return createDuration(diffYearMonths(0, slots, other, options));
|
|
6739
6875
|
}
|
|
6740
6876
|
since(otherArg, options = void 0) {
|
|
6741
6877
|
const slots = getPlainYearMonthSlots(this);
|
|
6742
6878
|
const other = toPlainYearMonthSlots(otherArg);
|
|
6743
|
-
|
|
6744
|
-
return createDuration(diffPlainYearMonth(1, calendar, slots, other, options));
|
|
6879
|
+
return createDuration(diffYearMonths(1, slots, other, options));
|
|
6745
6880
|
}
|
|
6746
6881
|
equals(otherArg) {
|
|
6747
6882
|
return plainYearMonthsEqual(getPlainYearMonthSlots(this), toPlainYearMonthSlots(otherArg));
|
|
6748
6883
|
}
|
|
6749
6884
|
toPlainDate(bag) {
|
|
6750
6885
|
const slots = getPlainYearMonthSlots(this);
|
|
6751
|
-
return createPlainDate(
|
|
6886
|
+
return createPlainDate(yearMonthToDate(slots.calendar, this, bag));
|
|
6752
6887
|
}
|
|
6753
6888
|
toLocaleString(locales = void 0, options = {}) {
|
|
6754
6889
|
const slots = getPlainYearMonthSlots(this);
|
|
@@ -6837,7 +6972,7 @@ const PlainTime = /*@__PURE__*/ defineTemporalClass(PlainTimeBranding, class {
|
|
|
6837
6972
|
return compareTimeFields(toPlainTimeSlots(arg0), toPlainTimeSlots(arg1));
|
|
6838
6973
|
}
|
|
6839
6974
|
with(mod, options = void 0) {
|
|
6840
|
-
return createPlainTime(
|
|
6975
|
+
return createPlainTime(withTimeFields(getPlainTimeSlots(this), validateBag(mod), options));
|
|
6841
6976
|
}
|
|
6842
6977
|
add(durationArg) {
|
|
6843
6978
|
const slots = getPlainTimeSlots(this);
|
|
@@ -6848,15 +6983,15 @@ const PlainTime = /*@__PURE__*/ defineTemporalClass(PlainTimeBranding, class {
|
|
|
6848
6983
|
return createPlainTime(moveTime(slots, negateDurationFields(toDurationSlots(durationArg)))[0]);
|
|
6849
6984
|
}
|
|
6850
6985
|
until(otherArg, options = void 0) {
|
|
6851
|
-
return createDuration(
|
|
6986
|
+
return createDuration(diffTimes(0, getPlainTimeSlots(this), toPlainTimeSlots(otherArg), options));
|
|
6852
6987
|
}
|
|
6853
6988
|
since(otherArg, options = void 0) {
|
|
6854
|
-
return createDuration(
|
|
6989
|
+
return createDuration(diffTimes(1, getPlainTimeSlots(this), toPlainTimeSlots(otherArg), options));
|
|
6855
6990
|
}
|
|
6856
6991
|
round(options) {
|
|
6857
6992
|
const slots = getPlainTimeSlots(this);
|
|
6858
6993
|
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options, 5);
|
|
6859
|
-
return createPlainTime(
|
|
6994
|
+
return createPlainTime(roundTimeToInc(slots, computeNanoInc(smallestUnit, roundingInc), roundingMode)[0]);
|
|
6860
6995
|
}
|
|
6861
6996
|
equals(other) {
|
|
6862
6997
|
return plainTimesEqual(getPlainTimeSlots(this), toPlainTimeSlots(other));
|
|
@@ -6899,7 +7034,7 @@ function toPlainTimeSlots(arg, options) {
|
|
|
6899
7034
|
return refineOverflowOptions(options), createTimeSlots(dateTimeSlots);
|
|
6900
7035
|
}
|
|
6901
7036
|
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
6902
|
-
return zonedDateTimeSlots ? (refineOverflowOptions(options),
|
|
7037
|
+
return zonedDateTimeSlots ? (refineOverflowOptions(options), zonedDateTimeToTime(zonedDateTimeSlots)) : refinePlainTimeObjectLike(arg, options);
|
|
6903
7038
|
}
|
|
6904
7039
|
const timeSlots = parsePlainTime(arg);
|
|
6905
7040
|
return refineOverflowOptions(options), timeSlots;
|
|
@@ -6943,7 +7078,7 @@ const PlainDateTime = /*@__PURE__*/ defineTemporalClass(PlainDateTimeBranding, c
|
|
|
6943
7078
|
return getCalendarSlotId(getPlainDateTimeSlots(this).calendar);
|
|
6944
7079
|
}
|
|
6945
7080
|
with(mod, options = void 0) {
|
|
6946
|
-
return createPlainDateTime(
|
|
7081
|
+
return createPlainDateTime(withDateTimeFields(getPlainDateTimeSlots(this), validateBag(mod), options));
|
|
6947
7082
|
}
|
|
6948
7083
|
withCalendar(calendarArg) {
|
|
6949
7084
|
const slots = getPlainDateTimeSlots(this);
|
|
@@ -6951,38 +7086,36 @@ const PlainDateTime = /*@__PURE__*/ defineTemporalClass(PlainDateTimeBranding, c
|
|
|
6951
7086
|
}
|
|
6952
7087
|
withPlainTime(plainTimeArg = void 0) {
|
|
6953
7088
|
const slots = getPlainDateTimeSlots(this);
|
|
6954
|
-
return createPlainDateTime(
|
|
7089
|
+
return createPlainDateTime(createDateTimeFromRefinedFields(slots, optionalToPlainTimeFields(plainTimeArg), slots.calendar));
|
|
6955
7090
|
}
|
|
6956
7091
|
add(durationArg, options = void 0) {
|
|
6957
7092
|
const slots = getPlainDateTimeSlots(this);
|
|
6958
|
-
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
7093
|
+
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, toDurationSlots(durationArg), refineOverflowOptions(options)), slots.calendar));
|
|
6959
7094
|
}
|
|
6960
7095
|
subtract(durationArg, options = void 0) {
|
|
6961
7096
|
const slots = getPlainDateTimeSlots(this);
|
|
6962
|
-
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), options), slots.calendar));
|
|
7097
|
+
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), refineOverflowOptions(options)), slots.calendar));
|
|
6963
7098
|
}
|
|
6964
7099
|
until(otherArg, options = void 0) {
|
|
6965
7100
|
const slots = getPlainDateTimeSlots(this);
|
|
6966
7101
|
const other = toPlainDateTimeSlots(otherArg);
|
|
6967
|
-
|
|
6968
|
-
return createDuration(diffPlainDateTimes(0, calendar, slots, other, options));
|
|
7102
|
+
return createDuration(diffDateTimes(0, slots, other, options));
|
|
6969
7103
|
}
|
|
6970
7104
|
since(otherArg, options = void 0) {
|
|
6971
7105
|
const slots = getPlainDateTimeSlots(this);
|
|
6972
7106
|
const other = toPlainDateTimeSlots(otherArg);
|
|
6973
|
-
|
|
6974
|
-
return createDuration(diffPlainDateTimes(1, calendar, slots, other, options));
|
|
7107
|
+
return createDuration(diffDateTimes(1, slots, other, options));
|
|
6975
7108
|
}
|
|
6976
7109
|
round(options) {
|
|
6977
7110
|
const slots = getPlainDateTimeSlots(this);
|
|
6978
7111
|
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options);
|
|
6979
|
-
return createPlainDateTime(createDateTimeSlots(
|
|
7112
|
+
return createPlainDateTime(createDateTimeSlots(roundDateTimeToInc(slots, computeNanoInc(smallestUnit, roundingInc), roundingMode), slots.calendar));
|
|
6980
7113
|
}
|
|
6981
7114
|
equals(otherArg) {
|
|
6982
7115
|
return plainDateTimesEqual(getPlainDateTimeSlots(this), toPlainDateTimeSlots(otherArg));
|
|
6983
7116
|
}
|
|
6984
7117
|
toZonedDateTime(timeZoneArg, options = void 0) {
|
|
6985
|
-
return createZonedDateTime(
|
|
7118
|
+
return createZonedDateTime(dateTimeToZonedDateTime(getPlainDateTimeSlots(this), queryTimeZone(refineTimeZoneArg(timeZoneArg)), refineEpochDisambigOptions(options)));
|
|
6986
7119
|
}
|
|
6987
7120
|
toPlainDate() {
|
|
6988
7121
|
const slots = getPlainDateTimeSlots(this);
|
|
@@ -7031,7 +7164,7 @@ function toPlainDateTimeSlots(arg, options) {
|
|
|
7031
7164
|
}
|
|
7032
7165
|
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
7033
7166
|
if (zonedDateTimeSlots) {
|
|
7034
|
-
return refineOverflowOptions(options),
|
|
7167
|
+
return refineOverflowOptions(options), zonedDateTimeToDateTime(zonedDateTimeSlots);
|
|
7035
7168
|
}
|
|
7036
7169
|
const calendar = getCalendarFromBag(arg);
|
|
7037
7170
|
return refinePlainDateTimeObjectLike(calendar, arg, options);
|
|
@@ -7067,8 +7200,7 @@ const PlainDate = /*@__PURE__*/ defineTemporalClass(PlainDateBranding, class {
|
|
|
7067
7200
|
return getCalendarSlotId(getPlainDateSlots(this).calendar);
|
|
7068
7201
|
}
|
|
7069
7202
|
with(mod, options = void 0) {
|
|
7070
|
-
|
|
7071
|
-
return createPlainDate(mergePlainDateFields(slots, validateBag(mod), options));
|
|
7203
|
+
return createPlainDate(withDateFields(getPlainDateSlots(this), validateBag(mod), options));
|
|
7072
7204
|
}
|
|
7073
7205
|
withCalendar(calendarArg) {
|
|
7074
7206
|
const slots = getPlainDateSlots(this);
|
|
@@ -7076,23 +7208,21 @@ const PlainDate = /*@__PURE__*/ defineTemporalClass(PlainDateBranding, class {
|
|
|
7076
7208
|
}
|
|
7077
7209
|
add(durationArg, options = void 0) {
|
|
7078
7210
|
const slots = getPlainDateSlots(this);
|
|
7079
|
-
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
7211
|
+
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, toDurationSlots(durationArg), refineOverflowOptions(options)), slots.calendar));
|
|
7080
7212
|
}
|
|
7081
7213
|
subtract(durationArg, options = void 0) {
|
|
7082
7214
|
const slots = getPlainDateSlots(this);
|
|
7083
|
-
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), options), slots.calendar));
|
|
7215
|
+
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), refineOverflowOptions(options)), slots.calendar));
|
|
7084
7216
|
}
|
|
7085
7217
|
until(otherArg, options = void 0) {
|
|
7086
7218
|
const slots = getPlainDateSlots(this);
|
|
7087
7219
|
const other = toPlainDateSlots(otherArg);
|
|
7088
|
-
|
|
7089
|
-
return createDuration(diffPlainDates(0, calendar, slots, other, options));
|
|
7220
|
+
return createDuration(diffDates(0, slots, other, options));
|
|
7090
7221
|
}
|
|
7091
7222
|
since(otherArg, options = void 0) {
|
|
7092
7223
|
const slots = getPlainDateSlots(this);
|
|
7093
7224
|
const other = toPlainDateSlots(otherArg);
|
|
7094
|
-
|
|
7095
|
-
return createDuration(diffPlainDates(1, calendar, slots, other, options));
|
|
7225
|
+
return createDuration(diffDates(1, slots, other, options));
|
|
7096
7226
|
}
|
|
7097
7227
|
equals(otherArg) {
|
|
7098
7228
|
return plainDatesEqual(getPlainDateSlots(this), toPlainDateSlots(otherArg));
|
|
@@ -7104,19 +7234,23 @@ const PlainDate = /*@__PURE__*/ defineTemporalClass(PlainDateBranding, class {
|
|
|
7104
7234
|
} : {
|
|
7105
7235
|
timeZone: options
|
|
7106
7236
|
};
|
|
7107
|
-
|
|
7237
|
+
const slots = getPlainDateSlots(this);
|
|
7238
|
+
const timeZoneId = refineTimeZoneArg(optionsObj.timeZone);
|
|
7239
|
+
const plainTimeArg = optionsObj.plainTime;
|
|
7240
|
+
const timeFields = void 0 !== plainTimeArg ? toPlainTimeSlots(plainTimeArg) : void 0;
|
|
7241
|
+
return createZonedDateTime(dateToZonedDateTime(slots, queryTimeZone(timeZoneId), timeFields));
|
|
7108
7242
|
}
|
|
7109
7243
|
toPlainDateTime(plainTimeArg = void 0) {
|
|
7110
7244
|
const slots = getPlainDateSlots(this);
|
|
7111
|
-
return createPlainDateTime(
|
|
7245
|
+
return createPlainDateTime(createDateTimeFromRefinedFields(slots, optionalToPlainTimeFields(plainTimeArg), slots.calendar));
|
|
7112
7246
|
}
|
|
7113
7247
|
toPlainYearMonth() {
|
|
7114
7248
|
const slots = getPlainDateSlots(this);
|
|
7115
|
-
return createPlainYearMonth(
|
|
7249
|
+
return createPlainYearMonth(fieldsToYearMonth(slots.calendar, this));
|
|
7116
7250
|
}
|
|
7117
7251
|
toPlainMonthDay() {
|
|
7118
7252
|
const slots = getPlainDateSlots(this);
|
|
7119
|
-
return createPlainMonthDay(
|
|
7253
|
+
return createPlainMonthDay(fieldsToMonthDay(slots.calendar, this));
|
|
7120
7254
|
}
|
|
7121
7255
|
toLocaleString(locales = void 0, options = {}) {
|
|
7122
7256
|
const slots = getPlainDateSlots(this);
|
|
@@ -7158,7 +7292,7 @@ function toPlainDateSlots(arg, options) {
|
|
|
7158
7292
|
}
|
|
7159
7293
|
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
7160
7294
|
if (zonedDateTimeSlots) {
|
|
7161
|
-
return refineOverflowOptions(options),
|
|
7295
|
+
return refineOverflowOptions(options), zonedDateTimeToDate(zonedDateTimeSlots);
|
|
7162
7296
|
}
|
|
7163
7297
|
const calendar = getCalendarFromBag(arg);
|
|
7164
7298
|
return refinePlainDateObjectLike(calendar, arg, options);
|
|
@@ -7230,11 +7364,11 @@ const Duration = /*@__PURE__*/ defineTemporalClass(DurationBranding, class {
|
|
|
7230
7364
|
abs() {
|
|
7231
7365
|
return createDuration(absDuration(getDurationSlots(this)));
|
|
7232
7366
|
}
|
|
7233
|
-
add(otherArg
|
|
7234
|
-
return createDuration(
|
|
7367
|
+
add(otherArg) {
|
|
7368
|
+
return createDuration(addDurationsWithoutRelativeTo(0, getDurationSlots(this), toDurationSlots(otherArg)));
|
|
7235
7369
|
}
|
|
7236
|
-
subtract(otherArg
|
|
7237
|
-
return createDuration(
|
|
7370
|
+
subtract(otherArg) {
|
|
7371
|
+
return createDuration(addDurationsWithoutRelativeTo(1, getDurationSlots(this), toDurationSlots(otherArg)));
|
|
7238
7372
|
}
|
|
7239
7373
|
round(roundTo) {
|
|
7240
7374
|
return createDuration(roundDuration(refinePublicRelativeTo, getDurationSlots(this), roundTo));
|
|
@@ -11517,14 +11651,14 @@ const Kislev = months.KISLEV;
|
|
|
11517
11651
|
const Shvat = months.SHVAT;
|
|
11518
11652
|
const Adar2 = months.ADAR_II;
|
|
11519
11653
|
const CHAG$1 = flags.CHAG;
|
|
11520
|
-
const LIGHT_CANDLES$
|
|
11654
|
+
const LIGHT_CANDLES$2 = flags.LIGHT_CANDLES;
|
|
11521
11655
|
const YOM_TOV_ENDS$1 = flags.YOM_TOV_ENDS;
|
|
11522
11656
|
const CHUL_ONLY$1 = flags.CHUL_ONLY;
|
|
11523
11657
|
const IL_ONLY$2 = flags.IL_ONLY;
|
|
11524
11658
|
const LIGHT_CANDLES_TZEIS$3 = flags.LIGHT_CANDLES_TZEIS;
|
|
11525
11659
|
const MAJOR_FAST$2 = flags.MAJOR_FAST;
|
|
11526
11660
|
const MINOR_HOLIDAY$2 = flags.MINOR_HOLIDAY;
|
|
11527
|
-
const EREV$
|
|
11661
|
+
const EREV$2 = flags.EREV;
|
|
11528
11662
|
const CHOL_HAMOED$1 = flags.CHOL_HAMOED;
|
|
11529
11663
|
const emojiPesach = '🫓';
|
|
11530
11664
|
const emojiSukkot = '🌿🍋';
|
|
@@ -11760,7 +11894,7 @@ const staticHolidays = [
|
|
|
11760
11894
|
flags: CHAG$1 | YOM_TOV_ENDS$1,
|
|
11761
11895
|
emoji: '🍏🍯',
|
|
11762
11896
|
},
|
|
11763
|
-
{ mm: Tishrei, dd: 9, desc: EREV_YOM_KIPPUR, flags: EREV$
|
|
11897
|
+
{ mm: Tishrei, dd: 9, desc: EREV_YOM_KIPPUR, flags: EREV$2 | LIGHT_CANDLES$2 },
|
|
11764
11898
|
{
|
|
11765
11899
|
mm: Tishrei,
|
|
11766
11900
|
dd: 10,
|
|
@@ -11771,7 +11905,7 @@ const staticHolidays = [
|
|
|
11771
11905
|
mm: Tishrei,
|
|
11772
11906
|
dd: 14,
|
|
11773
11907
|
desc: EREV_SUKKOT,
|
|
11774
|
-
flags: CHUL_ONLY$1 | EREV$
|
|
11908
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$2,
|
|
11775
11909
|
emoji: emojiSukkot,
|
|
11776
11910
|
},
|
|
11777
11911
|
{
|
|
@@ -11836,7 +11970,7 @@ const staticHolidays = [
|
|
|
11836
11970
|
mm: Tishrei,
|
|
11837
11971
|
dd: 14,
|
|
11838
11972
|
desc: EREV_SUKKOT,
|
|
11839
|
-
flags: IL_ONLY$2 | EREV$
|
|
11973
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$2,
|
|
11840
11974
|
emoji: emojiSukkot,
|
|
11841
11975
|
},
|
|
11842
11976
|
{
|
|
@@ -11896,7 +12030,7 @@ const staticHolidays = [
|
|
|
11896
12030
|
mm: Tishrei,
|
|
11897
12031
|
dd: 21,
|
|
11898
12032
|
desc: SUKKOT_VII_HOSHANA_RABA,
|
|
11899
|
-
flags: LIGHT_CANDLES$
|
|
12033
|
+
flags: LIGHT_CANDLES$2 | CHOL_HAMOED$1,
|
|
11900
12034
|
chmDay: -1,
|
|
11901
12035
|
emoji: emojiSukkot,
|
|
11902
12036
|
},
|
|
@@ -11905,7 +12039,7 @@ const staticHolidays = [
|
|
|
11905
12039
|
mm: Adar2,
|
|
11906
12040
|
dd: 13,
|
|
11907
12041
|
desc: EREV_PURIM,
|
|
11908
|
-
flags: EREV$
|
|
12042
|
+
flags: EREV$2 | MINOR_HOLIDAY$2,
|
|
11909
12043
|
emoji: '🎭️📜',
|
|
11910
12044
|
},
|
|
11911
12045
|
{ mm: Adar2, dd: 14, desc: PURIM, flags: MINOR_HOLIDAY$2, emoji: '🎭️📜' },
|
|
@@ -11921,7 +12055,7 @@ const staticHolidays = [
|
|
|
11921
12055
|
mm: Nisan,
|
|
11922
12056
|
dd: 14,
|
|
11923
12057
|
desc: EREV_PESACH,
|
|
11924
|
-
flags: IL_ONLY$2 | EREV$
|
|
12058
|
+
flags: IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$2,
|
|
11925
12059
|
emoji: '🫓🍷',
|
|
11926
12060
|
},
|
|
11927
12061
|
{
|
|
@@ -11967,7 +12101,7 @@ const staticHolidays = [
|
|
|
11967
12101
|
mm: Nisan,
|
|
11968
12102
|
dd: 20,
|
|
11969
12103
|
desc: PESACH_VI_CHM,
|
|
11970
|
-
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$
|
|
12104
|
+
flags: IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$2,
|
|
11971
12105
|
chmDay: 5,
|
|
11972
12106
|
emoji: emojiPesach,
|
|
11973
12107
|
},
|
|
@@ -11983,7 +12117,7 @@ const staticHolidays = [
|
|
|
11983
12117
|
mm: Nisan,
|
|
11984
12118
|
dd: 14,
|
|
11985
12119
|
desc: EREV_PESACH,
|
|
11986
|
-
flags: CHUL_ONLY$1 | EREV$
|
|
12120
|
+
flags: CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$2,
|
|
11987
12121
|
emoji: '🫓🍷',
|
|
11988
12122
|
},
|
|
11989
12123
|
{
|
|
@@ -12028,7 +12162,7 @@ const staticHolidays = [
|
|
|
12028
12162
|
mm: Nisan,
|
|
12029
12163
|
dd: 20,
|
|
12030
12164
|
desc: PESACH_VI_CHM,
|
|
12031
|
-
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$
|
|
12165
|
+
flags: CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$2,
|
|
12032
12166
|
chmDay: 4,
|
|
12033
12167
|
emoji: emojiPesach,
|
|
12034
12168
|
},
|
|
@@ -12052,7 +12186,7 @@ const staticHolidays = [
|
|
|
12052
12186
|
mm: Sivan,
|
|
12053
12187
|
dd: 5,
|
|
12054
12188
|
desc: EREV_SHAVUOT,
|
|
12055
|
-
flags: EREV$
|
|
12189
|
+
flags: EREV$2 | LIGHT_CANDLES$2,
|
|
12056
12190
|
emoji: '⛰️🌸',
|
|
12057
12191
|
},
|
|
12058
12192
|
{
|
|
@@ -12088,7 +12222,7 @@ const staticHolidays = [
|
|
|
12088
12222
|
mm: Elul,
|
|
12089
12223
|
dd: 29,
|
|
12090
12224
|
desc: EREV_ROSH_HASHANA,
|
|
12091
|
-
flags: EREV$
|
|
12225
|
+
flags: EREV$2 | LIGHT_CANDLES$2,
|
|
12092
12226
|
emoji: '🍏🍯',
|
|
12093
12227
|
},
|
|
12094
12228
|
];
|
|
@@ -12200,7 +12334,7 @@ class HolidayEvent extends Event {
|
|
|
12200
12334
|
urlFriendly(this.basename()) +
|
|
12201
12335
|
'-' +
|
|
12202
12336
|
this.urlDateSuffix();
|
|
12203
|
-
return this.
|
|
12337
|
+
return this.hasFlag('IL_ONLY') ? url + '?i=on' : url;
|
|
12204
12338
|
}
|
|
12205
12339
|
/**
|
|
12206
12340
|
* The date portion of {@link url}. For most holidays this is just the
|
|
@@ -12214,7 +12348,7 @@ class HolidayEvent extends Event {
|
|
|
12214
12348
|
if (this.emoji) {
|
|
12215
12349
|
return this.emoji;
|
|
12216
12350
|
}
|
|
12217
|
-
if (this.
|
|
12351
|
+
if (this.hasFlag('SPECIAL_SHABBAT')) {
|
|
12218
12352
|
return '🕍';
|
|
12219
12353
|
}
|
|
12220
12354
|
return '✡️';
|
|
@@ -12457,7 +12591,7 @@ const SPECIAL_SHABBAT$1 = flags.SPECIAL_SHABBAT;
|
|
|
12457
12591
|
const MODERN_HOLIDAY$1 = flags.MODERN_HOLIDAY;
|
|
12458
12592
|
const MAJOR_FAST$1 = flags.MAJOR_FAST;
|
|
12459
12593
|
const MINOR_HOLIDAY$1 = flags.MINOR_HOLIDAY;
|
|
12460
|
-
const EREV$
|
|
12594
|
+
const EREV$1 = flags.EREV;
|
|
12461
12595
|
const SUN = 0;
|
|
12462
12596
|
const TUE = 2;
|
|
12463
12597
|
const THU = 4;
|
|
@@ -12500,7 +12634,7 @@ function getHolidaysForYear_(year) {
|
|
|
12500
12634
|
const key = ev.date.toString();
|
|
12501
12635
|
const arr = map.get(key);
|
|
12502
12636
|
if (typeof arr === 'object') {
|
|
12503
|
-
if (arr[0].
|
|
12637
|
+
if (arr[0].hasFlag('EREV')) {
|
|
12504
12638
|
arr.unshift(ev);
|
|
12505
12639
|
}
|
|
12506
12640
|
else {
|
|
@@ -12533,7 +12667,7 @@ function getHolidaysForYear_(year) {
|
|
|
12533
12667
|
? new HDate(1, TEVET, year)
|
|
12534
12668
|
: new HDate(30, KISLEV, year);
|
|
12535
12669
|
add(new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1));
|
|
12536
|
-
add(new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV$
|
|
12670
|
+
add(new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV$1 | MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, undefined));
|
|
12537
12671
|
// yes, we know Kislev 30-32 are wrong
|
|
12538
12672
|
// HDate() corrects the month automatically
|
|
12539
12673
|
for (let candles = 2; candles <= 8; candles++) {
|
|
@@ -12603,7 +12737,7 @@ function getHolidaysForYear_(year) {
|
|
|
12603
12737
|
av9title += ' (observed)';
|
|
12604
12738
|
}
|
|
12605
12739
|
const av9abs = av9dt.abs();
|
|
12606
|
-
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, av9abs)), holidayDesc.SHABBAT_CHAZON, SPECIAL_SHABBAT$1), new HolidayEvent(av9dt.prev(), holidayDesc.EREV_TISHA_BAV, EREV$
|
|
12740
|
+
add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, av9abs)), holidayDesc.SHABBAT_CHAZON, SPECIAL_SHABBAT$1), new HolidayEvent(av9dt.prev(), holidayDesc.EREV_TISHA_BAV, EREV$1 | MAJOR_FAST$1, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST$1, av9attrs), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, av9abs + 7)), holidayDesc.SHABBAT_NACHAMU, SPECIAL_SHABBAT$1));
|
|
12607
12741
|
const monthsInYear = HDate.monthsInYear(year);
|
|
12608
12742
|
for (let month = 1; month <= monthsInYear; month++) {
|
|
12609
12743
|
const monthName = HDate.getMonthName(month, year);
|
|
@@ -12718,12 +12852,11 @@ function getHolidaysForYearArray(year, il) {
|
|
|
12718
12852
|
return events;
|
|
12719
12853
|
}
|
|
12720
12854
|
|
|
12721
|
-
const LIGHT_CANDLES$2 = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;
|
|
12722
12855
|
function isTomorrowShabbosOrYomTov(dow, events) {
|
|
12723
12856
|
if (dow === 5) {
|
|
12724
12857
|
return true;
|
|
12725
12858
|
}
|
|
12726
|
-
const erev = events.find(ev => ev.
|
|
12859
|
+
const erev = events.find(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'));
|
|
12727
12860
|
if (erev) {
|
|
12728
12861
|
return true;
|
|
12729
12862
|
}
|
|
@@ -12741,7 +12874,7 @@ function isTodayAssurBemelacha(dow, events) {
|
|
|
12741
12874
|
if (dow === 6) {
|
|
12742
12875
|
return true;
|
|
12743
12876
|
}
|
|
12744
|
-
const chag = events.find(ev => ev.
|
|
12877
|
+
const chag = events.find(ev => ev.hasFlag('CHAG'));
|
|
12745
12878
|
if (chag) {
|
|
12746
12879
|
return true;
|
|
12747
12880
|
}
|
|
@@ -12856,8 +12989,6 @@ function isAveilut(date) {
|
|
|
12856
12989
|
return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);
|
|
12857
12990
|
}
|
|
12858
12991
|
|
|
12859
|
-
const FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;
|
|
12860
|
-
const EREV$1 = flags.EREV;
|
|
12861
12992
|
/**
|
|
12862
12993
|
* Returns `true` if the given date is observed as a major or minor fast day.
|
|
12863
12994
|
*
|
|
@@ -12879,10 +13010,7 @@ const EREV$1 = flags.EREV;
|
|
|
12879
13010
|
*/
|
|
12880
13011
|
function isFastDay(date, il) {
|
|
12881
13012
|
const events = getHolidaysOnDate(date, il) || [];
|
|
12882
|
-
const fastDay = events.find(ev =>
|
|
12883
|
-
const mask = ev.getFlags();
|
|
12884
|
-
return mask & FAST_DAY && !(mask & EREV$1);
|
|
12885
|
-
});
|
|
13013
|
+
const fastDay = events.find(ev => ev.hasAnyFlag('MAJOR_FAST', 'MINOR_FAST') && !ev.hasFlag('EREV'));
|
|
12886
13014
|
return Boolean(fastDay);
|
|
12887
13015
|
}
|
|
12888
13016
|
|
|
@@ -13020,14 +13148,14 @@ const LIGHT_CANDLES_TZEIS$1 = flags.LIGHT_CANDLES_TZEIS;
|
|
|
13020
13148
|
function makeCandleEvent(ev, hd, options, isFriday, isSaturday) {
|
|
13021
13149
|
let havdalahTitle = false;
|
|
13022
13150
|
let useHavdalahOffset = isSaturday;
|
|
13023
|
-
let mask = ev ? ev.
|
|
13151
|
+
let mask = ev ? ev.mask : LIGHT_CANDLES$1;
|
|
13024
13152
|
if (ev !== undefined) {
|
|
13025
13153
|
// if linked event && dow == FRI, use Candle lighting time & title
|
|
13026
13154
|
if (!isFriday) {
|
|
13027
|
-
if (
|
|
13155
|
+
if (ev.hasAnyFlag('LIGHT_CANDLES_TZEIS', 'CHANUKAH_CANDLES')) {
|
|
13028
13156
|
useHavdalahOffset = true;
|
|
13029
13157
|
}
|
|
13030
|
-
else if (
|
|
13158
|
+
else if (ev.hasFlag('YOM_TOV_ENDS')) {
|
|
13031
13159
|
havdalahTitle = true;
|
|
13032
13160
|
useHavdalahOffset = true;
|
|
13033
13161
|
}
|
|
@@ -13131,7 +13259,7 @@ function makeFastEndTime(zmanim, isTishaBav, options) {
|
|
|
13131
13259
|
*/
|
|
13132
13260
|
class FastDayEvent extends HolidayEvent {
|
|
13133
13261
|
constructor(linkedEvent, startEvent, endEvent) {
|
|
13134
|
-
super(linkedEvent.getDate(), linkedEvent.getDesc(), linkedEvent.
|
|
13262
|
+
super(linkedEvent.getDate(), linkedEvent.getDesc(), linkedEvent.mask);
|
|
13135
13263
|
this.linkedEvent = linkedEvent;
|
|
13136
13264
|
this.startEvent = startEvent;
|
|
13137
13265
|
this.endEvent = endEvent;
|
|
@@ -13207,7 +13335,7 @@ function makeFastStartEnd(ev, options) {
|
|
|
13207
13335
|
function makeTimedEvent(ev, time, desc, options) {
|
|
13208
13336
|
const location = options.location;
|
|
13209
13337
|
const hd = ev.getDate();
|
|
13210
|
-
return new TimedEvent(hd, desc, ev.
|
|
13338
|
+
return new TimedEvent(hd, desc, ev.mask, time, location, ev, options);
|
|
13211
13339
|
}
|
|
13212
13340
|
/**
|
|
13213
13341
|
* A Chanukah candle-lighting event that carries a specific time of day.
|
|
@@ -13226,7 +13354,7 @@ class TimedChanukahEvent extends ChanukahEvent {
|
|
|
13226
13354
|
* @param location location used to format the time
|
|
13227
13355
|
*/
|
|
13228
13356
|
constructor(ev, eventTime, location) {
|
|
13229
|
-
super(ev.getDate(), ev.getDesc(), ev.
|
|
13357
|
+
super(ev.getDate(), ev.getDesc(), ev.mask, ev.chanukahDay);
|
|
13230
13358
|
this.eventTime = Zmanim.roundTime(eventTime);
|
|
13231
13359
|
const timeFormat = location.getTimeFormatter();
|
|
13232
13360
|
this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);
|
|
@@ -14708,7 +14836,6 @@ function getMaskFromOptions(options) {
|
|
|
14708
14836
|
}
|
|
14709
14837
|
return mask;
|
|
14710
14838
|
}
|
|
14711
|
-
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
14712
14839
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
14713
14840
|
/**
|
|
14714
14841
|
* @private
|
|
@@ -14762,10 +14889,12 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
14762
14889
|
if (!ev.observedIn(il)) {
|
|
14763
14890
|
return candlesEv; // holiday isn't observed here; bail out early
|
|
14764
14891
|
}
|
|
14765
|
-
const eFlags = ev.
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14892
|
+
const eFlags = ev.mask;
|
|
14893
|
+
const isYomKippurKatan = ev.hasFlag('YOM_KIPPUR_KATAN');
|
|
14894
|
+
const isBehab = ev.hasFlag('BEHAB');
|
|
14895
|
+
if ((!options.yomKippurKatan && isYomKippurKatan) ||
|
|
14896
|
+
(!options.behab && isBehab) ||
|
|
14897
|
+
(options.noModern && ev.hasFlag('MODERN_HOLIDAY'))) {
|
|
14769
14898
|
return candlesEv; // bail out early
|
|
14770
14899
|
}
|
|
14771
14900
|
if (options.candlelighting && ev.getDesc() === holidayDesc.EREV_PESACH) {
|
|
@@ -14774,8 +14903,10 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
14774
14903
|
events.push(...evts);
|
|
14775
14904
|
}
|
|
14776
14905
|
}
|
|
14777
|
-
const isMajorFast =
|
|
14778
|
-
const isMinorFast =
|
|
14906
|
+
const isMajorFast = ev.hasFlag('MAJOR_FAST');
|
|
14907
|
+
const isMinorFast = ev.hasFlag('MINOR_FAST');
|
|
14908
|
+
const isChanukah = ev.hasFlag('CHANUKAH_CANDLES');
|
|
14909
|
+
const hasCandles = ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS', 'CHANUKAH_CANDLES', 'YOM_TOV_ENDS');
|
|
14779
14910
|
let fastEv;
|
|
14780
14911
|
if (options.candlelighting &&
|
|
14781
14912
|
(isMajorFast || isMinorFast) &&
|
|
@@ -14787,10 +14918,10 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
14787
14918
|
}
|
|
14788
14919
|
}
|
|
14789
14920
|
if (eFlags & Number(options.mask) || (!eFlags && !hasUserMask)) {
|
|
14790
|
-
if (options.candlelighting &&
|
|
14921
|
+
if (options.candlelighting && hasCandles) {
|
|
14791
14922
|
const hd = ev.getDate();
|
|
14792
14923
|
candlesEv = makeCandleEvent(ev, hd, options, isFriday, isSaturday);
|
|
14793
|
-
if (
|
|
14924
|
+
if (isChanukah && candlesEv && !options.noHolidays) {
|
|
14794
14925
|
// Replace Chanukah event with a clone that includes candle lighting time.
|
|
14795
14926
|
// For clarity, allow a "duplicate" candle lighting event to remain for Shabbat
|
|
14796
14927
|
const chanukahEv = makeWeekdayChanukahCandleLighting(ev, options);
|
|
@@ -14805,8 +14936,8 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
|
|
|
14805
14936
|
}
|
|
14806
14937
|
}
|
|
14807
14938
|
if (!options.noHolidays ||
|
|
14808
|
-
(options.yomKippurKatan &&
|
|
14809
|
-
(options.behab &&
|
|
14939
|
+
(options.yomKippurKatan && isYomKippurKatan) ||
|
|
14940
|
+
(options.behab && isBehab)) {
|
|
14810
14941
|
events.push(ev); // the original event itself
|
|
14811
14942
|
}
|
|
14812
14943
|
}
|
|
@@ -14918,18 +15049,17 @@ function hallel_(events, hdate) {
|
|
|
14918
15049
|
const desc = ev.getDesc();
|
|
14919
15050
|
const month = hd.getMonth();
|
|
14920
15051
|
const mday = hd.getDate();
|
|
14921
|
-
const mask = ev.getFlags();
|
|
14922
15052
|
if (desc.startsWith('Chanukah') ||
|
|
14923
15053
|
desc.startsWith('Shavuot') ||
|
|
14924
15054
|
desc.startsWith('Sukkot') ||
|
|
14925
15055
|
(month === months.NISAN &&
|
|
14926
15056
|
(mday === 15 || mday === 16) &&
|
|
14927
|
-
|
|
15057
|
+
ev.hasFlag('CHAG')) || // Pesach
|
|
14928
15058
|
desc === holidayDesc.YOM_HAATZMA_UT ||
|
|
14929
15059
|
desc === holidayDesc.YOM_YERUSHALAYIM) {
|
|
14930
15060
|
return WHOLE;
|
|
14931
15061
|
}
|
|
14932
|
-
if (
|
|
15062
|
+
if (ev.hasFlag('ROSH_CHODESH') ||
|
|
14933
15063
|
(desc.startsWith('Pesach') &&
|
|
14934
15064
|
desc !== holidayDesc.PESACH_I &&
|
|
14935
15065
|
desc !== holidayDesc.PESACH_II)) {
|
|
@@ -15070,8 +15200,8 @@ class HebrewCalendar {
|
|
|
15070
15200
|
}
|
|
15071
15201
|
/**
|
|
15072
15202
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
15073
|
-
* `HDate.toString()`. These events
|
|
15074
|
-
*
|
|
15203
|
+
* `HDate.toString()`. These events are not filtered by Israel vs. Diaspora
|
|
15204
|
+
* holiday scheme; use {@link Event.observedIn} to do that.
|
|
15075
15205
|
*
|
|
15076
15206
|
* Includes Rosh Chodesh, fasts, Yom Kippur Katan, Special Shabbatot, etc.,
|
|
15077
15207
|
* but does not generate candle-lighting times, Torah readings, or Omer days.
|
|
@@ -15266,7 +15396,7 @@ class HebrewCalendar {
|
|
|
15266
15396
|
*/
|
|
15267
15397
|
function isChag(date, il) {
|
|
15268
15398
|
const events = getHolidaysOnDate(date, il) || [];
|
|
15269
|
-
const chag = events.filter(ev => ev.
|
|
15399
|
+
const chag = events.filter(ev => ev.hasFlag('CHAG'));
|
|
15270
15400
|
return chag.length !== 0;
|
|
15271
15401
|
}
|
|
15272
15402
|
|