@formatjs/temporal 1.0.0 → 1.1.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/index.js +275 -237
- package/index.js.map +1 -1
- package/native.js +1 -1
- package/package.json +6 -3
- package/polyfill-force.js +204 -167
- package/polyfill-force.js.map +1 -1
- package/polyfill.js +204 -167
- package/polyfill.js.map +1 -1
- package/should-polyfill.js +2 -2
- package/standalone.js +275 -237
- package/standalone.js.map +1 -1
- package/wasm-native.js +287 -249
- package/wasm-native.js.map +1 -1
- package/wasm.js +1 -1
package/wasm-native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// packages/ecma262-abstract/ToString.js
|
|
2
2
|
/**
|
|
3
3
|
* https://tc39.es/ecma262/#sec-tostring
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ function ToString(o) {
|
|
|
6
6
|
if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
|
|
7
7
|
return String(o);
|
|
8
8
|
}
|
|
9
|
-
//
|
|
9
|
+
// packages/temporal/native.ts
|
|
10
10
|
const parse = JSON.parse;
|
|
11
11
|
const stringify = JSON.stringify;
|
|
12
12
|
const create$1 = Object.create;
|
|
@@ -425,7 +425,7 @@ function configureNativeTemporal(query) {
|
|
|
425
425
|
})
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
|
-
//
|
|
428
|
+
// packages/ecma262-abstract/DateOperations.js
|
|
429
429
|
const MS_PER_DAY = 864e5;
|
|
430
430
|
function Day(t) {
|
|
431
431
|
return Math.floor(t / MS_PER_DAY);
|
|
@@ -488,7 +488,7 @@ function DateFromTime(t) {
|
|
|
488
488
|
if (mft === 11) return dwy - 333 - leap;
|
|
489
489
|
throw new Error("Invalid time");
|
|
490
490
|
}
|
|
491
|
-
//
|
|
491
|
+
// packages/ecma402-abstract/DateTimeFormat/TimeZoneOffset.js
|
|
492
492
|
const monthStarts$3 = [
|
|
493
493
|
0,
|
|
494
494
|
31,
|
|
@@ -551,7 +551,7 @@ function TimeZoneOffset(t, data) {
|
|
|
551
551
|
}
|
|
552
552
|
return [data[low][2], data[low][3]];
|
|
553
553
|
}
|
|
554
|
-
//
|
|
554
|
+
// packages/temporal/kernel.ts
|
|
555
555
|
const second$1 = 1000000000n;
|
|
556
556
|
const day$2 = 86400n * second$1;
|
|
557
557
|
const limit$5 = 100000000n * day$2;
|
|
@@ -739,7 +739,7 @@ function createTimeZone(data) {
|
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
741
|
}
|
|
742
|
-
//
|
|
742
|
+
// packages/temporal/host-timezone.ts
|
|
743
743
|
const Constructor$2 = globalThis.Intl?.DateTimeFormat;
|
|
744
744
|
const parts = Constructor$2?.prototype.formatToParts;
|
|
745
745
|
Date.now;
|
|
@@ -791,7 +791,7 @@ function createHostTimeZoneOffset(timeZone, intrinsics = {
|
|
|
791
791
|
};
|
|
792
792
|
return offsetNanoseconds;
|
|
793
793
|
}
|
|
794
|
-
//
|
|
794
|
+
// node_modules/.aspect_rules_js/@formatjs_generated+datetimeformat.calendars@0.0.0/node_modules/@formatjs_generated/datetimeformat.calendars/fallback-eras.js
|
|
795
795
|
const beforeHijrah = {
|
|
796
796
|
"ady": [
|
|
797
797
|
"BH",
|
|
@@ -2104,7 +2104,7 @@ const beforeHijrah = {
|
|
|
2104
2104
|
"BH"
|
|
2105
2105
|
]
|
|
2106
2106
|
};
|
|
2107
|
-
//
|
|
2107
|
+
// packages/temporal/fallback-data.ts
|
|
2108
2108
|
function unavailable() {
|
|
2109
2109
|
throw new RangeError("Temporal native build requires Rust calendar and timezone data");
|
|
2110
2110
|
}
|
|
@@ -2123,7 +2123,7 @@ function fallbackTimeZonePrimary() {
|
|
|
2123
2123
|
function fallbackTimeZoneData(name) {
|
|
2124
2124
|
return unavailable();
|
|
2125
2125
|
}
|
|
2126
|
-
//
|
|
2126
|
+
// packages/temporal/calendar-table.ts
|
|
2127
2127
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
2128
2128
|
function isLunisolar(calendar) {
|
|
2129
2129
|
return calendar === "chinese" || calendar === "dangi";
|
|
@@ -2222,25 +2222,21 @@ function tableAddMonths(calendar, year, month, months) {
|
|
|
2222
2222
|
function tableMonthDifference(calendar, oneYear, oneMonth, twoYear, twoMonth) {
|
|
2223
2223
|
return tableMonthSerial(calendar, twoYear, twoMonth) - tableMonthSerial(calendar, oneYear, oneMonth);
|
|
2224
2224
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
],
|
|
2241
|
-
"chinese",
|
|
2242
|
-
"dangi",
|
|
2243
|
-
"islamic-umalqura"
|
|
2225
|
+
// packages/ecma402-abstract/Calendar/Arithmetic.js
|
|
2226
|
+
const arithmeticCalendars = [
|
|
2227
|
+
"iso8601",
|
|
2228
|
+
"gregory",
|
|
2229
|
+
"buddhist",
|
|
2230
|
+
"japanese",
|
|
2231
|
+
"roc",
|
|
2232
|
+
"coptic",
|
|
2233
|
+
"ethiopic",
|
|
2234
|
+
"ethioaa",
|
|
2235
|
+
"hebrew",
|
|
2236
|
+
"indian",
|
|
2237
|
+
"islamic-civil",
|
|
2238
|
+
"islamic-tbla",
|
|
2239
|
+
"persian"
|
|
2244
2240
|
];
|
|
2245
2241
|
const monthStarts$1 = [
|
|
2246
2242
|
0,
|
|
@@ -2256,42 +2252,23 @@ const monthStarts$1 = [
|
|
|
2256
2252
|
304,
|
|
2257
2253
|
334
|
|
2258
2254
|
];
|
|
2259
|
-
const mod = (value, divisor) => value - Math.floor(value / divisor) * divisor;
|
|
2260
|
-
function integer$
|
|
2255
|
+
const mod$1 = (value, divisor) => value - Math.floor(value / divisor) * divisor;
|
|
2256
|
+
function integer$3(value) {
|
|
2261
2257
|
if (!Number.isSafeInteger(value)) throw new RangeError("Expected safe integer");
|
|
2262
2258
|
return value;
|
|
2263
2259
|
}
|
|
2264
|
-
function
|
|
2265
|
-
|
|
2266
|
-
return year;
|
|
2267
|
-
}
|
|
2268
|
-
function dayCheck(day) {
|
|
2269
|
-
if (integer$2(day) < -100000001 || day > 1e8) throw new RangeError("Calendar date out of range");
|
|
2270
|
-
return day;
|
|
2271
|
-
}
|
|
2272
|
-
function calendarCheck(calendar) {
|
|
2273
|
-
if (!calendarIds.includes(calendar)) throw new RangeError("Unsupported calendar");
|
|
2274
|
-
}
|
|
2275
|
-
function overflowCheck(overflow) {
|
|
2276
|
-
if (overflow !== "constrain" && overflow !== "reject") throw new RangeError("Invalid overflow");
|
|
2277
|
-
}
|
|
2278
|
-
function regulate$1(value, min, max, overflow) {
|
|
2279
|
-
if (!Number.isInteger(value)) throw new RangeError("Expected finite integer");
|
|
2280
|
-
if (overflow === "reject" && (value < min || value > max)) throw new RangeError("Calendar field out of range");
|
|
2281
|
-
return Math.min(Math.max(value, min), max);
|
|
2282
|
-
}
|
|
2283
|
-
function hebrewLeap(year) {
|
|
2284
|
-
return mod(7 * year + 1, 19) < 7;
|
|
2260
|
+
function HebrewLeapYear(year) {
|
|
2261
|
+
return mod$1(7 * year + 1, 19) < 7;
|
|
2285
2262
|
}
|
|
2286
|
-
function
|
|
2263
|
+
function HebrewElapsedMonths(year) {
|
|
2287
2264
|
return Math.floor((235 * year - 234) / 19);
|
|
2288
2265
|
}
|
|
2289
2266
|
function hebrewDelay(year) {
|
|
2290
|
-
const months =
|
|
2267
|
+
const months = HebrewElapsedMonths(year);
|
|
2291
2268
|
const day = 29 * months + Math.floor((12084 + 13753 * months) / 25920);
|
|
2292
|
-
return day + Number(mod(3 * (day + 1), 7) < 3);
|
|
2269
|
+
return day + Number(mod$1(3 * (day + 1), 7) < 3);
|
|
2293
2270
|
}
|
|
2294
|
-
function
|
|
2271
|
+
function IsISOCalendar(calendar) {
|
|
2295
2272
|
return [
|
|
2296
2273
|
"iso8601",
|
|
2297
2274
|
"gregory",
|
|
@@ -2300,13 +2277,11 @@ function isoLike(calendar) {
|
|
|
2300
2277
|
"roc"
|
|
2301
2278
|
].includes(calendar);
|
|
2302
2279
|
}
|
|
2303
|
-
function
|
|
2280
|
+
function CalendarISOYear(calendar, year) {
|
|
2304
2281
|
return year + (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0);
|
|
2305
2282
|
}
|
|
2306
|
-
function
|
|
2307
|
-
if (
|
|
2308
|
-
if (calendar === "islamic-umalqura") return tableYearStart(calendar, year) ?? start("islamic-civil", year);
|
|
2309
|
-
if (isoLike(calendar)) return DayFromYear(isoYear(calendar, year));
|
|
2283
|
+
function ArithmeticCalendarStartOfYear(calendar, year) {
|
|
2284
|
+
if (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));
|
|
2310
2285
|
switch (calendar) {
|
|
2311
2286
|
case "coptic": return -615923 + 365 * year + Math.floor(year / 4);
|
|
2312
2287
|
case "ethiopic": return -716732 + 365 * year + Math.floor(year / 4);
|
|
@@ -2322,34 +2297,18 @@ function start(calendar, year) {
|
|
|
2322
2297
|
const present = hebrewDelay(year);
|
|
2323
2298
|
return -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);
|
|
2324
2299
|
}
|
|
2325
|
-
function
|
|
2326
|
-
calendarCheck(calendar);
|
|
2327
|
-
yearCheck(year);
|
|
2328
|
-
const native = nativeTemporal();
|
|
2329
|
-
if (native) return native.calendarStartOfYear(calendar, year);
|
|
2330
|
-
return start(calendar, year);
|
|
2331
|
-
}
|
|
2332
|
-
function monthsInYear(calendar, year) {
|
|
2333
|
-
calendarCheck(calendar);
|
|
2334
|
-
yearCheck(year);
|
|
2335
|
-
const native = nativeTemporal();
|
|
2336
|
-
if (native) return native.calendarMonthsInYear(calendar, year);
|
|
2337
|
-
if (isLunisolar(calendar)) return tableLeapMonth(calendar, year) ? 13 : 12;
|
|
2300
|
+
function ArithmeticCalendarMonthsInYear(calendar, year) {
|
|
2338
2301
|
return [
|
|
2339
2302
|
"coptic",
|
|
2340
2303
|
"ethiopic",
|
|
2341
2304
|
"ethioaa"
|
|
2342
|
-
].includes(calendar) || calendar === "hebrew" &&
|
|
2305
|
+
].includes(calendar) || calendar === "hebrew" && HebrewLeapYear(year) ? 13 : 12;
|
|
2343
2306
|
}
|
|
2344
|
-
function
|
|
2345
|
-
const
|
|
2346
|
-
if (
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
if (isLunisolar(calendar)) return tableMonthLength(calendar, year, month);
|
|
2350
|
-
if (calendar === "islamic-umalqura") return tableMonthLength(calendar, year, month) ?? daysInMonth("islamic-civil", year, month);
|
|
2351
|
-
if (isoLike(calendar)) return month === 12 ? 31 : monthStarts$1[month] - monthStarts$1[month - 1] + Number(month === 2 && DaysInYear(isoYear(calendar, year)) === 366);
|
|
2352
|
-
const length = start(calendar, year + 1) - start(calendar, year);
|
|
2307
|
+
function ArithmeticCalendarDaysInMonth(calendar, year, month) {
|
|
2308
|
+
const count = ArithmeticCalendarMonthsInYear(calendar, year);
|
|
2309
|
+
if (integer$3(month) < 1 || month > count) throw new RangeError("Invalid calendar month");
|
|
2310
|
+
if (IsISOCalendar(calendar)) return month === 12 ? 31 : monthStarts$1[month] - monthStarts$1[month - 1] + Number(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);
|
|
2311
|
+
const length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);
|
|
2353
2312
|
if ([
|
|
2354
2313
|
"coptic",
|
|
2355
2314
|
"ethiopic",
|
|
@@ -2358,7 +2317,7 @@ function daysInMonth(calendar, year, month) {
|
|
|
2358
2317
|
if (calendar === "indian") return month === 1 ? 30 + Number(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;
|
|
2359
2318
|
if (calendar === "islamic-civil" || calendar === "islamic-tbla") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;
|
|
2360
2319
|
if (calendar === "persian") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;
|
|
2361
|
-
const code = month + Number(!
|
|
2320
|
+
const code = month + Number(!HebrewLeapYear(year) && month >= 6);
|
|
2362
2321
|
if ([
|
|
2363
2322
|
4,
|
|
2364
2323
|
7,
|
|
@@ -2370,14 +2329,196 @@ function daysInMonth(calendar, year, month) {
|
|
|
2370
2329
|
if (code === 3) return length % 10 === 3 ? 29 : 30;
|
|
2371
2330
|
return 30;
|
|
2372
2331
|
}
|
|
2332
|
+
function ArithmeticCalendarMonthCode(calendar, year, month) {
|
|
2333
|
+
const leap = calendar === "hebrew" && HebrewLeapYear(year);
|
|
2334
|
+
if (leap && month === 6) return "M05L";
|
|
2335
|
+
const code = month - Number(leap && month > 6);
|
|
2336
|
+
return "M" + (code < 10 ? "0" : "") + code;
|
|
2337
|
+
}
|
|
2338
|
+
function ArithmeticCalendarFromEpochDay(calendar, epoch) {
|
|
2339
|
+
const t = epoch * 864e5, civilYear = YearFromTime(t);
|
|
2340
|
+
if (IsISOCalendar(calendar)) {
|
|
2341
|
+
const year = civilYear - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0), month = MonthFromTime(t) + 1;
|
|
2342
|
+
return {
|
|
2343
|
+
year,
|
|
2344
|
+
month,
|
|
2345
|
+
monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
|
|
2346
|
+
day: DateFromTime(t)
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
const jd = epoch + 2440588;
|
|
2350
|
+
let year;
|
|
2351
|
+
switch (calendar) {
|
|
2352
|
+
case "coptic":
|
|
2353
|
+
year = Math.floor((4 * (jd - 1824665) + 3) / 1461);
|
|
2354
|
+
break;
|
|
2355
|
+
case "ethiopic":
|
|
2356
|
+
case "ethioaa":
|
|
2357
|
+
year = Math.floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === "ethioaa" ? 5500 : 0);
|
|
2358
|
+
break;
|
|
2359
|
+
case "islamic-civil":
|
|
2360
|
+
case "islamic-tbla":
|
|
2361
|
+
year = Math.floor((30 * (jd - 1948440 + Number(calendar === "islamic-tbla")) + 10646) / 10631);
|
|
2362
|
+
break;
|
|
2363
|
+
case "persian":
|
|
2364
|
+
year = 1 + Math.floor((33 * (jd - 1948320) + 3) / 12053);
|
|
2365
|
+
break;
|
|
2366
|
+
case "indian":
|
|
2367
|
+
year = civilYear - 78;
|
|
2368
|
+
break;
|
|
2369
|
+
default: year = Math.floor((epoch + 2092590) * 492480 / 179876755) + 1;
|
|
2370
|
+
}
|
|
2371
|
+
while (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;
|
|
2372
|
+
while (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;
|
|
2373
|
+
let month = 1, remaining = epoch - ArithmeticCalendarStartOfYear(calendar, year);
|
|
2374
|
+
while (remaining >= ArithmeticCalendarDaysInMonth(calendar, year, month)) remaining -= ArithmeticCalendarDaysInMonth(calendar, year, month++);
|
|
2375
|
+
return {
|
|
2376
|
+
year,
|
|
2377
|
+
month,
|
|
2378
|
+
monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
|
|
2379
|
+
day: remaining + 1
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
const JapaneseEras = [
|
|
2383
|
+
[
|
|
2384
|
+
18017,
|
|
2385
|
+
"reiwa",
|
|
2386
|
+
2018
|
|
2387
|
+
],
|
|
2388
|
+
[
|
|
2389
|
+
6947,
|
|
2390
|
+
"heisei",
|
|
2391
|
+
1988
|
|
2392
|
+
],
|
|
2393
|
+
[
|
|
2394
|
+
-15713,
|
|
2395
|
+
"showa",
|
|
2396
|
+
1925
|
|
2397
|
+
],
|
|
2398
|
+
[
|
|
2399
|
+
-20974,
|
|
2400
|
+
"taisho",
|
|
2401
|
+
1911
|
|
2402
|
+
],
|
|
2403
|
+
[
|
|
2404
|
+
-35428,
|
|
2405
|
+
"meiji",
|
|
2406
|
+
1867
|
|
2407
|
+
]
|
|
2408
|
+
];
|
|
2409
|
+
function ArithmeticCalendarEra(calendar, epoch, year) {
|
|
2410
|
+
switch (calendar) {
|
|
2411
|
+
case "iso8601": return;
|
|
2412
|
+
case "buddhist": return {
|
|
2413
|
+
era: "be",
|
|
2414
|
+
eraYear: year
|
|
2415
|
+
};
|
|
2416
|
+
case "coptic":
|
|
2417
|
+
case "hebrew": return {
|
|
2418
|
+
era: "am",
|
|
2419
|
+
eraYear: year
|
|
2420
|
+
};
|
|
2421
|
+
case "ethiopic": return {
|
|
2422
|
+
era: year > 0 ? "am" : "aa",
|
|
2423
|
+
eraYear: year > 0 ? year : year + 5500
|
|
2424
|
+
};
|
|
2425
|
+
case "ethioaa": return {
|
|
2426
|
+
era: "aa",
|
|
2427
|
+
eraYear: year
|
|
2428
|
+
};
|
|
2429
|
+
case "indian": return {
|
|
2430
|
+
era: "shaka",
|
|
2431
|
+
eraYear: year
|
|
2432
|
+
};
|
|
2433
|
+
case "persian": return {
|
|
2434
|
+
era: "ap",
|
|
2435
|
+
eraYear: year
|
|
2436
|
+
};
|
|
2437
|
+
case "roc": return {
|
|
2438
|
+
era: year > 0 ? "roc" : "broc",
|
|
2439
|
+
eraYear: year > 0 ? year : 1 - year
|
|
2440
|
+
};
|
|
2441
|
+
case "islamic-civil":
|
|
2442
|
+
case "islamic-tbla": return {
|
|
2443
|
+
era: year > 0 ? "ah" : "bh",
|
|
2444
|
+
eraYear: year > 0 ? year : 1 - year
|
|
2445
|
+
};
|
|
2446
|
+
case "japanese": for (const [start, era, offset] of JapaneseEras) if (epoch >= start) return {
|
|
2447
|
+
era,
|
|
2448
|
+
eraYear: year - offset
|
|
2449
|
+
};
|
|
2450
|
+
}
|
|
2451
|
+
return {
|
|
2452
|
+
era: year > 0 ? "ce" : "bce",
|
|
2453
|
+
eraYear: year > 0 ? year : 1 - year
|
|
2454
|
+
};
|
|
2455
|
+
}
|
|
2456
|
+
// packages/temporal/calendar.ts
|
|
2457
|
+
const calendarIds = [
|
|
2458
|
+
...arithmeticCalendars,
|
|
2459
|
+
"chinese",
|
|
2460
|
+
"dangi",
|
|
2461
|
+
"islamic-umalqura"
|
|
2462
|
+
];
|
|
2463
|
+
const mod = (value, divisor) => value - Math.floor(value / divisor) * divisor;
|
|
2464
|
+
function integer$2(value) {
|
|
2465
|
+
if (!Number.isSafeInteger(value)) throw new RangeError("Expected safe integer");
|
|
2466
|
+
return value;
|
|
2467
|
+
}
|
|
2468
|
+
function yearCheck(year) {
|
|
2469
|
+
if (Math.abs(integer$2(year)) > 4e5) throw new RangeError("Calendar year out of range");
|
|
2470
|
+
return year;
|
|
2471
|
+
}
|
|
2472
|
+
function dayCheck(day) {
|
|
2473
|
+
if (integer$2(day) < -100000001 || day > 1e8) throw new RangeError("Calendar date out of range");
|
|
2474
|
+
return day;
|
|
2475
|
+
}
|
|
2476
|
+
function calendarCheck(calendar) {
|
|
2477
|
+
if (!calendarIds.includes(calendar)) throw new RangeError("Unsupported calendar");
|
|
2478
|
+
}
|
|
2479
|
+
function overflowCheck(overflow) {
|
|
2480
|
+
if (overflow !== "constrain" && overflow !== "reject") throw new RangeError("Invalid overflow");
|
|
2481
|
+
}
|
|
2482
|
+
function regulate$1(value, min, max, overflow) {
|
|
2483
|
+
if (!Number.isInteger(value)) throw new RangeError("Expected finite integer");
|
|
2484
|
+
if (overflow === "reject" && (value < min || value > max)) throw new RangeError("Calendar field out of range");
|
|
2485
|
+
return Math.min(Math.max(value, min), max);
|
|
2486
|
+
}
|
|
2487
|
+
function start(calendar, year) {
|
|
2488
|
+
if (isLunisolar(calendar)) return tableYearStart(calendar, year);
|
|
2489
|
+
if (calendar === "islamic-umalqura") return tableYearStart(calendar, year) ?? ArithmeticCalendarStartOfYear("islamic-civil", year);
|
|
2490
|
+
return ArithmeticCalendarStartOfYear(calendar, year);
|
|
2491
|
+
}
|
|
2492
|
+
function calendarStartOfYear(calendar, year) {
|
|
2493
|
+
calendarCheck(calendar);
|
|
2494
|
+
yearCheck(year);
|
|
2495
|
+
const native = nativeTemporal();
|
|
2496
|
+
if (native) return native.calendarStartOfYear(calendar, year);
|
|
2497
|
+
return start(calendar, year);
|
|
2498
|
+
}
|
|
2499
|
+
function monthsInYear(calendar, year) {
|
|
2500
|
+
calendarCheck(calendar);
|
|
2501
|
+
yearCheck(year);
|
|
2502
|
+
const native = nativeTemporal();
|
|
2503
|
+
if (native) return native.calendarMonthsInYear(calendar, year);
|
|
2504
|
+
if (isLunisolar(calendar)) return tableLeapMonth(calendar, year) ? 13 : 12;
|
|
2505
|
+
return calendar === "islamic-umalqura" ? 12 : ArithmeticCalendarMonthsInYear(calendar, year);
|
|
2506
|
+
}
|
|
2507
|
+
function daysInMonth(calendar, year, month) {
|
|
2508
|
+
const native = nativeTemporal();
|
|
2509
|
+
if (native) return native.calendarDaysInMonth(calendar, year, month);
|
|
2510
|
+
const count = monthsInYear(calendar, year);
|
|
2511
|
+
if (integer$2(month) < 1 || month > count) throw new RangeError("Invalid calendar month");
|
|
2512
|
+
if (isLunisolar(calendar)) return tableMonthLength(calendar, year, month);
|
|
2513
|
+
if (calendar === "islamic-umalqura") return tableMonthLength(calendar, year, month) ?? daysInMonth("islamic-civil", year, month);
|
|
2514
|
+
return ArithmeticCalendarDaysInMonth(calendar, year, month);
|
|
2515
|
+
}
|
|
2373
2516
|
function monthCode(calendar, year, month) {
|
|
2374
2517
|
if (isLunisolar(calendar)) {
|
|
2375
2518
|
const leap = tableLeapMonth(calendar, year);
|
|
2376
2519
|
return "M" + String(month - Number(leap > 0 && month > leap)).padStart(2, "0") + (leap > 0 && month === leap + 1 ? "L" : "");
|
|
2377
2520
|
}
|
|
2378
|
-
|
|
2379
|
-
if (leap && month === 6) return "M05L";
|
|
2380
|
-
return "M" + String(month - Number(leap && month > 6)).padStart(2, "0");
|
|
2521
|
+
return ArithmeticCalendarMonthCode(calendar === "islamic-umalqura" ? "islamic-civil" : calendar, year, month);
|
|
2381
2522
|
}
|
|
2382
2523
|
function monthFromCode(calendar, year, code, overflow) {
|
|
2383
2524
|
if (isLunisolar(calendar)) {
|
|
@@ -2387,7 +2528,7 @@ function monthFromCode(calendar, year, code, overflow) {
|
|
|
2387
2528
|
return number + Number(leap > 0 && (number > leap || number === leap && code.endsWith("L")));
|
|
2388
2529
|
}
|
|
2389
2530
|
if (calendar === "hebrew" && code === "M05L") {
|
|
2390
|
-
if (!
|
|
2531
|
+
if (!HebrewLeapYear(year) && overflow === "reject") throw new RangeError("Leap month absent");
|
|
2391
2532
|
return 6;
|
|
2392
2533
|
}
|
|
2393
2534
|
if (!/^M(0[1-9]|1[0-3])$/.test(code) || code === "M13" && ![
|
|
@@ -2396,7 +2537,7 @@ function monthFromCode(calendar, year, code, overflow) {
|
|
|
2396
2537
|
"ethioaa"
|
|
2397
2538
|
].includes(calendar)) throw new RangeError("Invalid month code");
|
|
2398
2539
|
const month = Number(code.slice(1));
|
|
2399
|
-
return month + Number(calendar === "hebrew" &&
|
|
2540
|
+
return month + Number(calendar === "hebrew" && HebrewLeapYear(year) && month >= 6);
|
|
2400
2541
|
}
|
|
2401
2542
|
function calendarToEpochDayRaw(calendar, fields, overflow = "constrain") {
|
|
2402
2543
|
calendarCheck(calendar);
|
|
@@ -2438,39 +2579,9 @@ function calendarFromEpochDayRaw(calendar, epoch) {
|
|
|
2438
2579
|
monthCode: monthCode(calendar, value.year, value.month)
|
|
2439
2580
|
};
|
|
2440
2581
|
}
|
|
2441
|
-
|
|
2442
|
-
if (isoLike(calendar)) {
|
|
2443
|
-
const year = civilYear - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0), month = MonthFromTime(t) + 1;
|
|
2444
|
-
return {
|
|
2445
|
-
year,
|
|
2446
|
-
month,
|
|
2447
|
-
monthCode: monthCode(calendar, year, month),
|
|
2448
|
-
day: DateFromTime(t)
|
|
2449
|
-
};
|
|
2450
|
-
}
|
|
2582
|
+
if (calendar !== "islamic-umalqura") return ArithmeticCalendarFromEpochDay(calendar, epoch);
|
|
2451
2583
|
const jd = epoch + 2440588;
|
|
2452
|
-
let year;
|
|
2453
|
-
switch (calendar) {
|
|
2454
|
-
case "coptic":
|
|
2455
|
-
year = Math.floor((4 * (jd - 1824665) + 3) / 1461);
|
|
2456
|
-
break;
|
|
2457
|
-
case "ethiopic":
|
|
2458
|
-
case "ethioaa":
|
|
2459
|
-
year = Math.floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === "ethioaa" ? 5500 : 0);
|
|
2460
|
-
break;
|
|
2461
|
-
case "islamic-umalqura":
|
|
2462
|
-
case "islamic-civil":
|
|
2463
|
-
case "islamic-tbla":
|
|
2464
|
-
year = Math.floor((30 * (jd - 1948440 + Number(calendar === "islamic-tbla")) + 10646) / 10631);
|
|
2465
|
-
break;
|
|
2466
|
-
case "persian":
|
|
2467
|
-
year = 1 + Math.floor((33 * (jd - 1948320) + 3) / 12053);
|
|
2468
|
-
break;
|
|
2469
|
-
case "indian":
|
|
2470
|
-
year = civilYear - 78;
|
|
2471
|
-
break;
|
|
2472
|
-
default: year = Math.floor((epoch + 2092590) * 492480 / 179876755) + 1;
|
|
2473
|
-
}
|
|
2584
|
+
let year = Math.floor((30 * (jd - 1948440) + 10646) / 10631);
|
|
2474
2585
|
while (start(calendar, year) > epoch) year--;
|
|
2475
2586
|
while (start(calendar, year + 1) <= epoch) year++;
|
|
2476
2587
|
let month = 1, remaining = epoch - start(calendar, year);
|
|
@@ -2496,11 +2607,11 @@ function addYearMonth(calendar, original, years, months, overflow) {
|
|
|
2496
2607
|
month = mod(serial, count) + 1;
|
|
2497
2608
|
} else {
|
|
2498
2609
|
month = monthFromCode(calendar, year, original.monthCode, overflow);
|
|
2499
|
-
const serial = integer$2(
|
|
2610
|
+
const serial = integer$2(HebrewElapsedMonths(year) + month - 1 + months);
|
|
2500
2611
|
year = yearCheck(Math.floor((19 * serial + 234) / 235));
|
|
2501
|
-
while (
|
|
2502
|
-
while (
|
|
2503
|
-
month = serial -
|
|
2612
|
+
while (HebrewElapsedMonths(year) > serial) year--;
|
|
2613
|
+
while (HebrewElapsedMonths(year + 1) <= serial) year++;
|
|
2614
|
+
month = serial - HebrewElapsedMonths(year) + 1;
|
|
2504
2615
|
}
|
|
2505
2616
|
return {
|
|
2506
2617
|
year,
|
|
@@ -2536,7 +2647,7 @@ function calendarMonthSerial(calendar, year, month) {
|
|
|
2536
2647
|
const native = nativeTemporal();
|
|
2537
2648
|
if (native) return native.calendarMonthSerial(calendar, year, month);
|
|
2538
2649
|
if (isLunisolar(calendar)) return tableMonthSerial(calendar, year, month);
|
|
2539
|
-
return calendar === "hebrew" ?
|
|
2650
|
+
return calendar === "hebrew" ? HebrewElapsedMonths(year) + month - 1 : year * monthsInYear(calendar, year) + month - 1;
|
|
2540
2651
|
}
|
|
2541
2652
|
function calendarDateUntilRaw(calendar, one, two, largest) {
|
|
2542
2653
|
const native = nativeTemporal();
|
|
@@ -2574,33 +2685,6 @@ function calendarDateUntilRaw(calendar, one, two, largest) {
|
|
|
2574
2685
|
}
|
|
2575
2686
|
return result;
|
|
2576
2687
|
}
|
|
2577
|
-
const japaneseEras = [
|
|
2578
|
-
[
|
|
2579
|
-
18017,
|
|
2580
|
-
"reiwa",
|
|
2581
|
-
2018
|
|
2582
|
-
],
|
|
2583
|
-
[
|
|
2584
|
-
6947,
|
|
2585
|
-
"heisei",
|
|
2586
|
-
1988
|
|
2587
|
-
],
|
|
2588
|
-
[
|
|
2589
|
-
-15713,
|
|
2590
|
-
"showa",
|
|
2591
|
-
1925
|
|
2592
|
-
],
|
|
2593
|
-
[
|
|
2594
|
-
-20974,
|
|
2595
|
-
"taisho",
|
|
2596
|
-
1911
|
|
2597
|
-
],
|
|
2598
|
-
[
|
|
2599
|
-
-35428,
|
|
2600
|
-
"meiji",
|
|
2601
|
-
1867
|
|
2602
|
-
]
|
|
2603
|
-
];
|
|
2604
2688
|
function calendarEra(calendar, epoch, extended = false) {
|
|
2605
2689
|
const native = nativeTemporal();
|
|
2606
2690
|
if (native) {
|
|
@@ -2608,54 +2692,8 @@ function calendarEra(calendar, epoch, extended = false) {
|
|
|
2608
2692
|
return native.calendarEra(calendar, epoch);
|
|
2609
2693
|
}
|
|
2610
2694
|
const { year } = (extended ? calendarFromEpochDayRaw : calendarFromEpochDay)(calendar, epoch);
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
case "chinese":
|
|
2614
|
-
case "dangi": return;
|
|
2615
|
-
case "buddhist": return {
|
|
2616
|
-
era: "be",
|
|
2617
|
-
eraYear: year
|
|
2618
|
-
};
|
|
2619
|
-
case "coptic":
|
|
2620
|
-
case "hebrew": return {
|
|
2621
|
-
era: "am",
|
|
2622
|
-
eraYear: year
|
|
2623
|
-
};
|
|
2624
|
-
case "ethiopic": return {
|
|
2625
|
-
era: year > 0 ? "am" : "aa",
|
|
2626
|
-
eraYear: year > 0 ? year : year + 5500
|
|
2627
|
-
};
|
|
2628
|
-
case "ethioaa": return {
|
|
2629
|
-
era: "aa",
|
|
2630
|
-
eraYear: year
|
|
2631
|
-
};
|
|
2632
|
-
case "indian": return {
|
|
2633
|
-
era: "shaka",
|
|
2634
|
-
eraYear: year
|
|
2635
|
-
};
|
|
2636
|
-
case "persian": return {
|
|
2637
|
-
era: "ap",
|
|
2638
|
-
eraYear: year
|
|
2639
|
-
};
|
|
2640
|
-
case "roc": return {
|
|
2641
|
-
era: year > 0 ? "roc" : "broc",
|
|
2642
|
-
eraYear: year > 0 ? year : 1 - year
|
|
2643
|
-
};
|
|
2644
|
-
case "islamic-umalqura":
|
|
2645
|
-
case "islamic-civil":
|
|
2646
|
-
case "islamic-tbla": return {
|
|
2647
|
-
era: year > 0 ? "ah" : "bh",
|
|
2648
|
-
eraYear: year > 0 ? year : 1 - year
|
|
2649
|
-
};
|
|
2650
|
-
case "japanese": for (const [start, era, offset] of japaneseEras) if (epoch >= start) return {
|
|
2651
|
-
era,
|
|
2652
|
-
eraYear: year - offset
|
|
2653
|
-
};
|
|
2654
|
-
}
|
|
2655
|
-
return {
|
|
2656
|
-
era: year > 0 ? "ce" : "bce",
|
|
2657
|
-
eraYear: year > 0 ? year : 1 - year
|
|
2658
|
-
};
|
|
2695
|
+
if (calendar === "chinese" || calendar === "dangi") return void 0;
|
|
2696
|
+
return ArithmeticCalendarEra(calendar === "islamic-umalqura" ? "islamic-civil" : calendar, epoch, year);
|
|
2659
2697
|
}
|
|
2660
2698
|
function calendarYearFromEra(calendar, era, eraYear) {
|
|
2661
2699
|
calendarCheck(calendar);
|
|
@@ -2663,7 +2701,7 @@ function calendarYearFromEra(calendar, era, eraYear) {
|
|
|
2663
2701
|
const native = nativeTemporal();
|
|
2664
2702
|
if (native) return native.calendarYearFromEra(calendar, era, eraYear);
|
|
2665
2703
|
if (calendar === "japanese") {
|
|
2666
|
-
for (const [, name, offset] of
|
|
2704
|
+
for (const [, name, offset] of JapaneseEras) if (era === name) return yearCheck(eraYear + offset);
|
|
2667
2705
|
}
|
|
2668
2706
|
if (calendar === "ethiopic" && era === "aa") return yearCheck(eraYear - 5500);
|
|
2669
2707
|
const names = {
|
|
@@ -2686,7 +2724,7 @@ function calendarYearFromEra(calendar, era, eraYear) {
|
|
|
2686
2724
|
if (index < 0) throw new RangeError("Invalid era");
|
|
2687
2725
|
return yearCheck(index === 1 ? 1 - eraYear : eraYear);
|
|
2688
2726
|
}
|
|
2689
|
-
//
|
|
2727
|
+
// packages/temporal/legacy-lunisolar-date.ts
|
|
2690
2728
|
const Constructor$1 = globalThis.Intl?.DateTimeFormat;
|
|
2691
2729
|
const nativeParts$1 = Constructor$1?.prototype.formatToParts;
|
|
2692
2730
|
const NumberConstructor$3 = globalThis.Intl?.NumberFormat;
|
|
@@ -2877,7 +2915,7 @@ function joinCalendarRangeParts(formatter, start, end, parts) {
|
|
|
2877
2915
|
}))
|
|
2878
2916
|
];
|
|
2879
2917
|
}
|
|
2880
|
-
//
|
|
2918
|
+
// packages/temporal/legacy-calendar-date.ts
|
|
2881
2919
|
const Constructor = globalThis.Intl?.DateTimeFormat;
|
|
2882
2920
|
const NumberConstructor$2 = globalThis.Intl?.NumberFormat;
|
|
2883
2921
|
const numberFormat$2 = NumberConstructor$2 && Object.getOwnPropertyDescriptor(NumberConstructor$2.prototype, "format")?.get;
|
|
@@ -3110,7 +3148,7 @@ function legacyCalendarRangeParts(first, last, parts, rangeParts, resolved) {
|
|
|
3110
3148
|
}
|
|
3111
3149
|
return joinCalendarRangeParts(first.formatter, start, end, rangeParts);
|
|
3112
3150
|
}
|
|
3113
|
-
//
|
|
3151
|
+
// packages/temporal/legacy-extended-date.ts
|
|
3114
3152
|
const legacyTimeZoneName = Symbol();
|
|
3115
3153
|
const limit$2 = 864e13;
|
|
3116
3154
|
const cycle = 146097 * 864e5;
|
|
@@ -3191,7 +3229,7 @@ function legacyDateTimeRangeFormat(first, last, format, parts, resolved) {
|
|
|
3191
3229
|
if (!clipped(first) && !clipped(last) || !gregorian(first.formatter, resolved)) return format.call(first.formatter, first.milliseconds, last.milliseconds);
|
|
3192
3230
|
return legacyDateTimeRangeParts(first, last, parts, resolved).map((part) => part.value).join("");
|
|
3193
3231
|
}
|
|
3194
|
-
//
|
|
3232
|
+
// packages/temporal/legacy-zoned-date.ts
|
|
3195
3233
|
const zones = /* @__PURE__ */ new WeakMap();
|
|
3196
3234
|
const NumberConstructor = globalThis.Intl?.NumberFormat;
|
|
3197
3235
|
const numberFormat = NumberConstructor && Object.getOwnPropertyDescriptor(NumberConstructor.prototype, "format")?.get;
|
|
@@ -3251,7 +3289,7 @@ function offsetName(Constructor, resolved, offset, long, parts) {
|
|
|
3251
3289
|
const replacement = number(hour) + (long || minute || second ? separator + two(minute) : "") + (second ? separator + two(second) : "");
|
|
3252
3290
|
return pattern.replace(/0?1(?:\D+00)?/, replacement);
|
|
3253
3291
|
}
|
|
3254
|
-
//
|
|
3292
|
+
// packages/temporal/locale.ts
|
|
3255
3293
|
const dateUTC = Date.UTC;
|
|
3256
3294
|
let dateTimeConstructor = globalThis.Intl?.DateTimeFormat;
|
|
3257
3295
|
let temporalFormat = dateTimeConstructor?.__formatTemporal;
|
|
@@ -3443,7 +3481,7 @@ function legacyDateTimeOption(key, value) {
|
|
|
3443
3481
|
if (key === "fractionalSecondDigits") return +value;
|
|
3444
3482
|
return ToString(value);
|
|
3445
3483
|
}
|
|
3446
|
-
//
|
|
3484
|
+
// packages/temporal/instant-string.ts
|
|
3447
3485
|
function parseOffsetNanoseconds(value, annotation = false) {
|
|
3448
3486
|
const match = /^([+-])(\d{2})(?:(:?)(\d{2})(?:\3(\d{2})(?:[.,](\d{1,9}))?)?)?$/.exec(value);
|
|
3449
3487
|
if (!match || match[0] !== value || annotation && match[5] !== void 0) throw new RangeError("Invalid UTC offset");
|
|
@@ -3661,7 +3699,7 @@ function parseZonedDateTimeString(value) {
|
|
|
3661
3699
|
offset: /[Tt ]/.test(body) ? offset : void 0
|
|
3662
3700
|
};
|
|
3663
3701
|
}
|
|
3664
|
-
//
|
|
3702
|
+
// packages/temporal/zones.ts
|
|
3665
3703
|
let identifiers;
|
|
3666
3704
|
const cache = /* @__PURE__ */ new Map();
|
|
3667
3705
|
function typescriptTimeZone(name) {
|
|
@@ -3800,7 +3838,7 @@ function primaryTimeZoneIdentifier(id) {
|
|
|
3800
3838
|
function timeZoneEquals(one, two) {
|
|
3801
3839
|
return primaryTimeZoneIdentifier(one) === primaryTimeZoneIdentifier(two);
|
|
3802
3840
|
}
|
|
3803
|
-
//
|
|
3841
|
+
// packages/temporal/plain-slots.ts
|
|
3804
3842
|
const dates = /* @__PURE__ */ new WeakMap();
|
|
3805
3843
|
const dateTimes = /* @__PURE__ */ new WeakMap();
|
|
3806
3844
|
const times = /* @__PURE__ */ new WeakMap();
|
|
@@ -3826,7 +3864,7 @@ function getZonedDateTimeSlot(value) {
|
|
|
3826
3864
|
calendar: slot.calendar
|
|
3827
3865
|
};
|
|
3828
3866
|
}
|
|
3829
|
-
//
|
|
3867
|
+
// packages/temporal/accessors.ts
|
|
3830
3868
|
function defineGetters(prototype, names, read) {
|
|
3831
3869
|
function define(name, index) {
|
|
3832
3870
|
Object.defineProperty(prototype, name, {
|
|
@@ -3839,7 +3877,7 @@ function defineGetters(prototype, names, read) {
|
|
|
3839
3877
|
}
|
|
3840
3878
|
for (let index = 0; index < names.length; index++) define(names[index], index);
|
|
3841
3879
|
}
|
|
3842
|
-
//
|
|
3880
|
+
// packages/ecma262-abstract/ToPrimitive.js
|
|
3843
3881
|
function IsPrimitive(value) {
|
|
3844
3882
|
return value === null || typeof value !== "object" && typeof value !== "function";
|
|
3845
3883
|
}
|
|
@@ -3885,7 +3923,7 @@ function ToPrimitive(input, preferredType) {
|
|
|
3885
3923
|
}
|
|
3886
3924
|
return input;
|
|
3887
3925
|
}
|
|
3888
|
-
//
|
|
3926
|
+
// packages/temporal/instant-format.ts
|
|
3889
3927
|
function formatInstant(value, precision = "auto", offset) {
|
|
3890
3928
|
const fields = epochNanosecondsToISO(value + (offset ?? 0n));
|
|
3891
3929
|
const pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
@@ -3901,7 +3939,7 @@ function formatInstant(value, precision = "auto", offset) {
|
|
|
3901
3939
|
const minutes = Number((absolute + 30000000000n) / 60000000000n);
|
|
3902
3940
|
return result + (offset < 0n && minutes !== 0 ? "-" : "+") + pad(Math.floor(minutes / 60)) + ":" + pad(minutes % 60);
|
|
3903
3941
|
}
|
|
3904
|
-
//
|
|
3942
|
+
// packages/temporal/duration-core.ts
|
|
3905
3943
|
const durationFieldNames = [
|
|
3906
3944
|
"years",
|
|
3907
3945
|
"months",
|
|
@@ -4062,7 +4100,7 @@ function durationTotalNumber(nanoseconds, divisor) {
|
|
|
4062
4100
|
const value = Number(mantissa) * 2 ** (exponent - 52);
|
|
4063
4101
|
return negative ? -value : value;
|
|
4064
4102
|
}
|
|
4065
|
-
//
|
|
4103
|
+
// packages/temporal/duration-format.ts
|
|
4066
4104
|
function formatDuration(fields, digits = "auto") {
|
|
4067
4105
|
const native = nativeTemporal();
|
|
4068
4106
|
if (native) return native.formatDuration(fields, digits, "trunc");
|
|
@@ -4092,7 +4130,7 @@ function formatDuration(fields, digits = "auto") {
|
|
|
4092
4130
|
if (secondNs !== 0n || digits !== "auto" || (result === "P" || result === "-P") && time === "") time += String(secondNs / 1000000000n) + (decimals ? "." + decimals : "") + "S";
|
|
4093
4131
|
return result + (time ? "T" + time : "");
|
|
4094
4132
|
}
|
|
4095
|
-
//
|
|
4133
|
+
// packages/temporal/rounding.ts
|
|
4096
4134
|
const timeUnitNanoseconds = {
|
|
4097
4135
|
hour: 3600000000000n,
|
|
4098
4136
|
minute: 60000000000n,
|
|
@@ -4199,7 +4237,7 @@ function roundDuration(value, quantum, mode) {
|
|
|
4199
4237
|
halfEven: "halfEven"
|
|
4200
4238
|
}[mode]);
|
|
4201
4239
|
}
|
|
4202
|
-
//
|
|
4240
|
+
// packages/temporal/date-core.ts
|
|
4203
4241
|
const nsPerDay = 86400000000000n;
|
|
4204
4242
|
const clockNames = [
|
|
4205
4243
|
"hour",
|
|
@@ -4637,7 +4675,7 @@ function roundRelativeDifference(start, end, largest, smallest, increment, mode,
|
|
|
4637
4675
|
}
|
|
4638
4676
|
return result;
|
|
4639
4677
|
}
|
|
4640
|
-
//
|
|
4678
|
+
// packages/temporal/plain-date-time.ts
|
|
4641
4679
|
function read$8(item) {
|
|
4642
4680
|
const slot = getDateTimeSlot(item);
|
|
4643
4681
|
if (!slot) throw new TypeError("Invalid PlainDateTime receiver");
|
|
@@ -4861,7 +4899,7 @@ defineGetters(PlainDateTimeValue.prototype, [...datePropertyNames, ...clockNames
|
|
|
4861
4899
|
const slot = read$8(receiver), index = clockNames.indexOf(name);
|
|
4862
4900
|
return index < 0 ? dateProperty(dateSlot(slot), name) : Number(timeOf(slot.epochNanoseconds) / clockFactors[index] % BigInt(clockBounds[index] + 1));
|
|
4863
4901
|
});
|
|
4864
|
-
//
|
|
4902
|
+
// packages/temporal/short-date-core.ts
|
|
4865
4903
|
function shortCalendar(calendar) {
|
|
4866
4904
|
return calendar;
|
|
4867
4905
|
}
|
|
@@ -5001,7 +5039,7 @@ function mergeShortFields(slot, partial, kind = "year-month") {
|
|
|
5001
5039
|
else delete fields.day;
|
|
5002
5040
|
return mergeDateFields(slot.calendar, fields, partial);
|
|
5003
5041
|
}
|
|
5004
|
-
//
|
|
5042
|
+
// packages/temporal/plain-year-month.ts
|
|
5005
5043
|
function read$7(item) {
|
|
5006
5044
|
const slot = getYearMonthSlot(item);
|
|
5007
5045
|
if (!slot) throw new TypeError("Invalid PlainYearMonth receiver");
|
|
@@ -5187,7 +5225,7 @@ defineGetters(PlainYearMonthValue.prototype, [
|
|
|
5187
5225
|
"monthsInYear",
|
|
5188
5226
|
"inLeapYear"
|
|
5189
5227
|
], (receiver, name) => dateProperty(read$7(receiver), name, true));
|
|
5190
|
-
//
|
|
5228
|
+
// packages/temporal/plain-month-day.ts
|
|
5191
5229
|
function read$6(item) {
|
|
5192
5230
|
const slot = getMonthDaySlot(item);
|
|
5193
5231
|
if (!slot) throw new TypeError("Invalid PlainMonthDay receiver");
|
|
@@ -5295,7 +5333,7 @@ defineGetters(PlainMonthDayValue.prototype, [
|
|
|
5295
5333
|
"monthCode",
|
|
5296
5334
|
"day"
|
|
5297
5335
|
], (receiver, name) => dateProperty(read$6(receiver), name, true));
|
|
5298
|
-
//
|
|
5336
|
+
// packages/temporal/plain-date.ts
|
|
5299
5337
|
function read$5(item) {
|
|
5300
5338
|
const slot = getDateSlot(item);
|
|
5301
5339
|
if (!slot) throw new TypeError("Invalid PlainDate receiver");
|
|
@@ -5476,7 +5514,7 @@ Object.defineProperties(PlainDateValue.prototype, {
|
|
|
5476
5514
|
}
|
|
5477
5515
|
});
|
|
5478
5516
|
defineGetters(PlainDateValue.prototype, datePropertyNames, (receiver, name) => dateProperty(read$5(receiver), name));
|
|
5479
|
-
//
|
|
5517
|
+
// packages/temporal/relative-duration.ts
|
|
5480
5518
|
function toRelativeTo(value) {
|
|
5481
5519
|
if (value === void 0) return void 0;
|
|
5482
5520
|
const zoned = getZonedSlot(value), date = getDateSlot(value);
|
|
@@ -5617,7 +5655,7 @@ function relativeRound(fields, relative, largest, smallest, increment, mode) {
|
|
|
5617
5655
|
}
|
|
5618
5656
|
return roundedDateTimeDifference(start, end, relative.date.calendar, largest, smallest, increment, mode, false);
|
|
5619
5657
|
}
|
|
5620
|
-
//
|
|
5658
|
+
// packages/temporal/duration.ts
|
|
5621
5659
|
const slots$1 = /* @__PURE__ */ new WeakMap();
|
|
5622
5660
|
const getSlot$1 = slots$1.get.bind(slots$1);
|
|
5623
5661
|
const setSlot$1 = slots$1.set.bind(slots$1);
|
|
@@ -5832,7 +5870,7 @@ Object.defineProperties(DurationValue.prototype, {
|
|
|
5832
5870
|
configurable: true
|
|
5833
5871
|
}
|
|
5834
5872
|
});
|
|
5835
|
-
//
|
|
5873
|
+
// packages/temporal/plain-time.ts
|
|
5836
5874
|
const names = [
|
|
5837
5875
|
"hour",
|
|
5838
5876
|
"minute",
|
|
@@ -6064,7 +6102,7 @@ Object.defineProperties(PlainTimeValue.prototype, {
|
|
|
6064
6102
|
}
|
|
6065
6103
|
});
|
|
6066
6104
|
defineGetters(PlainTimeValue.prototype, names, (receiver, _name, index) => fields$1(read$3(receiver))[index]);
|
|
6067
|
-
//
|
|
6105
|
+
// packages/temporal/zoned-date-time.ts
|
|
6068
6106
|
function read$2(value) {
|
|
6069
6107
|
const slot = getZonedSlot(value);
|
|
6070
6108
|
if (!slot) throw new TypeError("Invalid ZonedDateTime receiver");
|
|
@@ -6530,7 +6568,7 @@ defineGetters(ZonedDateTimeValue.prototype, [...datePropertyNames, ...clockNames
|
|
|
6530
6568
|
calendar: slot.calendar
|
|
6531
6569
|
}, name);
|
|
6532
6570
|
});
|
|
6533
|
-
//
|
|
6571
|
+
// packages/temporal/instant.ts
|
|
6534
6572
|
function instantString(value, precision = "auto", offset) {
|
|
6535
6573
|
const native = nativeTemporal();
|
|
6536
6574
|
return native ? native.formatInstant(value, precision, offset) : formatInstant(value, precision, offset);
|
|
@@ -6703,7 +6741,7 @@ Object.defineProperties(InstantValue.prototype, {
|
|
|
6703
6741
|
configurable: true
|
|
6704
6742
|
}
|
|
6705
6743
|
});
|
|
6706
|
-
//
|
|
6744
|
+
// packages/temporal/now.ts
|
|
6707
6745
|
const limit = 8640000000000000000000n;
|
|
6708
6746
|
function createNow(clock) {
|
|
6709
6747
|
function instant() {
|
|
@@ -6767,16 +6805,16 @@ const Now = createNow({
|
|
|
6767
6805
|
epochNanoseconds: () => systemClock.epochNanoseconds(),
|
|
6768
6806
|
timeZoneId: () => systemClock.timeZoneId()
|
|
6769
6807
|
});
|
|
6770
|
-
//
|
|
6808
|
+
// packages/temporal/date-bridge.ts
|
|
6771
6809
|
const getTime = Function.prototype.call.bind(Date.prototype.getTime);
|
|
6772
6810
|
function createDateToTemporalInstant(create) {
|
|
6773
6811
|
return { toTemporalInstant() {
|
|
6774
6812
|
return create(BigInt(getTime(this)) * 1000000n);
|
|
6775
6813
|
} }.toTemporalInstant;
|
|
6776
6814
|
}
|
|
6777
|
-
//
|
|
6815
|
+
// packages/temporal/date-to-temporal-instant.ts
|
|
6778
6816
|
const toTemporalInstant = createDateToTemporalInstant(createInstant);
|
|
6779
|
-
//
|
|
6817
|
+
// packages/temporal/index.ts
|
|
6780
6818
|
const Temporal = Object.defineProperties({}, {
|
|
6781
6819
|
Now: {
|
|
6782
6820
|
value: Now,
|
|
@@ -6828,7 +6866,7 @@ const Temporal = Object.defineProperties({}, {
|
|
|
6828
6866
|
configurable: true
|
|
6829
6867
|
}
|
|
6830
6868
|
});
|
|
6831
|
-
//
|
|
6869
|
+
// packages/temporal/wasm.ts
|
|
6832
6870
|
const Instance = typeof WebAssembly === "object" ? WebAssembly.Instance : void 0;
|
|
6833
6871
|
const Memory = typeof WebAssembly === "object" ? WebAssembly.Memory : void 0;
|
|
6834
6872
|
const Bytes = Uint8Array;
|
|
@@ -6885,7 +6923,7 @@ function createWasmQuery(instance) {
|
|
|
6885
6923
|
function configureWasmBackend(instance) {
|
|
6886
6924
|
configureNativeTemporal(createWasmQuery(instance));
|
|
6887
6925
|
}
|
|
6888
|
-
//
|
|
6926
|
+
// packages/temporal/detect.ts
|
|
6889
6927
|
const constructors = [
|
|
6890
6928
|
"Instant",
|
|
6891
6929
|
"Duration",
|
|
@@ -6913,7 +6951,7 @@ function needsTemporal() {
|
|
|
6913
6951
|
for (let i = 0; i < nowMethods.length; i++) if (typeof now[nowMethods[i]] !== "function") return true;
|
|
6914
6952
|
return false;
|
|
6915
6953
|
}
|
|
6916
|
-
//
|
|
6954
|
+
// node_modules/.aspect_rules_js/@formatjs+bigdecimal@0.0.0/node_modules/@formatjs/bigdecimal/index.js
|
|
6917
6955
|
const DIV_PRECISION = 40;
|
|
6918
6956
|
function removeTrailingZeros(mantissa, exponent) {
|
|
6919
6957
|
if (mantissa === 0n) return [0n, 0];
|
|
@@ -7393,7 +7431,7 @@ var BigDecimal = class BigDecimal {
|
|
|
7393
7431
|
return BigDecimal._create(0n, 0, 1, false);
|
|
7394
7432
|
}
|
|
7395
7433
|
};
|
|
7396
|
-
//
|
|
7434
|
+
// packages/ecma262-abstract/ToNumber.js
|
|
7397
7435
|
/**
|
|
7398
7436
|
* ECMA-262 §7.1.4 ToNumber, steps 2, 8–10.
|
|
7399
7437
|
* https://tc39.es/ecma262/#sec-tonumber
|
|
@@ -7402,7 +7440,7 @@ var BigDecimal = class BigDecimal {
|
|
|
7402
7440
|
function ToNumber(arg) {
|
|
7403
7441
|
return new BigDecimal(+arg);
|
|
7404
7442
|
}
|
|
7405
|
-
//
|
|
7443
|
+
// packages/ecma402-abstract/DateTimeFormat/TemporalDateTime.js
|
|
7406
7444
|
const readers$1 = [];
|
|
7407
7445
|
const registered = /* @__PURE__ */ new WeakSet();
|
|
7408
7446
|
function registerTemporalDateTimeNamespace(temporal) {
|
|
@@ -7485,11 +7523,11 @@ function ToDateTimeFormattable(value) {
|
|
|
7485
7523
|
return ToNumber(value);
|
|
7486
7524
|
}
|
|
7487
7525
|
new BigDecimal(0);
|
|
7488
|
-
//
|
|
7526
|
+
// packages/ecma402-abstract/DateTimeFormat/HandleDateTimeValue.js
|
|
7489
7527
|
function isTemporalDateTimeValue(value) {
|
|
7490
7528
|
return Object.prototype.hasOwnProperty.call(value, "kind");
|
|
7491
7529
|
}
|
|
7492
|
-
//
|
|
7530
|
+
// packages/temporal/legacy-intl.ts
|
|
7493
7531
|
const now = Date.now;
|
|
7494
7532
|
function installLegacyDateTimeFormat(namespace) {
|
|
7495
7533
|
const Native = globalThis.Intl?.DateTimeFormat;
|
|
@@ -7652,7 +7690,7 @@ function installLegacyDateTimeFormat(namespace) {
|
|
|
7652
7690
|
});
|
|
7653
7691
|
globalThis.Intl.DateTimeFormat = DateTimeFormat;
|
|
7654
7692
|
}
|
|
7655
|
-
//
|
|
7693
|
+
// packages/ecma402-abstract/DurationFormat/constants.js
|
|
7656
7694
|
const TABLE_1 = [
|
|
7657
7695
|
"years",
|
|
7658
7696
|
"months",
|
|
@@ -7665,7 +7703,7 @@ const TABLE_1 = [
|
|
|
7665
7703
|
"microseconds",
|
|
7666
7704
|
"nanoseconds"
|
|
7667
7705
|
];
|
|
7668
|
-
//
|
|
7706
|
+
// packages/ecma402-abstract/DurationFormat/DurationRecordSign.js
|
|
7669
7707
|
function DurationRecordSign(record) {
|
|
7670
7708
|
for (const key of TABLE_1) {
|
|
7671
7709
|
if (record[key] < 0) return -1;
|
|
@@ -7673,7 +7711,7 @@ function DurationRecordSign(record) {
|
|
|
7673
7711
|
}
|
|
7674
7712
|
return 0;
|
|
7675
7713
|
}
|
|
7676
|
-
//
|
|
7714
|
+
// packages/ecma402-abstract/DurationFormat/IsValidDurationRecord.js
|
|
7677
7715
|
function IsValidDurationRecord(record) {
|
|
7678
7716
|
const sign = DurationRecordSign(record);
|
|
7679
7717
|
for (const key of TABLE_1) {
|
|
@@ -7692,7 +7730,7 @@ function IsValidDurationRecord(record) {
|
|
|
7692
7730
|
const limit = BigInt(2 ** 53) * billion;
|
|
7693
7731
|
return normalizedNanoseconds > -limit && normalizedNanoseconds < limit;
|
|
7694
7732
|
}
|
|
7695
|
-
//
|
|
7733
|
+
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
7696
7734
|
function memoize(fn, options) {
|
|
7697
7735
|
const cache = options && options.cache ? options.cache : cacheDefault;
|
|
7698
7736
|
const serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -7757,20 +7795,20 @@ const strategies = {
|
|
|
7757
7795
|
variadic: strategyVariadic,
|
|
7758
7796
|
monadic: strategyMonadic
|
|
7759
7797
|
};
|
|
7760
|
-
//
|
|
7798
|
+
// packages/ecma402-abstract/utils.js
|
|
7761
7799
|
function invariant(condition, message, Err = Error) {
|
|
7762
7800
|
if (!condition) throw new Err(message);
|
|
7763
7801
|
}
|
|
7764
7802
|
memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
7765
7803
|
memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
7766
7804
|
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
7767
|
-
//
|
|
7805
|
+
// packages/ecma402-abstract/DurationFormat/ToIntegerIfIntegral.js
|
|
7768
7806
|
function ToIntegerIfIntegral(arg) {
|
|
7769
7807
|
const number = ToNumber(arg);
|
|
7770
7808
|
invariant(number.isInteger(), "Duration field is not an integer", RangeError);
|
|
7771
7809
|
return number.isZero() ? 0 : number.toNumber();
|
|
7772
7810
|
}
|
|
7773
|
-
//
|
|
7811
|
+
// packages/ecma402-abstract/DurationFormat/ToDurationRecord.js
|
|
7774
7812
|
function ToDurationRecord(input) {
|
|
7775
7813
|
if ((typeof input !== "object" || input === null) && typeof input !== "function") {
|
|
7776
7814
|
if (typeof input === "string") throw new RangeError("Invalid duration format");
|
|
@@ -7811,7 +7849,7 @@ function ToDurationRecord(input) {
|
|
|
7811
7849
|
if (!IsValidDurationRecord(result)) throw new RangeError("Invalid duration format");
|
|
7812
7850
|
return result;
|
|
7813
7851
|
}
|
|
7814
|
-
//
|
|
7852
|
+
// packages/ecma402-abstract/DurationFormat/ToTemporalDurationRecord.js
|
|
7815
7853
|
const fields = [
|
|
7816
7854
|
"years",
|
|
7817
7855
|
"months",
|
|
@@ -7860,7 +7898,7 @@ function ToTemporalDurationRecord(input) {
|
|
|
7860
7898
|
}
|
|
7861
7899
|
return ToDurationRecord(input);
|
|
7862
7900
|
}
|
|
7863
|
-
//
|
|
7901
|
+
// packages/temporal/legacy-durationformat.ts
|
|
7864
7902
|
function installLegacyDurationFormat(namespace) {
|
|
7865
7903
|
const Native = globalThis.Intl?.DurationFormat;
|
|
7866
7904
|
if (!Native || Native.__addTemporalNamespace) return;
|
|
@@ -7883,7 +7921,7 @@ function installLegacyDurationFormat(namespace) {
|
|
|
7883
7921
|
configurable: true
|
|
7884
7922
|
});
|
|
7885
7923
|
}
|
|
7886
|
-
//
|
|
7924
|
+
// packages/temporal/install.ts
|
|
7887
7925
|
function installTemporal(force = false) {
|
|
7888
7926
|
const target = globalThis, date = Date.prototype, replace = force || needsTemporal();
|
|
7889
7927
|
if (replace) Object.defineProperty(target, "Temporal", {
|
|
@@ -7909,7 +7947,7 @@ function installTemporal(force = false) {
|
|
|
7909
7947
|
});
|
|
7910
7948
|
}
|
|
7911
7949
|
}
|
|
7912
|
-
//
|
|
7950
|
+
// packages/temporal/wasm-native.ts
|
|
7913
7951
|
function configureTemporalWasm(instance) {
|
|
7914
7952
|
configureWasmBackend(instance);
|
|
7915
7953
|
return Temporal;
|