@internationalized/date 3.5.3-nightly.4555 → 3.5.3-nightly.4558
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BuddhistCalendar.main.js +54 -0
- package/dist/BuddhistCalendar.main.js.map +1 -0
- package/dist/BuddhistCalendar.mjs +49 -0
- package/dist/BuddhistCalendar.module.js +49 -0
- package/dist/BuddhistCalendar.module.js.map +1 -0
- package/dist/CalendarDate.main.js +260 -0
- package/dist/CalendarDate.main.js.map +1 -0
- package/dist/CalendarDate.mjs +252 -0
- package/dist/CalendarDate.module.js +252 -0
- package/dist/CalendarDate.module.js.map +1 -0
- package/dist/DateFormatter.main.js +145 -0
- package/dist/DateFormatter.main.js.map +1 -0
- package/dist/DateFormatter.mjs +140 -0
- package/dist/DateFormatter.module.js +140 -0
- package/dist/DateFormatter.module.js.map +1 -0
- package/dist/EthiopicCalendar.main.js +170 -0
- package/dist/EthiopicCalendar.main.js.map +1 -0
- package/dist/EthiopicCalendar.mjs +163 -0
- package/dist/EthiopicCalendar.module.js +163 -0
- package/dist/EthiopicCalendar.module.js.map +1 -0
- package/dist/GregorianCalendar.main.js +143 -0
- package/dist/GregorianCalendar.main.js.map +1 -0
- package/dist/GregorianCalendar.mjs +134 -0
- package/dist/GregorianCalendar.module.js +134 -0
- package/dist/GregorianCalendar.module.js.map +1 -0
- package/dist/HebrewCalendar.main.js +149 -0
- package/dist/HebrewCalendar.main.js.map +1 -0
- package/dist/HebrewCalendar.mjs +144 -0
- package/dist/HebrewCalendar.module.js +144 -0
- package/dist/HebrewCalendar.module.js.map +1 -0
- package/dist/IndianCalendar.main.js +107 -0
- package/dist/IndianCalendar.main.js.map +1 -0
- package/dist/IndianCalendar.mjs +102 -0
- package/dist/IndianCalendar.module.js +102 -0
- package/dist/IndianCalendar.module.js.map +1 -0
- package/dist/IslamicCalendar.main.js +164 -0
- package/dist/IslamicCalendar.main.js.map +1 -0
- package/dist/IslamicCalendar.mjs +157 -0
- package/dist/IslamicCalendar.module.js +157 -0
- package/dist/IslamicCalendar.module.js.map +1 -0
- package/dist/JapaneseCalendar.main.js +180 -0
- package/dist/JapaneseCalendar.main.js.map +1 -0
- package/dist/JapaneseCalendar.mjs +175 -0
- package/dist/JapaneseCalendar.module.js +175 -0
- package/dist/JapaneseCalendar.module.js.map +1 -0
- package/dist/PersianCalendar.main.js +81 -0
- package/dist/PersianCalendar.main.js.map +1 -0
- package/dist/PersianCalendar.mjs +76 -0
- package/dist/PersianCalendar.module.js +76 -0
- package/dist/PersianCalendar.module.js.map +1 -0
- package/dist/TaiwanCalendar.main.js +81 -0
- package/dist/TaiwanCalendar.main.js.map +1 -0
- package/dist/TaiwanCalendar.mjs +76 -0
- package/dist/TaiwanCalendar.module.js +76 -0
- package/dist/TaiwanCalendar.module.js.map +1 -0
- package/dist/conversion.main.js +236 -0
- package/dist/conversion.main.js.map +1 -0
- package/dist/conversion.mjs +218 -0
- package/dist/conversion.module.js +218 -0
- package/dist/conversion.module.js.map +1 -0
- package/dist/createCalendar.main.js +69 -0
- package/dist/createCalendar.main.js.map +1 -0
- package/dist/createCalendar.mjs +64 -0
- package/dist/createCalendar.module.js +64 -0
- package/dist/createCalendar.module.js.map +1 -0
- package/dist/import.mjs +15 -2534
- package/dist/main.js +75 -2594
- package/dist/main.js.map +1 -1
- package/dist/manipulation.main.js +362 -0
- package/dist/manipulation.main.js.map +1 -0
- package/dist/manipulation.mjs +344 -0
- package/dist/manipulation.module.js +344 -0
- package/dist/manipulation.module.js.map +1 -0
- package/dist/module.js +15 -2534
- package/dist/module.js.map +1 -1
- package/dist/queries.main.js +287 -0
- package/dist/queries.main.js.map +1 -0
- package/dist/queries.mjs +256 -0
- package/dist/queries.module.js +256 -0
- package/dist/queries.module.js.map +1 -0
- package/dist/string.main.js +171 -0
- package/dist/string.main.js.map +1 -0
- package/dist/string.mjs +156 -0
- package/dist/string.module.js +156 -0
- package/dist/string.module.js.map +1 -0
- package/dist/utils.main.js +33 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +28 -0
- package/dist/utils.module.js +28 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/weekStartData.main.js +118 -0
- package/dist/weekStartData.main.js.map +1 -0
- package/dist/weekStartData.mjs +113 -0
- package/dist/weekStartData.module.js +113 -0
- package/dist/weekStartData.module.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAC5E,OACE,MAAwB,wCAAwC;OAC9D,MAAM,KAAgB,4BAA4B;OAClD,KAAK,KAAK,CAAC,OAAO,GAAI,yBAAyB;OAC/C,KAAM,CAAA,QAAQ,EAAQ,uCAAuC;IAA/C,IACd,MAAM,EAAgB,6CAA6C;;AAEzE;AAEA,SAAS,oCAAc,KAAa,EAAE,EAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,IAAK,CAAA,KAAK,KAAI,IAAM;IAC3C,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,oCAAc,OAAO,MAAM,GAAG,EAAC,IAAK;IACrE,IAAI,MAAM,KAAK,IAAI,oCAAc,OAAO,MAAM,OAAO;IACrD,OAAO;QAAC;QAAM;QAAO;KAAI;AAC3B;AAEA,SAAS,iCAAW,IAAY;IAC9B,OAAO,KAAK,KAAK,CAAC,AAAC,OAAO,IAAK;AACjC;AAEA,SAAS,qCAAe,IAAY,EAAE,KAAa;IACjD,4EAA4E;IAC5E,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,sBAAsB;IACtB,IAAI,QAAQ,OAAO,GACjB,wBAAwB;I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,MAAM,OAAO,IAAI,GAAG,oCAAc,oCAAc;QACrD,IAAI,MAAM;QACV,IAAI,QAAQ,GAAG;YACb,MAAM;YACN,OAAO,IAAI;QACb;QAEA,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,OAAO;IAClD;IAEA,YAAY,IAAqB,EAAE;QACjC,IAAI,OAAO,KAAK,IAAI;QACpB,IAAI,KAAK,GAAG,KAAK,OACf,OAAO,IAAI;QAGb,OAAO,oCAAc,oCAAc,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,OAAO,KAAK,IAAI;QACpB,IAAI,KAAK,GAAG,KAAK,OACf,OAAO,IAAI;QAGb,OAAO,qCAAe,MAAM,KAAK,KAAK;IACxC;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,QAAQ,OAAO;YACvC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAU;QACR,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;;aAnDA,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.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} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.main.js.map"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
14
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
15
|
+
|
|
16
|
+
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
|
|
17
|
+
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
|
|
18
|
+
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
19
|
+
// AA 5501 = AM 1
|
|
20
|
+
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
|
|
21
|
+
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
|
|
22
|
+
return epoch // difference from Julian epoch to 1,1,1
|
|
23
|
+
+ 365 * year // number of days from years
|
|
24
|
+
+ Math.floor(year / 4) // extra day of leap year
|
|
25
|
+
+ 30 * (month - 1 // number of days from months (1 based)
|
|
26
|
+
) + day - 1 // number of days for present month (1 based)
|
|
27
|
+
;
|
|
28
|
+
}
|
|
29
|
+
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd) {
|
|
30
|
+
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
31
|
+
let month = 1 + Math.floor((jd - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
32
|
+
let day = jd + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
|
|
33
|
+
return [
|
|
34
|
+
year,
|
|
35
|
+
month,
|
|
36
|
+
day
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
function $b956b2d7a6cf451f$var$getLeapDay(year) {
|
|
40
|
+
return Math.floor(year % 4 / 3);
|
|
41
|
+
}
|
|
42
|
+
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
|
|
43
|
+
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
44
|
+
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
45
|
+
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
46
|
+
// Julian Calendar so that the extra month always has six days in the year before
|
|
47
|
+
// a Julian Leap Year.
|
|
48
|
+
if (month % 13 !== 0) // not intercalary month
|
|
49
|
+
return 30;
|
|
50
|
+
else // intercalary month 5 days + possible leap day
|
|
51
|
+
return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
|
|
52
|
+
}
|
|
53
|
+
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
54
|
+
fromJulianDay(jd) {
|
|
55
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
56
|
+
let era = "AM";
|
|
57
|
+
if (year <= 0) {
|
|
58
|
+
era = "AA";
|
|
59
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
60
|
+
}
|
|
61
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
62
|
+
}
|
|
63
|
+
toJulianDay(date) {
|
|
64
|
+
let year = date.year;
|
|
65
|
+
if (date.era === "AA") year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
66
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
67
|
+
}
|
|
68
|
+
getDaysInMonth(date) {
|
|
69
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(date.year, date.month);
|
|
70
|
+
}
|
|
71
|
+
getMonthsInYear() {
|
|
72
|
+
return 13;
|
|
73
|
+
}
|
|
74
|
+
getDaysInYear(date) {
|
|
75
|
+
return 365 + $b956b2d7a6cf451f$var$getLeapDay(date.year);
|
|
76
|
+
}
|
|
77
|
+
getYearsInEra(date) {
|
|
78
|
+
// 9999-12-31 gregorian is 9992-20-02 ethiopic.
|
|
79
|
+
// Round down to 9991 for the last full year.
|
|
80
|
+
// AA 9999-01-01 ethiopic is 4506-09-30 gregorian.
|
|
81
|
+
return date.era === "AA" ? 9999 : 9991;
|
|
82
|
+
}
|
|
83
|
+
getEras() {
|
|
84
|
+
return [
|
|
85
|
+
"AA",
|
|
86
|
+
"AM"
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
constructor(){
|
|
90
|
+
this.identifier = "ethiopic";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
94
|
+
fromJulianDay(jd) {
|
|
95
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
96
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
97
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, "AA", year, month, day);
|
|
98
|
+
}
|
|
99
|
+
getEras() {
|
|
100
|
+
return [
|
|
101
|
+
"AA"
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
getYearsInEra() {
|
|
105
|
+
// 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.
|
|
106
|
+
return 9999;
|
|
107
|
+
}
|
|
108
|
+
constructor(...args){
|
|
109
|
+
super(...args);
|
|
110
|
+
this.identifier = "ethioaa" // also known as 'ethiopic-amete-alem' in ICU
|
|
111
|
+
;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
115
|
+
fromJulianDay(jd) {
|
|
116
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd);
|
|
117
|
+
let era = "CE";
|
|
118
|
+
if (year <= 0) {
|
|
119
|
+
era = "BCE";
|
|
120
|
+
year = 1 - year;
|
|
121
|
+
}
|
|
122
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
123
|
+
}
|
|
124
|
+
toJulianDay(date) {
|
|
125
|
+
let year = date.year;
|
|
126
|
+
if (date.era === "BCE") year = 1 - year;
|
|
127
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
128
|
+
}
|
|
129
|
+
getDaysInMonth(date) {
|
|
130
|
+
let year = date.year;
|
|
131
|
+
if (date.era === "BCE") year = 1 - year;
|
|
132
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(year, date.month);
|
|
133
|
+
}
|
|
134
|
+
isInverseEra(date) {
|
|
135
|
+
return date.era === "BCE";
|
|
136
|
+
}
|
|
137
|
+
balanceDate(date) {
|
|
138
|
+
if (date.year <= 0) {
|
|
139
|
+
date.era = date.era === "BCE" ? "CE" : "BCE";
|
|
140
|
+
date.year = 1 - date.year;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
getEras() {
|
|
144
|
+
return [
|
|
145
|
+
"BCE",
|
|
146
|
+
"CE"
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
getYearsInEra(date) {
|
|
150
|
+
// 9999-12-30 gregorian is 9716-02-20 coptic.
|
|
151
|
+
// Round down to 9715 for the last full year.
|
|
152
|
+
// BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.
|
|
153
|
+
return date.era === "BCE" ? 9999 : 9715;
|
|
154
|
+
}
|
|
155
|
+
constructor(...args){
|
|
156
|
+
super(...args);
|
|
157
|
+
this.identifier = "coptic";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
export {$b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar};
|
|
163
|
+
//# sourceMappingURL=EthiopicCalendar.mjs.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
14
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
15
|
+
|
|
16
|
+
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
|
|
17
|
+
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
|
|
18
|
+
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
19
|
+
// AA 5501 = AM 1
|
|
20
|
+
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
|
|
21
|
+
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
|
|
22
|
+
return epoch // difference from Julian epoch to 1,1,1
|
|
23
|
+
+ 365 * year // number of days from years
|
|
24
|
+
+ Math.floor(year / 4) // extra day of leap year
|
|
25
|
+
+ 30 * (month - 1 // number of days from months (1 based)
|
|
26
|
+
) + day - 1 // number of days for present month (1 based)
|
|
27
|
+
;
|
|
28
|
+
}
|
|
29
|
+
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd) {
|
|
30
|
+
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
31
|
+
let month = 1 + Math.floor((jd - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
32
|
+
let day = jd + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
|
|
33
|
+
return [
|
|
34
|
+
year,
|
|
35
|
+
month,
|
|
36
|
+
day
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
function $b956b2d7a6cf451f$var$getLeapDay(year) {
|
|
40
|
+
return Math.floor(year % 4 / 3);
|
|
41
|
+
}
|
|
42
|
+
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
|
|
43
|
+
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
44
|
+
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
45
|
+
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
46
|
+
// Julian Calendar so that the extra month always has six days in the year before
|
|
47
|
+
// a Julian Leap Year.
|
|
48
|
+
if (month % 13 !== 0) // not intercalary month
|
|
49
|
+
return 30;
|
|
50
|
+
else // intercalary month 5 days + possible leap day
|
|
51
|
+
return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
|
|
52
|
+
}
|
|
53
|
+
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
54
|
+
fromJulianDay(jd) {
|
|
55
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
56
|
+
let era = "AM";
|
|
57
|
+
if (year <= 0) {
|
|
58
|
+
era = "AA";
|
|
59
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
60
|
+
}
|
|
61
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
62
|
+
}
|
|
63
|
+
toJulianDay(date) {
|
|
64
|
+
let year = date.year;
|
|
65
|
+
if (date.era === "AA") year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
66
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
67
|
+
}
|
|
68
|
+
getDaysInMonth(date) {
|
|
69
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(date.year, date.month);
|
|
70
|
+
}
|
|
71
|
+
getMonthsInYear() {
|
|
72
|
+
return 13;
|
|
73
|
+
}
|
|
74
|
+
getDaysInYear(date) {
|
|
75
|
+
return 365 + $b956b2d7a6cf451f$var$getLeapDay(date.year);
|
|
76
|
+
}
|
|
77
|
+
getYearsInEra(date) {
|
|
78
|
+
// 9999-12-31 gregorian is 9992-20-02 ethiopic.
|
|
79
|
+
// Round down to 9991 for the last full year.
|
|
80
|
+
// AA 9999-01-01 ethiopic is 4506-09-30 gregorian.
|
|
81
|
+
return date.era === "AA" ? 9999 : 9991;
|
|
82
|
+
}
|
|
83
|
+
getEras() {
|
|
84
|
+
return [
|
|
85
|
+
"AA",
|
|
86
|
+
"AM"
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
constructor(){
|
|
90
|
+
this.identifier = "ethiopic";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
94
|
+
fromJulianDay(jd) {
|
|
95
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
96
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
97
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, "AA", year, month, day);
|
|
98
|
+
}
|
|
99
|
+
getEras() {
|
|
100
|
+
return [
|
|
101
|
+
"AA"
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
getYearsInEra() {
|
|
105
|
+
// 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.
|
|
106
|
+
return 9999;
|
|
107
|
+
}
|
|
108
|
+
constructor(...args){
|
|
109
|
+
super(...args);
|
|
110
|
+
this.identifier = "ethioaa" // also known as 'ethiopic-amete-alem' in ICU
|
|
111
|
+
;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
115
|
+
fromJulianDay(jd) {
|
|
116
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd);
|
|
117
|
+
let era = "CE";
|
|
118
|
+
if (year <= 0) {
|
|
119
|
+
era = "BCE";
|
|
120
|
+
year = 1 - year;
|
|
121
|
+
}
|
|
122
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
123
|
+
}
|
|
124
|
+
toJulianDay(date) {
|
|
125
|
+
let year = date.year;
|
|
126
|
+
if (date.era === "BCE") year = 1 - year;
|
|
127
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
128
|
+
}
|
|
129
|
+
getDaysInMonth(date) {
|
|
130
|
+
let year = date.year;
|
|
131
|
+
if (date.era === "BCE") year = 1 - year;
|
|
132
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(year, date.month);
|
|
133
|
+
}
|
|
134
|
+
isInverseEra(date) {
|
|
135
|
+
return date.era === "BCE";
|
|
136
|
+
}
|
|
137
|
+
balanceDate(date) {
|
|
138
|
+
if (date.year <= 0) {
|
|
139
|
+
date.era = date.era === "BCE" ? "CE" : "BCE";
|
|
140
|
+
date.year = 1 - date.year;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
getEras() {
|
|
144
|
+
return [
|
|
145
|
+
"BCE",
|
|
146
|
+
"CE"
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
getYearsInEra(date) {
|
|
150
|
+
// 9999-12-30 gregorian is 9716-02-20 coptic.
|
|
151
|
+
// Round down to 9715 for the last full year.
|
|
152
|
+
// BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.
|
|
153
|
+
return date.era === "BCE" ? 9999 : 9715;
|
|
154
|
+
}
|
|
155
|
+
constructor(...args){
|
|
156
|
+
super(...args);
|
|
157
|
+
this.identifier = "coptic";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
export {$b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar};
|
|
163
|
+
//# sourceMappingURL=EthiopicCalendar.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAC5E,OACE,MAAwB,wCAAwC;OAC9D,MAAM,KAAgB,4BAA4B;OAClD,KAAK,KAAK,CAAC,OAAO,GAAI,yBAAyB;OAC/C,KAAM,CAAA,QAAQ,EAAQ,uCAAuC;IAA/C,IACd,MAAM,EAAgB,6CAA6C;;AAEzE;AAEA,SAAS,oCAAc,KAAa,EAAE,EAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,IAAK,CAAA,KAAK,KAAI,IAAM;IAC3C,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,oCAAc,OAAO,MAAM,GAAG,EAAC,IAAK;IACrE,IAAI,MAAM,KAAK,IAAI,oCAAc,OAAO,MAAM,OAAO;IACrD,OAAO;QAAC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alendar.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} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.module.js.map"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
|
|
2
|
+
var $a5090d6430502238$exports = require("./utils.main.js");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function $parcel$export(e, n, v, s) {
|
|
6
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
$parcel$export(module.exports, "gregorianToJulianDay", () => $af14c9812fdceb33$export$f297eb839006d339);
|
|
10
|
+
$parcel$export(module.exports, "getExtendedYear", () => $af14c9812fdceb33$export$c36e0ecb2d4fa69d);
|
|
11
|
+
$parcel$export(module.exports, "isLeapYear", () => $af14c9812fdceb33$export$553d7fa8e3805fc0);
|
|
12
|
+
$parcel$export(module.exports, "fromExtendedYear", () => $af14c9812fdceb33$export$4475b7e617eb123c);
|
|
13
|
+
$parcel$export(module.exports, "GregorianCalendar", () => $af14c9812fdceb33$export$80ee6245ec4f29ec);
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
25
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const $af14c9812fdceb33$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
|
|
29
|
+
function $af14c9812fdceb33$export$f297eb839006d339(era, year, month, day) {
|
|
30
|
+
year = $af14c9812fdceb33$export$c36e0ecb2d4fa69d(era, year);
|
|
31
|
+
let y1 = year - 1;
|
|
32
|
+
let monthOffset = -2;
|
|
33
|
+
if (month <= 2) monthOffset = 0;
|
|
34
|
+
else if ($af14c9812fdceb33$export$553d7fa8e3805fc0(year)) monthOffset = -1;
|
|
35
|
+
return $af14c9812fdceb33$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
|
|
36
|
+
}
|
|
37
|
+
function $af14c9812fdceb33$export$553d7fa8e3805fc0(year) {
|
|
38
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
39
|
+
}
|
|
40
|
+
function $af14c9812fdceb33$export$c36e0ecb2d4fa69d(era, year) {
|
|
41
|
+
return era === "BC" ? 1 - year : year;
|
|
42
|
+
}
|
|
43
|
+
function $af14c9812fdceb33$export$4475b7e617eb123c(year) {
|
|
44
|
+
let era = "AD";
|
|
45
|
+
if (year <= 0) {
|
|
46
|
+
era = "BC";
|
|
47
|
+
year = 1 - year;
|
|
48
|
+
}
|
|
49
|
+
return [
|
|
50
|
+
era,
|
|
51
|
+
year
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
const $af14c9812fdceb33$var$daysInMonth = {
|
|
55
|
+
standard: [
|
|
56
|
+
31,
|
|
57
|
+
28,
|
|
58
|
+
31,
|
|
59
|
+
30,
|
|
60
|
+
31,
|
|
61
|
+
30,
|
|
62
|
+
31,
|
|
63
|
+
31,
|
|
64
|
+
30,
|
|
65
|
+
31,
|
|
66
|
+
30,
|
|
67
|
+
31
|
|
68
|
+
],
|
|
69
|
+
leapyear: [
|
|
70
|
+
31,
|
|
71
|
+
29,
|
|
72
|
+
31,
|
|
73
|
+
30,
|
|
74
|
+
31,
|
|
75
|
+
30,
|
|
76
|
+
31,
|
|
77
|
+
31,
|
|
78
|
+
30,
|
|
79
|
+
31,
|
|
80
|
+
30,
|
|
81
|
+
31
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
class $af14c9812fdceb33$export$80ee6245ec4f29ec {
|
|
85
|
+
fromJulianDay(jd) {
|
|
86
|
+
let jd0 = jd;
|
|
87
|
+
let depoch = jd0 - $af14c9812fdceb33$var$EPOCH;
|
|
88
|
+
let quadricent = Math.floor(depoch / 146097);
|
|
89
|
+
let dqc = (0, $a5090d6430502238$exports.mod)(depoch, 146097);
|
|
90
|
+
let cent = Math.floor(dqc / 36524);
|
|
91
|
+
let dcent = (0, $a5090d6430502238$exports.mod)(dqc, 36524);
|
|
92
|
+
let quad = Math.floor(dcent / 1461);
|
|
93
|
+
let dquad = (0, $a5090d6430502238$exports.mod)(dcent, 1461);
|
|
94
|
+
let yindex = Math.floor(dquad / 365);
|
|
95
|
+
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
96
|
+
let [era, year] = $af14c9812fdceb33$export$4475b7e617eb123c(extendedYear);
|
|
97
|
+
let yearDay = jd0 - $af14c9812fdceb33$export$f297eb839006d339(era, year, 1, 1);
|
|
98
|
+
let leapAdj = 2;
|
|
99
|
+
if (jd0 < $af14c9812fdceb33$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
|
|
100
|
+
else if ($af14c9812fdceb33$export$553d7fa8e3805fc0(year)) leapAdj = 1;
|
|
101
|
+
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
102
|
+
let day = jd0 - $af14c9812fdceb33$export$f297eb839006d339(era, year, month, 1) + 1;
|
|
103
|
+
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, month, day);
|
|
104
|
+
}
|
|
105
|
+
toJulianDay(date) {
|
|
106
|
+
return $af14c9812fdceb33$export$f297eb839006d339(date.era, date.year, date.month, date.day);
|
|
107
|
+
}
|
|
108
|
+
getDaysInMonth(date) {
|
|
109
|
+
return $af14c9812fdceb33$var$daysInMonth[$af14c9812fdceb33$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
|
|
110
|
+
}
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
+
getMonthsInYear(date) {
|
|
113
|
+
return 12;
|
|
114
|
+
}
|
|
115
|
+
getDaysInYear(date) {
|
|
116
|
+
return $af14c9812fdceb33$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
117
|
+
}
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
119
|
+
getYearsInEra(date) {
|
|
120
|
+
return 9999;
|
|
121
|
+
}
|
|
122
|
+
getEras() {
|
|
123
|
+
return [
|
|
124
|
+
"BC",
|
|
125
|
+
"AD"
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
isInverseEra(date) {
|
|
129
|
+
return date.era === "BC";
|
|
130
|
+
}
|
|
131
|
+
balanceDate(date) {
|
|
132
|
+
if (date.year <= 0) {
|
|
133
|
+
date.era = date.era === "BC" ? "AD" : "BC";
|
|
134
|
+
date.year = 1 - date.year;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
constructor(){
|
|
138
|
+
this.identifier = "gregory";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=GregorianCalendar.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,8BAAQ,SAAS,wBAAwB;AACxC,SAAS,0CAAqB,GAAW,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IACxF,OAAO,0CAAgB,KAAK;IAE5B,IAAI,KAAK,OAAO;IAChB,IAAI,cAAc;IAClB,IAAI,SAAS,GACX,cAAc;SACT,IAAI,0CAAW,OACpB,cAAc;IAGhB,OACE,8BACA,IACA,MAAM,KACN,KAAK,KAAK,CAAC,KAAK,KAChB,KAAK,KAAK,CAAC,KAAK,OAChB,KAAK,KAAK,CAAC,KAAK,OAChB,KAAK,KAAK,CAAC,AAAC,CAAA,MAAM,QAAQ,GAAE,IAAK,KAAK,cAAc;AAExD;AAEO,SAAS,0CAAW,IAAY;IACrC,OAAO,OAAO,MAAM,KAAM,CAAA,OAAO,QAAQ,KAAK,OAAO,QAAQ,CAA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AAE,IAAK;QAC1D,IAAI,MAAM,MAAM,0CAAqB,KAAK,MAAM,OAAO,KAAK;QAE5D,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,MAAM,OAAO;IAC5C;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,0CAAqB,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;IACvE;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,iCAAW,CAAC,0CAAW,KAAK,IAAI,IAAI,aAAa,WAAW,CAAC,KAAK,KAAK,GAAG,EAAE;IACrF;IAEA,6DAA6D;IAC7D,gBAAgB,IAAqB,EAAU;QAC7C,OAAO;IACT;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,0CAAW,KAAK,IAAI,IAAI,MAAM;IACvC;IAEA,6DAA6D;IAC7D,cAAc,IAAqB,EAAU;QAC3C,OAAO;IACT;IAEA,UAAU;QACR,OAAO;YAAC;YAAM;SAAK;IACrB;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,OAAO,OAAO;YACtC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;;aA/DA,aAAa;;AAgEf","sources":["packages/@internationalized/date/src/calendars/GregorianCalendar.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} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod, Mutable} from '../utils';\n\nconst EPOCH = 1721426; // 001/01/03 Julian C.E.\nexport function gregorianToJulianDay(era: string, year: number, month: number, day: number): number {\n year = getExtendedYear(era, year);\n\n let y1 = year - 1;\n let monthOffset = -2;\n if (month <= 2) {\n monthOffset = 0;\n } else if (isLeapYear(year)) {\n monthOffset = -1;\n }\n\n return (\n EPOCH -\n 1 +\n 365 * y1 +\n Math.floor(y1 / 4) -\n Math.floor(y1 / 100) +\n Math.floor(y1 / 400) +\n Math.floor((367 * month - 362) / 12 + monthOffset + day)\n );\n}\n\nexport function isLeapYear(year: number): boolean {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function getExtendedYear(era: string, year: number): number {\n return era === 'BC' ? 1 - year : year;\n}\n\nexport function fromExtendedYear(year: number): [string, number] {\n let era = 'AD';\n if (year <= 0) {\n era = 'BC';\n year = 1 - year;\n }\n\n return [era, year];\n}\n\nconst daysInMonth = {\n standard: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n leapyear: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n};\n\n/**\n * The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.\n * Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.\n */\nexport class GregorianCalendar implements Calendar {\n identifier = 'gregory';\n\n fromJulianDay(jd: number): CalendarDate {\n let jd0 = jd;\n let depoch = jd0 - EPOCH;\n let quadricent = Math.floor(depoch / 146097);\n let dqc = mod(depoch, 146097);\n let cent = Math.floor(dqc / 36524);\n let dcent = mod(dqc, 36524);\n let quad = Math.floor(dcent / 1461);\n let dquad = mod(dcent, 1461);\n let yindex = Math.floor(dquad / 365);\n\n let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);\n let [era, year] = fromExtendedYear(extendedYear);\n let yearDay = jd0 - gregorianToJulianDay(era, year, 1, 1);\n let leapAdj = 2;\n if (jd0 < gregorianToJulianDay(era, year, 3, 1)) {\n leapAdj = 0;\n } else if (isLeapYear(year)) {\n leapAdj = 1;\n }\n let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);\n let day = jd0 - gregorianToJulianDay(era, year, month, 1) + 1;\n\n return new CalendarDate(era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return gregorianToJulianDay(date.era, date.year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return daysInMonth[isLeapYear(date.year) ? 'leapyear' : 'standard'][date.month - 1];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getMonthsInYear(date: AnyCalendarDate): number {\n return 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 366 : 365;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getYearsInEra(date: AnyCalendarDate): number {\n return 9999;\n }\n\n getEras() {\n return ['BC', 'AD'];\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BC';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BC' ? 'AD' : 'BC';\n date.year = 1 - date.year;\n }\n }\n}\n"],"names":[],"version":3,"file":"GregorianCalendar.main.js.map"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
|
|
2
|
+
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/ // 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 $3b62074eb05584b2$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
|
|
19
|
+
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
|
|
20
|
+
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
|
|
21
|
+
let y1 = year - 1;
|
|
22
|
+
let monthOffset = -2;
|
|
23
|
+
if (month <= 2) monthOffset = 0;
|
|
24
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
|
|
25
|
+
return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
|
|
26
|
+
}
|
|
27
|
+
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
|
|
28
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
29
|
+
}
|
|
30
|
+
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
|
|
31
|
+
return era === "BC" ? 1 - year : year;
|
|
32
|
+
}
|
|
33
|
+
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
|
|
34
|
+
let era = "AD";
|
|
35
|
+
if (year <= 0) {
|
|
36
|
+
era = "BC";
|
|
37
|
+
year = 1 - year;
|
|
38
|
+
}
|
|
39
|
+
return [
|
|
40
|
+
era,
|
|
41
|
+
year
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
const $3b62074eb05584b2$var$daysInMonth = {
|
|
45
|
+
standard: [
|
|
46
|
+
31,
|
|
47
|
+
28,
|
|
48
|
+
31,
|
|
49
|
+
30,
|
|
50
|
+
31,
|
|
51
|
+
30,
|
|
52
|
+
31,
|
|
53
|
+
31,
|
|
54
|
+
30,
|
|
55
|
+
31,
|
|
56
|
+
30,
|
|
57
|
+
31
|
|
58
|
+
],
|
|
59
|
+
leapyear: [
|
|
60
|
+
31,
|
|
61
|
+
29,
|
|
62
|
+
31,
|
|
63
|
+
30,
|
|
64
|
+
31,
|
|
65
|
+
30,
|
|
66
|
+
31,
|
|
67
|
+
31,
|
|
68
|
+
30,
|
|
69
|
+
31,
|
|
70
|
+
30,
|
|
71
|
+
31
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
75
|
+
fromJulianDay(jd) {
|
|
76
|
+
let jd0 = jd;
|
|
77
|
+
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
|
|
78
|
+
let quadricent = Math.floor(depoch / 146097);
|
|
79
|
+
let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097);
|
|
80
|
+
let cent = Math.floor(dqc / 36524);
|
|
81
|
+
let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524);
|
|
82
|
+
let quad = Math.floor(dcent / 1461);
|
|
83
|
+
let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461);
|
|
84
|
+
let yindex = Math.floor(dquad / 365);
|
|
85
|
+
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
86
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
|
|
87
|
+
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
|
|
88
|
+
let leapAdj = 2;
|
|
89
|
+
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
|
|
90
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
|
|
91
|
+
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
92
|
+
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
|
|
93
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day);
|
|
94
|
+
}
|
|
95
|
+
toJulianDay(date) {
|
|
96
|
+
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
|
|
97
|
+
}
|
|
98
|
+
getDaysInMonth(date) {
|
|
99
|
+
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
|
|
100
|
+
}
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
|
+
getMonthsInYear(date) {
|
|
103
|
+
return 12;
|
|
104
|
+
}
|
|
105
|
+
getDaysInYear(date) {
|
|
106
|
+
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
107
|
+
}
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
|
+
getYearsInEra(date) {
|
|
110
|
+
return 9999;
|
|
111
|
+
}
|
|
112
|
+
getEras() {
|
|
113
|
+
return [
|
|
114
|
+
"BC",
|
|
115
|
+
"AD"
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
isInverseEra(date) {
|
|
119
|
+
return date.era === "BC";
|
|
120
|
+
}
|
|
121
|
+
balanceDate(date) {
|
|
122
|
+
if (date.year <= 0) {
|
|
123
|
+
date.era = date.era === "BC" ? "AD" : "BC";
|
|
124
|
+
date.year = 1 - date.year;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
constructor(){
|
|
128
|
+
this.identifier = "gregory";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
export {$3b62074eb05584b2$export$f297eb839006d339 as gregorianToJulianDay, $3b62074eb05584b2$export$c36e0ecb2d4fa69d as getExtendedYear, $3b62074eb05584b2$export$553d7fa8e3805fc0 as isLeapYear, $3b62074eb05584b2$export$4475b7e617eb123c as fromExtendedYear, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar};
|
|
134
|
+
//# sourceMappingURL=GregorianCalendar.mjs.map
|