@internationalized/date 3.11.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{CalendarDate.main.js → private/CalendarDate.cjs} +102 -120
- package/dist/private/CalendarDate.cjs.map +1 -0
- package/dist/{CalendarDate.mjs → private/CalendarDate.js} +65 -65
- package/dist/private/CalendarDate.js.map +1 -0
- package/dist/{CalendarDate.module.js → private/CalendarDate.mjs} +99 -117
- package/dist/private/CalendarDate.mjs.map +1 -0
- package/dist/{DateFormatter.main.js → private/DateFormatter.cjs} +27 -27
- package/dist/private/DateFormatter.cjs.map +1 -0
- package/dist/{DateFormatter.module.js → private/DateFormatter.js} +23 -23
- package/dist/{DateFormatter.module.js.map → private/DateFormatter.js.map} +1 -1
- package/dist/{DateFormatter.mjs → private/DateFormatter.mjs} +27 -27
- package/dist/private/DateFormatter.mjs.map +1 -0
- package/dist/{BuddhistCalendar.main.js → private/calendars/BuddhistCalendar.cjs} +13 -13
- package/dist/{BuddhistCalendar.main.js.map → private/calendars/BuddhistCalendar.cjs.map} +1 -1
- package/dist/{BuddhistCalendar.module.js → private/calendars/BuddhistCalendar.js} +13 -13
- package/dist/{BuddhistCalendar.module.js.map → private/calendars/BuddhistCalendar.js.map} +1 -1
- package/dist/{BuddhistCalendar.mjs → private/calendars/BuddhistCalendar.mjs} +13 -13
- package/dist/private/calendars/BuddhistCalendar.mjs.map +1 -0
- package/dist/{EthiopicCalendar.main.js → private/calendars/EthiopicCalendar.cjs} +32 -32
- package/dist/{EthiopicCalendar.main.js.map → private/calendars/EthiopicCalendar.cjs.map} +1 -1
- package/dist/{EthiopicCalendar.module.js → private/calendars/EthiopicCalendar.js} +30 -30
- package/dist/{EthiopicCalendar.module.js.map → private/calendars/EthiopicCalendar.js.map} +1 -1
- package/dist/{EthiopicCalendar.mjs → private/calendars/EthiopicCalendar.mjs} +30 -30
- package/dist/private/calendars/EthiopicCalendar.mjs.map +1 -0
- package/dist/{GregorianCalendar.main.js → private/calendars/GregorianCalendar.cjs} +31 -31
- package/dist/{GregorianCalendar.main.js.map → private/calendars/GregorianCalendar.cjs.map} +1 -1
- package/dist/{GregorianCalendar.module.js → private/calendars/GregorianCalendar.js} +27 -27
- package/dist/{GregorianCalendar.module.js.map → private/calendars/GregorianCalendar.js.map} +1 -1
- package/dist/{GregorianCalendar.mjs → private/calendars/GregorianCalendar.mjs} +27 -27
- package/dist/private/calendars/GregorianCalendar.mjs.map +1 -0
- package/dist/{HebrewCalendar.main.js → private/calendars/HebrewCalendar.cjs} +44 -44
- package/dist/{HebrewCalendar.main.js.map → private/calendars/HebrewCalendar.cjs.map} +1 -1
- package/dist/{HebrewCalendar.module.js → private/calendars/HebrewCalendar.js} +44 -44
- package/dist/{HebrewCalendar.module.js.map → private/calendars/HebrewCalendar.js.map} +1 -1
- package/dist/{HebrewCalendar.mjs → private/calendars/HebrewCalendar.mjs} +44 -44
- package/dist/private/calendars/HebrewCalendar.mjs.map +1 -0
- package/dist/{IndianCalendar.main.js → private/calendars/IndianCalendar.cjs} +20 -20
- package/dist/{IndianCalendar.main.js.map → private/calendars/IndianCalendar.cjs.map} +1 -1
- package/dist/{IndianCalendar.module.js → private/calendars/IndianCalendar.js} +20 -20
- package/dist/{IndianCalendar.module.js.map → private/calendars/IndianCalendar.js.map} +1 -1
- package/dist/{IndianCalendar.mjs → private/calendars/IndianCalendar.mjs} +20 -20
- package/dist/private/calendars/IndianCalendar.mjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.cjs +168 -0
- package/dist/private/calendars/IslamicCalendar.cjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.js +161 -0
- package/dist/{IslamicCalendar.module.js.map → private/calendars/IslamicCalendar.js.map} +1 -1
- package/dist/private/calendars/IslamicCalendar.mjs +161 -0
- package/dist/private/calendars/IslamicCalendar.mjs.map +1 -0
- package/dist/{JapaneseCalendar.main.js → private/calendars/JapaneseCalendar.cjs} +37 -37
- package/dist/{JapaneseCalendar.main.js.map → private/calendars/JapaneseCalendar.cjs.map} +1 -1
- package/dist/{JapaneseCalendar.module.js → private/calendars/JapaneseCalendar.js} +37 -37
- package/dist/{JapaneseCalendar.module.js.map → private/calendars/JapaneseCalendar.js.map} +1 -1
- package/dist/{JapaneseCalendar.mjs → private/calendars/JapaneseCalendar.mjs} +37 -37
- package/dist/private/calendars/JapaneseCalendar.mjs.map +1 -0
- package/dist/{PersianCalendar.main.js → private/calendars/PersianCalendar.cjs} +13 -13
- package/dist/{PersianCalendar.main.js.map → private/calendars/PersianCalendar.cjs.map} +1 -1
- package/dist/{PersianCalendar.module.js → private/calendars/PersianCalendar.js} +13 -13
- package/dist/{PersianCalendar.module.js.map → private/calendars/PersianCalendar.js.map} +1 -1
- package/dist/{PersianCalendar.mjs → private/calendars/PersianCalendar.mjs} +13 -13
- package/dist/private/calendars/PersianCalendar.mjs.map +1 -0
- package/dist/{TaiwanCalendar.main.js → private/calendars/TaiwanCalendar.cjs} +20 -20
- package/dist/{TaiwanCalendar.main.js.map → private/calendars/TaiwanCalendar.cjs.map} +1 -1
- package/dist/private/calendars/TaiwanCalendar.js +75 -0
- package/dist/{TaiwanCalendar.module.js.map → private/calendars/TaiwanCalendar.js.map} +1 -1
- package/dist/{TaiwanCalendar.mjs → private/calendars/TaiwanCalendar.mjs} +20 -20
- package/dist/private/calendars/TaiwanCalendar.mjs.map +1 -0
- package/dist/private/conversion.cjs +241 -0
- package/dist/private/conversion.cjs.map +1 -0
- package/dist/private/conversion.js +222 -0
- package/dist/private/conversion.js.map +1 -0
- package/dist/private/conversion.mjs +222 -0
- package/dist/private/conversion.mjs.map +1 -0
- package/dist/private/createCalendar.cjs +69 -0
- package/dist/{createCalendar.main.js.map → private/createCalendar.cjs.map} +1 -1
- package/dist/private/createCalendar.js +64 -0
- package/dist/{createCalendar.module.js.map → private/createCalendar.js.map} +1 -1
- package/dist/private/createCalendar.mjs +64 -0
- package/dist/private/createCalendar.mjs.map +1 -0
- package/dist/{manipulation.main.js → private/manipulation.cjs} +106 -109
- package/dist/private/manipulation.cjs.map +1 -0
- package/dist/{manipulation.mjs → private/manipulation.js} +88 -88
- package/dist/{manipulation.module.js.map → private/manipulation.js.map} +1 -1
- package/dist/{manipulation.module.js → private/manipulation.mjs} +93 -96
- package/dist/private/manipulation.mjs.map +1 -0
- package/dist/private/queries.cjs +359 -0
- package/dist/private/queries.cjs.map +1 -0
- package/dist/private/queries.js +326 -0
- package/dist/private/queries.js.map +1 -0
- package/dist/private/queries.mjs +324 -0
- package/dist/private/queries.mjs.map +1 -0
- package/dist/private/string.cjs +181 -0
- package/dist/private/string.cjs.map +1 -0
- package/dist/{string.mjs → private/string.js} +64 -64
- package/dist/{string.module.js.map → private/string.js.map} +1 -1
- package/dist/private/string.mjs +166 -0
- package/dist/private/string.mjs.map +1 -0
- package/dist/{utils.main.js → private/utils.cjs} +3 -3
- package/dist/{utils.main.js.map → private/utils.cjs.map} +1 -1
- package/dist/{utils.module.js → private/utils.js} +3 -3
- package/dist/{utils.module.js.map → private/utils.js.map} +1 -1
- package/dist/{utils.mjs → private/utils.mjs} +3 -3
- package/dist/private/utils.mjs.map +1 -0
- package/dist/{weekStartData.main.js → private/weekStartData.cjs} +3 -3
- package/dist/{weekStartData.main.js.map → private/weekStartData.cjs.map} +1 -1
- package/dist/{weekStartData.module.js → private/weekStartData.js} +3 -3
- package/dist/{weekStartData.module.js.map → private/weekStartData.js.map} +1 -1
- package/dist/{weekStartData.mjs → private/weekStartData.mjs} +3 -3
- package/dist/private/weekStartData.mjs.map +1 -0
- package/dist/types/src/CalendarDate.d.ts +177 -0
- package/dist/types/src/DateFormatter.d.ts +21 -0
- package/dist/types/src/calendars/BuddhistCalendar.d.ts +16 -0
- package/dist/types/src/calendars/EthiopicCalendar.d.ts +45 -0
- package/dist/types/src/calendars/GregorianCalendar.d.ts +25 -0
- package/dist/types/src/calendars/HebrewCalendar.d.ts +21 -0
- package/dist/types/src/calendars/IndianCalendar.d.ts +17 -0
- package/dist/types/src/calendars/IslamicCalendar.d.ts +48 -0
- package/dist/types/src/calendars/JapaneseCalendar.d.ts +21 -0
- package/dist/types/src/calendars/PersianCalendar.d.ts +19 -0
- package/dist/types/src/calendars/TaiwanCalendar.d.ts +19 -0
- package/dist/types/src/conversion.d.ts +42 -0
- package/dist/types/src/createCalendar.d.ts +3 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/manipulation.d.ts +25 -0
- package/dist/types/src/queries.d.ts +87 -0
- package/dist/types/src/string.d.ts +35 -0
- package/dist/types/src/types.d.ts +132 -0
- package/dist/types/src/utils.d.ts +4 -0
- package/dist/types/src/weekStartData.d.ts +97 -0
- package/package.json +26 -11
- package/src/CalendarDate.ts +2 -0
- package/src/conversion.ts +10 -3
- package/src/index.ts +2 -0
- package/src/queries.ts +9 -3
- package/dist/CalendarDate.main.js.map +0 -1
- package/dist/CalendarDate.module.js.map +0 -1
- package/dist/DateFormatter.main.js.map +0 -1
- package/dist/IslamicCalendar.main.js +0 -168
- package/dist/IslamicCalendar.main.js.map +0 -1
- package/dist/IslamicCalendar.mjs +0 -161
- package/dist/IslamicCalendar.module.js +0 -161
- package/dist/TaiwanCalendar.module.js +0 -75
- package/dist/conversion.main.js +0 -236
- package/dist/conversion.main.js.map +0 -1
- package/dist/conversion.mjs +0 -218
- package/dist/conversion.module.js +0 -218
- package/dist/conversion.module.js.map +0 -1
- package/dist/createCalendar.main.js +0 -69
- package/dist/createCalendar.mjs +0 -64
- package/dist/createCalendar.module.js +0 -64
- package/dist/import.mjs +0 -45
- package/dist/main.js +0 -112
- package/dist/main.js.map +0 -1
- package/dist/manipulation.main.js.map +0 -1
- package/dist/module.js +0 -45
- package/dist/module.js.map +0 -1
- package/dist/queries.main.js +0 -354
- package/dist/queries.main.js.map +0 -1
- package/dist/queries.mjs +0 -320
- package/dist/queries.module.js +0 -320
- package/dist/queries.module.js.map +0 -1
- package/dist/string.main.js +0 -190
- package/dist/string.main.js.map +0 -1
- package/dist/string.module.js +0 -175
- package/dist/types.d.ts +0 -668
- package/dist/types.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {CalendarDate as $
|
|
2
|
-
import {mod as $
|
|
1
|
+
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
|
|
2
|
+
import {mod as $09ec6a572d60460f$export$842a2cf37af977e1} from "../utils.mjs";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -15,9 +15,9 @@ import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs";
|
|
|
15
15
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const $
|
|
18
|
+
const $a0cc0739a536c3b1$var$PERSIAN_EPOCH = 1948320;
|
|
19
19
|
// Number of days from the start of the year to the start of each month.
|
|
20
|
-
const $
|
|
20
|
+
const $a0cc0739a536c3b1$var$MONTH_START = [
|
|
21
21
|
0,
|
|
22
22
|
31,
|
|
23
23
|
62,
|
|
@@ -31,19 +31,19 @@ const $f3ed2e4472ae7e25$var$MONTH_START = [
|
|
|
31
31
|
306,
|
|
32
32
|
336 // Esfand
|
|
33
33
|
];
|
|
34
|
-
class $
|
|
34
|
+
class $a0cc0739a536c3b1$export$37fccdbfd14c5939 {
|
|
35
35
|
fromJulianDay(jd) {
|
|
36
|
-
let daysSinceEpoch = jd - $
|
|
36
|
+
let daysSinceEpoch = jd - $a0cc0739a536c3b1$var$PERSIAN_EPOCH;
|
|
37
37
|
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
|
|
38
38
|
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
|
|
39
39
|
let dayOfYear = daysSinceEpoch - farvardin1;
|
|
40
40
|
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
|
|
41
|
-
let day = dayOfYear - $
|
|
42
|
-
return new (0, $
|
|
41
|
+
let day = dayOfYear - $a0cc0739a536c3b1$var$MONTH_START[month] + 1;
|
|
42
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, year, month + 1, day);
|
|
43
43
|
}
|
|
44
44
|
toJulianDay(date) {
|
|
45
|
-
let jd = $
|
|
46
|
-
jd += $
|
|
45
|
+
let jd = $a0cc0739a536c3b1$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
|
|
46
|
+
jd += $a0cc0739a536c3b1$var$MONTH_START[date.month - 1];
|
|
47
47
|
jd += date.day;
|
|
48
48
|
return jd;
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
|
|
|
53
53
|
getDaysInMonth(date) {
|
|
54
54
|
if (date.month <= 6) return 31;
|
|
55
55
|
if (date.month <= 11) return 30;
|
|
56
|
-
let isLeapYear = (0, $
|
|
56
|
+
let isLeapYear = (0, $09ec6a572d60460f$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
|
|
57
57
|
return isLeapYear ? 30 : 29;
|
|
58
58
|
}
|
|
59
59
|
getMaximumMonthsInYear() {
|
|
@@ -78,5 +78,5 @@ class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
export {$
|
|
82
|
-
//# sourceMappingURL=PersianCalendar.
|
|
81
|
+
export {$a0cc0739a536c3b1$export$37fccdbfd14c5939 as PersianCalendar};
|
|
82
|
+
//# sourceMappingURL=PersianCalendar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,sCAAgB;AAEtB,wEAAwE;AACxE,MAAM,oCAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAK,SAAS;CACf;AAQM,MAAM;IAGX,cAAc,EAAU,EAAgB;QACtC,IAAI,iBAAiB,KAAK;QAC1B,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,iBAAiB,CAAA,IAAK;QACtD,IAAI,aAAa,MAAO,CAAA,OAAO,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,OAAO,EAAC,IAAK;QACjE,IAAI,YAAY,iBAAiB;QACjC,IAAI,QAAQ,YAAY,MACpB,KAAK,KAAK,CAAC,YAAY,MACvB,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACjC,IAAI,MAAM,YAAY,iCAAW,CAAC,MAAM,GAAG;QAC3C,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,MAAM,QAAQ,GAAG;IACjD;IAEA,YAAY,IAAqB,EAAU;QACzC,IAAI,KAAK,sCAAgB,IAAI,MAAO,CAAA,KAAK,IAAI,GAAG,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAI,GAAG,EAAC,IAAK;QACvF,MAAM,iCAAW,CAAC,KAAK,KAAK,GAAG,EAAE;QACjC,MAAM,KAAK,GAAG;QACd,OAAO;IACT;IAEA,kBAA0B;QACxB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,IAAI,GAChB,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,IAChB,OAAO;QAGT,IAAI,aAAa,CAAA,GAAA,yCAAE,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,MAAM;QAChD,OAAO,aAAa,KAAK;IAC3B;IAEA,yBAAiC;QAC/B,OAAO;IACT;IAEA,wBAAgC;QAC9B,OAAO;IACT;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aAtDA,aAAiC;;AAuDnC","sources":["packages/@internationalized/date/src/calendars/PersianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier: CalendarIdentifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getMaximumMonthsInYear(): number {\n return 12;\n }\n\n getMaximumDaysInMonth(): number {\n return 31;\n }\n\n getEras(): string[] {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n"],"names":[],"version":3,"file":"PersianCalendar.mjs.map"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
|
|
2
|
+
var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
function $parcel$export(e, n, v, s) {
|
|
6
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
$parcel$export(module.exports, "TaiwanCalendar", ()
|
|
9
|
+
$parcel$export(module.exports, "TaiwanCalendar", function () { return $2dab1d4ea1fc722b$export$65e01080afcb0799; });
|
|
10
10
|
/*
|
|
11
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
12
12
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -21,12 +21,12 @@ $parcel$export(module.exports, "TaiwanCalendar", () => $9cc5d3577ec40243$export$
|
|
|
21
21
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
const $
|
|
25
|
-
function $
|
|
26
|
-
return date.era === 'minguo' ? date.year + $
|
|
24
|
+
const $2dab1d4ea1fc722b$var$TAIWAN_ERA_START = 1911;
|
|
25
|
+
function $2dab1d4ea1fc722b$var$gregorianYear(date) {
|
|
26
|
+
return date.era === 'minguo' ? date.year + $2dab1d4ea1fc722b$var$TAIWAN_ERA_START : 1 - date.year + $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
|
|
27
27
|
}
|
|
28
|
-
function $
|
|
29
|
-
let y = year - $
|
|
28
|
+
function $2dab1d4ea1fc722b$var$gregorianToTaiwan(year) {
|
|
29
|
+
let y = year - $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
|
|
30
30
|
if (y > 0) return [
|
|
31
31
|
'minguo',
|
|
32
32
|
y
|
|
@@ -36,15 +36,15 @@ function $9cc5d3577ec40243$var$gregorianToTaiwan(year) {
|
|
|
36
36
|
1 - y
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
class $
|
|
39
|
+
class $2dab1d4ea1fc722b$export$65e01080afcb0799 extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
|
|
40
40
|
fromJulianDay(jd) {
|
|
41
41
|
let date = super.fromJulianDay(jd);
|
|
42
|
-
let extendedYear = (0, $
|
|
43
|
-
let [era, year] = $
|
|
44
|
-
return new (0, $
|
|
42
|
+
let extendedYear = (0, $05031860ba2f881f$exports.getExtendedYear)(date.era, date.year);
|
|
43
|
+
let [era, year] = $2dab1d4ea1fc722b$var$gregorianToTaiwan(extendedYear);
|
|
44
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, date.month, date.day);
|
|
45
45
|
}
|
|
46
46
|
toJulianDay(date) {
|
|
47
|
-
return super.toJulianDay($
|
|
47
|
+
return super.toJulianDay($2dab1d4ea1fc722b$var$toGregorian(date));
|
|
48
48
|
}
|
|
49
49
|
getEras() {
|
|
50
50
|
return [
|
|
@@ -53,7 +53,7 @@ class $9cc5d3577ec40243$export$65e01080afcb0799 extends (0, $af14c9812fdceb33$ex
|
|
|
53
53
|
];
|
|
54
54
|
}
|
|
55
55
|
balanceDate(date) {
|
|
56
|
-
let [era, year] = $
|
|
56
|
+
let [era, year] = $2dab1d4ea1fc722b$var$gregorianToTaiwan($2dab1d4ea1fc722b$var$gregorianYear(date));
|
|
57
57
|
date.era = era;
|
|
58
58
|
date.year = year;
|
|
59
59
|
}
|
|
@@ -61,20 +61,20 @@ class $9cc5d3577ec40243$export$65e01080afcb0799 extends (0, $af14c9812fdceb33$ex
|
|
|
61
61
|
return date.era === 'before_minguo';
|
|
62
62
|
}
|
|
63
63
|
getDaysInMonth(date) {
|
|
64
|
-
return super.getDaysInMonth($
|
|
64
|
+
return super.getDaysInMonth($2dab1d4ea1fc722b$var$toGregorian(date));
|
|
65
65
|
}
|
|
66
66
|
getYearsInEra(date) {
|
|
67
|
-
return date.era === 'before_minguo' ? 9999 : 9999 - $
|
|
67
|
+
return date.era === 'before_minguo' ? 9999 : 9999 - $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
|
|
68
68
|
}
|
|
69
69
|
constructor(...args){
|
|
70
70
|
super(...args), this.identifier = 'roc' // Republic of China
|
|
71
71
|
;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function $
|
|
75
|
-
let [era, year] = (0, $
|
|
76
|
-
return new (0, $
|
|
74
|
+
function $2dab1d4ea1fc722b$var$toGregorian(date) {
|
|
75
|
+
let [era, year] = (0, $05031860ba2f881f$exports.fromExtendedYear)($2dab1d4ea1fc722b$var$gregorianYear(date));
|
|
76
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(era, year, date.month, date.day);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
//# sourceMappingURL=TaiwanCalendar.
|
|
80
|
+
//# sourceMappingURL=TaiwanCalendar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,2CAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier: CalendarIdentifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,2CAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier: CalendarIdentifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.cjs.map"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
|
|
2
|
+
import {fromExtendedYear as $f25df78da1f6b40f$export$4475b7e617eb123c, getExtendedYear as $f25df78da1f6b40f$export$c36e0ecb2d4fa69d, GregorianCalendar as $f25df78da1f6b40f$export$80ee6245ec4f29ec} from "./GregorianCalendar.js";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
15
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $0e7b6ab888014459$var$TAIWAN_ERA_START = 1911;
|
|
19
|
+
function $0e7b6ab888014459$var$gregorianYear(date) {
|
|
20
|
+
return date.era === 'minguo' ? date.year + $0e7b6ab888014459$var$TAIWAN_ERA_START : 1 - date.year + $0e7b6ab888014459$var$TAIWAN_ERA_START;
|
|
21
|
+
}
|
|
22
|
+
function $0e7b6ab888014459$var$gregorianToTaiwan(year) {
|
|
23
|
+
let y = year - $0e7b6ab888014459$var$TAIWAN_ERA_START;
|
|
24
|
+
if (y > 0) return [
|
|
25
|
+
'minguo',
|
|
26
|
+
y
|
|
27
|
+
];
|
|
28
|
+
else return [
|
|
29
|
+
'before_minguo',
|
|
30
|
+
1 - y
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
class $0e7b6ab888014459$export$65e01080afcb0799 extends (0, $f25df78da1f6b40f$export$80ee6245ec4f29ec) {
|
|
34
|
+
fromJulianDay(jd) {
|
|
35
|
+
let date = super.fromJulianDay(jd);
|
|
36
|
+
let extendedYear = (0, $f25df78da1f6b40f$export$c36e0ecb2d4fa69d)(date.era, date.year);
|
|
37
|
+
let [era, year] = $0e7b6ab888014459$var$gregorianToTaiwan(extendedYear);
|
|
38
|
+
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
|
|
39
|
+
}
|
|
40
|
+
toJulianDay(date) {
|
|
41
|
+
return super.toJulianDay($0e7b6ab888014459$var$toGregorian(date));
|
|
42
|
+
}
|
|
43
|
+
getEras() {
|
|
44
|
+
return [
|
|
45
|
+
'before_minguo',
|
|
46
|
+
'minguo'
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
balanceDate(date) {
|
|
50
|
+
let [era, year] = $0e7b6ab888014459$var$gregorianToTaiwan($0e7b6ab888014459$var$gregorianYear(date));
|
|
51
|
+
date.era = era;
|
|
52
|
+
date.year = year;
|
|
53
|
+
}
|
|
54
|
+
isInverseEra(date) {
|
|
55
|
+
return date.era === 'before_minguo';
|
|
56
|
+
}
|
|
57
|
+
getDaysInMonth(date) {
|
|
58
|
+
return super.getDaysInMonth($0e7b6ab888014459$var$toGregorian(date));
|
|
59
|
+
}
|
|
60
|
+
getYearsInEra(date) {
|
|
61
|
+
return date.era === 'before_minguo' ? 9999 : 9999 - $0e7b6ab888014459$var$TAIWAN_ERA_START;
|
|
62
|
+
}
|
|
63
|
+
constructor(...args){
|
|
64
|
+
super(...args), this.identifier = 'roc' // Republic of China
|
|
65
|
+
;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function $0e7b6ab888014459$var$toGregorian(date) {
|
|
69
|
+
let [era, year] = (0, $f25df78da1f6b40f$export$4475b7e617eb123c)($0e7b6ab888014459$var$gregorianYear(date));
|
|
70
|
+
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(era, year, date.month, date.day);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export {$0e7b6ab888014459$export$65e01080afcb0799 as TaiwanCalendar};
|
|
75
|
+
//# sourceMappingURL=TaiwanCalendar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier: CalendarIdentifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier: CalendarIdentifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.js.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {CalendarDate as $
|
|
2
|
-
import {fromExtendedYear as $
|
|
1
|
+
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
|
|
2
|
+
import {fromExtendedYear as $93635573935797de$export$4475b7e617eb123c, getExtendedYear as $93635573935797de$export$c36e0ecb2d4fa69d, GregorianCalendar as $93635573935797de$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -15,12 +15,12 @@ import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, getExtend
|
|
|
15
15
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const $
|
|
19
|
-
function $
|
|
20
|
-
return date.era === 'minguo' ? date.year + $
|
|
18
|
+
const $c009cc5f64923054$var$TAIWAN_ERA_START = 1911;
|
|
19
|
+
function $c009cc5f64923054$var$gregorianYear(date) {
|
|
20
|
+
return date.era === 'minguo' ? date.year + $c009cc5f64923054$var$TAIWAN_ERA_START : 1 - date.year + $c009cc5f64923054$var$TAIWAN_ERA_START;
|
|
21
21
|
}
|
|
22
|
-
function $
|
|
23
|
-
let y = year - $
|
|
22
|
+
function $c009cc5f64923054$var$gregorianToTaiwan(year) {
|
|
23
|
+
let y = year - $c009cc5f64923054$var$TAIWAN_ERA_START;
|
|
24
24
|
if (y > 0) return [
|
|
25
25
|
'minguo',
|
|
26
26
|
y
|
|
@@ -30,15 +30,15 @@ function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
|
|
|
30
30
|
1 - y
|
|
31
31
|
];
|
|
32
32
|
}
|
|
33
|
-
class $
|
|
33
|
+
class $c009cc5f64923054$export$65e01080afcb0799 extends (0, $93635573935797de$export$80ee6245ec4f29ec) {
|
|
34
34
|
fromJulianDay(jd) {
|
|
35
35
|
let date = super.fromJulianDay(jd);
|
|
36
|
-
let extendedYear = (0, $
|
|
37
|
-
let [era, year] = $
|
|
38
|
-
return new (0, $
|
|
36
|
+
let extendedYear = (0, $93635573935797de$export$c36e0ecb2d4fa69d)(date.era, date.year);
|
|
37
|
+
let [era, year] = $c009cc5f64923054$var$gregorianToTaiwan(extendedYear);
|
|
38
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
|
|
39
39
|
}
|
|
40
40
|
toJulianDay(date) {
|
|
41
|
-
return super.toJulianDay($
|
|
41
|
+
return super.toJulianDay($c009cc5f64923054$var$toGregorian(date));
|
|
42
42
|
}
|
|
43
43
|
getEras() {
|
|
44
44
|
return [
|
|
@@ -47,7 +47,7 @@ class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends (0, $3b62074eb05584b2$ex
|
|
|
47
47
|
];
|
|
48
48
|
}
|
|
49
49
|
balanceDate(date) {
|
|
50
|
-
let [era, year] = $
|
|
50
|
+
let [era, year] = $c009cc5f64923054$var$gregorianToTaiwan($c009cc5f64923054$var$gregorianYear(date));
|
|
51
51
|
date.era = era;
|
|
52
52
|
date.year = year;
|
|
53
53
|
}
|
|
@@ -55,21 +55,21 @@ class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends (0, $3b62074eb05584b2$ex
|
|
|
55
55
|
return date.era === 'before_minguo';
|
|
56
56
|
}
|
|
57
57
|
getDaysInMonth(date) {
|
|
58
|
-
return super.getDaysInMonth($
|
|
58
|
+
return super.getDaysInMonth($c009cc5f64923054$var$toGregorian(date));
|
|
59
59
|
}
|
|
60
60
|
getYearsInEra(date) {
|
|
61
|
-
return date.era === 'before_minguo' ? 9999 : 9999 - $
|
|
61
|
+
return date.era === 'before_minguo' ? 9999 : 9999 - $c009cc5f64923054$var$TAIWAN_ERA_START;
|
|
62
62
|
}
|
|
63
63
|
constructor(...args){
|
|
64
64
|
super(...args), this.identifier = 'roc' // Republic of China
|
|
65
65
|
;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function $
|
|
69
|
-
let [era, year] = (0, $
|
|
70
|
-
return new (0, $
|
|
68
|
+
function $c009cc5f64923054$var$toGregorian(date) {
|
|
69
|
+
let [era, year] = (0, $93635573935797de$export$4475b7e617eb123c)($c009cc5f64923054$var$gregorianYear(date));
|
|
70
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(era, year, date.month, date.day);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
export {$
|
|
75
|
-
//# sourceMappingURL=TaiwanCalendar.
|
|
74
|
+
export {$c009cc5f64923054$export$65e01080afcb0799 as TaiwanCalendar};
|
|
75
|
+
//# sourceMappingURL=TaiwanCalendar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier: CalendarIdentifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.mjs.map"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
var $c51b7e0106f45dea$exports = require("./CalendarDate.cjs");
|
|
2
|
+
var $19485913bea41f19$exports = require("./manipulation.cjs");
|
|
3
|
+
var $05031860ba2f881f$exports = require("./calendars/GregorianCalendar.cjs");
|
|
4
|
+
var $84a63d30beb0af0f$exports = require("./queries.cjs");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$export(e, n, v, s) {
|
|
8
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
$parcel$export(module.exports, "epochFromDate", function () { return $e13115b3b86b9007$export$bd4fb2bc8bb06fb; });
|
|
12
|
+
$parcel$export(module.exports, "toCalendar", function () { return $e13115b3b86b9007$export$b4a036af3fc0b032; });
|
|
13
|
+
$parcel$export(module.exports, "possibleAbsolutes", function () { return $e13115b3b86b9007$export$136f38efe7caf549; });
|
|
14
|
+
$parcel$export(module.exports, "toAbsolute", function () { return $e13115b3b86b9007$export$5107c82f94518f5c; });
|
|
15
|
+
$parcel$export(module.exports, "toCalendarDateTime", function () { return $e13115b3b86b9007$export$b21e0b124e224484; });
|
|
16
|
+
$parcel$export(module.exports, "toDate", function () { return $e13115b3b86b9007$export$e67a095c620b86fe; });
|
|
17
|
+
$parcel$export(module.exports, "fromAbsolute", function () { return $e13115b3b86b9007$export$1b96692a1ba042ac; });
|
|
18
|
+
$parcel$export(module.exports, "fromDate", function () { return $e13115b3b86b9007$export$e57ff100d91bd4b9; });
|
|
19
|
+
$parcel$export(module.exports, "fromDateToLocal", function () { return $e13115b3b86b9007$export$d7f92bcd3596b086; });
|
|
20
|
+
$parcel$export(module.exports, "toCalendarDate", function () { return $e13115b3b86b9007$export$93522d1a439f3617; });
|
|
21
|
+
$parcel$export(module.exports, "toTime", function () { return $e13115b3b86b9007$export$d33f79e3ffc3dc83; });
|
|
22
|
+
$parcel$export(module.exports, "toZoned", function () { return $e13115b3b86b9007$export$84c95a83c799e074; });
|
|
23
|
+
$parcel$export(module.exports, "toTimeZone", function () { return $e13115b3b86b9007$export$538b00033cc11c75; });
|
|
24
|
+
$parcel$export(module.exports, "zonedToDate", function () { return $e13115b3b86b9007$export$83aac07b4c37b25; });
|
|
25
|
+
$parcel$export(module.exports, "toLocalTimeZone", function () { return $e13115b3b86b9007$export$d9b67bc93c097491; });
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
|
|
37
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
function $e13115b3b86b9007$export$bd4fb2bc8bb06fb(date) {
|
|
43
|
+
date = $e13115b3b86b9007$export$b4a036af3fc0b032(date, new (0, $05031860ba2f881f$exports.GregorianCalendar)());
|
|
44
|
+
let year = (0, $05031860ba2f881f$exports.getExtendedYear)(date.era, date.year);
|
|
45
|
+
return $e13115b3b86b9007$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
46
|
+
}
|
|
47
|
+
function $e13115b3b86b9007$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
|
|
48
|
+
// Note: Date.UTC() interprets one and two-digit years as being in the
|
|
49
|
+
// 20th century, so don't use it
|
|
50
|
+
let date = new Date();
|
|
51
|
+
date.setUTCHours(hour, minute, second, millisecond);
|
|
52
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
53
|
+
return date.getTime();
|
|
54
|
+
}
|
|
55
|
+
function $e13115b3b86b9007$export$59c99f3515d3493f(ms, timeZone) {
|
|
56
|
+
// Fast path for UTC.
|
|
57
|
+
if (timeZone === 'UTC') return 0;
|
|
58
|
+
// Fast path: for local timezone after 1970, use native Date.
|
|
59
|
+
// Skip this fast path if the local timezone was explicitly overridden via setLocalTimeZone,
|
|
60
|
+
// since native Date always uses the browser's timezone, not the overridden one.
|
|
61
|
+
if (ms > 0 && timeZone === (0, $84a63d30beb0af0f$exports.getLocalTimeZone)() && !(0, $84a63d30beb0af0f$exports.isLocalTimeZoneOverridden)()) return new Date(ms).getTimezoneOffset() * -60000;
|
|
62
|
+
let { year: year, month: month, day: day, hour: hour, minute: minute, second: second } = $e13115b3b86b9007$var$getTimeZoneParts(ms, timeZone);
|
|
63
|
+
let utc = $e13115b3b86b9007$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
64
|
+
return utc - Math.floor(ms / 1000) * 1000;
|
|
65
|
+
}
|
|
66
|
+
const $e13115b3b86b9007$var$formattersByTimeZone = new Map();
|
|
67
|
+
function $e13115b3b86b9007$var$getTimeZoneParts(ms, timeZone) {
|
|
68
|
+
let formatter = $e13115b3b86b9007$var$formattersByTimeZone.get(timeZone);
|
|
69
|
+
if (!formatter) {
|
|
70
|
+
formatter = new Intl.DateTimeFormat('en-US', {
|
|
71
|
+
timeZone: timeZone,
|
|
72
|
+
hour12: false,
|
|
73
|
+
era: 'short',
|
|
74
|
+
year: 'numeric',
|
|
75
|
+
month: 'numeric',
|
|
76
|
+
day: 'numeric',
|
|
77
|
+
hour: 'numeric',
|
|
78
|
+
minute: 'numeric',
|
|
79
|
+
second: 'numeric'
|
|
80
|
+
});
|
|
81
|
+
$e13115b3b86b9007$var$formattersByTimeZone.set(timeZone, formatter);
|
|
82
|
+
}
|
|
83
|
+
let parts = formatter.formatToParts(new Date(ms));
|
|
84
|
+
let namedParts = {};
|
|
85
|
+
for (let part of parts)if (part.type !== 'literal') namedParts[part.type] = part.value;
|
|
86
|
+
return {
|
|
87
|
+
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
|
|
88
|
+
year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,
|
|
89
|
+
month: +namedParts.month,
|
|
90
|
+
day: +namedParts.day,
|
|
91
|
+
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
|
|
92
|
+
minute: +namedParts.minute,
|
|
93
|
+
second: +namedParts.second
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const $e13115b3b86b9007$var$DAYMILLIS = 86400000;
|
|
97
|
+
function $e13115b3b86b9007$export$136f38efe7caf549(date, timeZone) {
|
|
98
|
+
let ms = $e13115b3b86b9007$export$bd4fb2bc8bb06fb(date);
|
|
99
|
+
let earlier = ms - $e13115b3b86b9007$export$59c99f3515d3493f(ms - $e13115b3b86b9007$var$DAYMILLIS, timeZone);
|
|
100
|
+
let later = ms - $e13115b3b86b9007$export$59c99f3515d3493f(ms + $e13115b3b86b9007$var$DAYMILLIS, timeZone);
|
|
101
|
+
return $e13115b3b86b9007$var$getValidWallTimes(date, timeZone, earlier, later);
|
|
102
|
+
}
|
|
103
|
+
function $e13115b3b86b9007$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
104
|
+
let found = earlier === later ? [
|
|
105
|
+
earlier
|
|
106
|
+
] : [
|
|
107
|
+
earlier,
|
|
108
|
+
later
|
|
109
|
+
];
|
|
110
|
+
return found.filter((absolute)=>$e13115b3b86b9007$var$isValidWallTime(date, timeZone, absolute));
|
|
111
|
+
}
|
|
112
|
+
function $e13115b3b86b9007$var$isValidWallTime(date, timeZone, absolute) {
|
|
113
|
+
let parts = $e13115b3b86b9007$var$getTimeZoneParts(absolute, timeZone);
|
|
114
|
+
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
|
|
115
|
+
}
|
|
116
|
+
function $e13115b3b86b9007$export$5107c82f94518f5c(date, timeZone, disambiguation = 'compatible') {
|
|
117
|
+
let dateTime = $e13115b3b86b9007$export$b21e0b124e224484(date);
|
|
118
|
+
// Fast path: if the time zone is UTC, use native Date.
|
|
119
|
+
if (timeZone === 'UTC') return $e13115b3b86b9007$export$bd4fb2bc8bb06fb(dateTime);
|
|
120
|
+
// Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
|
|
121
|
+
// Skip this fast path if the local timezone was explicitly overridden via setLocalTimeZone,
|
|
122
|
+
// since native Date always uses the browser's timezone, not the overridden one.
|
|
123
|
+
if (timeZone === (0, $84a63d30beb0af0f$exports.getLocalTimeZone)() && disambiguation === 'compatible' && !(0, $84a63d30beb0af0f$exports.isLocalTimeZoneOverridden)()) {
|
|
124
|
+
dateTime = $e13115b3b86b9007$export$b4a036af3fc0b032(dateTime, new (0, $05031860ba2f881f$exports.GregorianCalendar)());
|
|
125
|
+
// Don't use Date constructor here because two-digit years are interpreted in the 20th century.
|
|
126
|
+
let date = new Date();
|
|
127
|
+
let year = (0, $05031860ba2f881f$exports.getExtendedYear)(dateTime.era, dateTime.year);
|
|
128
|
+
date.setFullYear(year, dateTime.month - 1, dateTime.day);
|
|
129
|
+
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
130
|
+
return date.getTime();
|
|
131
|
+
}
|
|
132
|
+
let ms = $e13115b3b86b9007$export$bd4fb2bc8bb06fb(dateTime);
|
|
133
|
+
let offsetBefore = $e13115b3b86b9007$export$59c99f3515d3493f(ms - $e13115b3b86b9007$var$DAYMILLIS, timeZone);
|
|
134
|
+
let offsetAfter = $e13115b3b86b9007$export$59c99f3515d3493f(ms + $e13115b3b86b9007$var$DAYMILLIS, timeZone);
|
|
135
|
+
let valid = $e13115b3b86b9007$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
136
|
+
if (valid.length === 1) return valid[0];
|
|
137
|
+
if (valid.length > 1) switch(disambiguation){
|
|
138
|
+
// 'compatible' means 'earlier' for "fall back" transitions
|
|
139
|
+
case 'compatible':
|
|
140
|
+
case 'earlier':
|
|
141
|
+
return valid[0];
|
|
142
|
+
case 'later':
|
|
143
|
+
return valid[valid.length - 1];
|
|
144
|
+
case 'reject':
|
|
145
|
+
throw new RangeError('Multiple possible absolute times found');
|
|
146
|
+
}
|
|
147
|
+
switch(disambiguation){
|
|
148
|
+
case 'earlier':
|
|
149
|
+
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
150
|
+
// 'compatible' means 'later' for "spring forward" transitions
|
|
151
|
+
case 'compatible':
|
|
152
|
+
case 'later':
|
|
153
|
+
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
154
|
+
case 'reject':
|
|
155
|
+
throw new RangeError('No such absolute time found');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function $e13115b3b86b9007$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = 'compatible') {
|
|
159
|
+
return new Date($e13115b3b86b9007$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
|
|
160
|
+
}
|
|
161
|
+
function $e13115b3b86b9007$export$1b96692a1ba042ac(ms, timeZone) {
|
|
162
|
+
let offset = $e13115b3b86b9007$export$59c99f3515d3493f(ms, timeZone);
|
|
163
|
+
let date = new Date(ms + offset);
|
|
164
|
+
let year = date.getUTCFullYear();
|
|
165
|
+
let month = date.getUTCMonth() + 1;
|
|
166
|
+
let day = date.getUTCDate();
|
|
167
|
+
let hour = date.getUTCHours();
|
|
168
|
+
let minute = date.getUTCMinutes();
|
|
169
|
+
let second = date.getUTCSeconds();
|
|
170
|
+
let millisecond = date.getUTCMilliseconds();
|
|
171
|
+
return new (0, $c51b7e0106f45dea$exports.ZonedDateTime)(year < 1 ? 'BC' : 'AD', year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
|
|
172
|
+
}
|
|
173
|
+
function $e13115b3b86b9007$export$e57ff100d91bd4b9(date, timeZone) {
|
|
174
|
+
return $e13115b3b86b9007$export$1b96692a1ba042ac(date.getTime(), timeZone);
|
|
175
|
+
}
|
|
176
|
+
function $e13115b3b86b9007$export$d7f92bcd3596b086(date) {
|
|
177
|
+
return $e13115b3b86b9007$export$e57ff100d91bd4b9(date, (0, $84a63d30beb0af0f$exports.getLocalTimeZone)());
|
|
178
|
+
}
|
|
179
|
+
function $e13115b3b86b9007$export$93522d1a439f3617(dateTime) {
|
|
180
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
|
|
181
|
+
}
|
|
182
|
+
function $e13115b3b86b9007$export$6f4d78149f3f53ac(date) {
|
|
183
|
+
return {
|
|
184
|
+
era: date.era,
|
|
185
|
+
year: date.year,
|
|
186
|
+
month: date.month,
|
|
187
|
+
day: date.day
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function $e13115b3b86b9007$export$4d0393e732857be5(date) {
|
|
191
|
+
return {
|
|
192
|
+
hour: date.hour,
|
|
193
|
+
minute: date.minute,
|
|
194
|
+
second: date.second,
|
|
195
|
+
millisecond: date.millisecond
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function $e13115b3b86b9007$export$b21e0b124e224484(date, time) {
|
|
199
|
+
let hour = 0, minute = 0, second = 0, millisecond = 0;
|
|
200
|
+
if ('timeZone' in date) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = date);
|
|
201
|
+
else if ('hour' in date && !time) return date;
|
|
202
|
+
if (time) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = time);
|
|
203
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDateTime)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
204
|
+
}
|
|
205
|
+
function $e13115b3b86b9007$export$d33f79e3ffc3dc83(dateTime) {
|
|
206
|
+
return new (0, $c51b7e0106f45dea$exports.Time)(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
207
|
+
}
|
|
208
|
+
function $e13115b3b86b9007$export$b4a036af3fc0b032(date, calendar) {
|
|
209
|
+
if ((0, $84a63d30beb0af0f$exports.isEqualCalendar)(date.calendar, calendar)) return date;
|
|
210
|
+
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
211
|
+
let copy = date.copy();
|
|
212
|
+
copy.calendar = calendar;
|
|
213
|
+
copy.era = calendarDate.era;
|
|
214
|
+
copy.year = calendarDate.year;
|
|
215
|
+
copy.month = calendarDate.month;
|
|
216
|
+
copy.day = calendarDate.day;
|
|
217
|
+
(0, $19485913bea41f19$exports.constrain)(copy);
|
|
218
|
+
return copy;
|
|
219
|
+
}
|
|
220
|
+
function $e13115b3b86b9007$export$84c95a83c799e074(date, timeZone, disambiguation) {
|
|
221
|
+
if (date instanceof (0, $c51b7e0106f45dea$exports.ZonedDateTime)) {
|
|
222
|
+
if (date.timeZone === timeZone) return date;
|
|
223
|
+
return $e13115b3b86b9007$export$538b00033cc11c75(date, timeZone);
|
|
224
|
+
}
|
|
225
|
+
let ms = $e13115b3b86b9007$export$5107c82f94518f5c(date, timeZone, disambiguation);
|
|
226
|
+
return $e13115b3b86b9007$export$1b96692a1ba042ac(ms, timeZone);
|
|
227
|
+
}
|
|
228
|
+
function $e13115b3b86b9007$export$83aac07b4c37b25(date) {
|
|
229
|
+
let ms = $e13115b3b86b9007$export$bd4fb2bc8bb06fb(date) - date.offset;
|
|
230
|
+
return new Date(ms);
|
|
231
|
+
}
|
|
232
|
+
function $e13115b3b86b9007$export$538b00033cc11c75(date, timeZone) {
|
|
233
|
+
let ms = $e13115b3b86b9007$export$bd4fb2bc8bb06fb(date) - date.offset;
|
|
234
|
+
return $e13115b3b86b9007$export$b4a036af3fc0b032($e13115b3b86b9007$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
|
|
235
|
+
}
|
|
236
|
+
function $e13115b3b86b9007$export$d9b67bc93c097491(date) {
|
|
237
|
+
return $e13115b3b86b9007$export$538b00033cc11c75(date, (0, $84a63d30beb0af0f$exports.getLocalTimeZone)());
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=conversion.cjs.map
|