@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,13 +1,13 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
$parcel$export(module.exports, "EthiopicCalendar", ()
|
|
9
|
-
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", ()
|
|
10
|
-
$parcel$export(module.exports, "CopticCalendar", ()
|
|
8
|
+
$parcel$export(module.exports, "EthiopicCalendar", function () { return $b6b43214f5cff964$export$26ba6eab5e20cd7d; });
|
|
9
|
+
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", function () { return $b6b43214f5cff964$export$d72e0c37005a4914; });
|
|
10
|
+
$parcel$export(module.exports, "CopticCalendar", function () { return $b6b43214f5cff964$export$fe6243cbe1a4b7c1; });
|
|
11
11
|
/*
|
|
12
12
|
* Copyright 2020 Adobe. All rights reserved.
|
|
13
13
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -21,12 +21,12 @@ $parcel$export(module.exports, "CopticCalendar", () => $4db04d1051af0f2f$export$
|
|
|
21
21
|
*/ // Portions of the code in this file are based on code from ICU.
|
|
22
22
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
23
23
|
|
|
24
|
-
const $
|
|
25
|
-
const $
|
|
24
|
+
const $b6b43214f5cff964$var$ETHIOPIC_EPOCH = 1723856;
|
|
25
|
+
const $b6b43214f5cff964$var$COPTIC_EPOCH = 1824665;
|
|
26
26
|
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
27
27
|
// AA 5501 = AM 1
|
|
28
|
-
const $
|
|
29
|
-
function $
|
|
28
|
+
const $b6b43214f5cff964$var$AMETE_MIHRET_DELTA = 5500;
|
|
29
|
+
function $b6b43214f5cff964$var$ceToJulianDay(epoch, year, month, day) {
|
|
30
30
|
return epoch // difference from Julian epoch to 1,1,1
|
|
31
31
|
+ 365 * year // number of days from years
|
|
32
32
|
+ Math.floor(year / 4) // extra day of leap year
|
|
@@ -34,20 +34,20 @@ function $4db04d1051af0f2f$var$ceToJulianDay(epoch, year, month, day) {
|
|
|
34
34
|
) + day - 1 // number of days for present month (1 based)
|
|
35
35
|
;
|
|
36
36
|
}
|
|
37
|
-
function $
|
|
37
|
+
function $b6b43214f5cff964$var$julianDayToCE(epoch, jd) {
|
|
38
38
|
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
39
|
-
let month = 1 + Math.floor((jd - $
|
|
40
|
-
let day = jd + 1 - $
|
|
39
|
+
let month = 1 + Math.floor((jd - $b6b43214f5cff964$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
40
|
+
let day = jd + 1 - $b6b43214f5cff964$var$ceToJulianDay(epoch, year, month, 1);
|
|
41
41
|
return [
|
|
42
42
|
year,
|
|
43
43
|
month,
|
|
44
44
|
day
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
|
-
function $
|
|
47
|
+
function $b6b43214f5cff964$var$getLeapDay(year) {
|
|
48
48
|
return Math.floor(year % 4 / 3);
|
|
49
49
|
}
|
|
50
|
-
function $
|
|
50
|
+
function $b6b43214f5cff964$var$getDaysInMonth(year, month) {
|
|
51
51
|
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
52
52
|
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
53
53
|
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
@@ -56,31 +56,31 @@ function $4db04d1051af0f2f$var$getDaysInMonth(year, month) {
|
|
|
56
56
|
if (month % 13 !== 0) // not intercalary month
|
|
57
57
|
return 30;
|
|
58
58
|
else // intercalary month 5 days + possible leap day
|
|
59
|
-
return $
|
|
59
|
+
return $b6b43214f5cff964$var$getLeapDay(year) + 5;
|
|
60
60
|
}
|
|
61
|
-
class $
|
|
61
|
+
class $b6b43214f5cff964$export$26ba6eab5e20cd7d {
|
|
62
62
|
fromJulianDay(jd) {
|
|
63
|
-
let [year, month, day] = $
|
|
63
|
+
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$ETHIOPIC_EPOCH, jd);
|
|
64
64
|
let era = 'AM';
|
|
65
65
|
if (year <= 0) {
|
|
66
66
|
era = 'AA';
|
|
67
|
-
year += $
|
|
67
|
+
year += $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
|
|
68
68
|
}
|
|
69
|
-
return new (0, $
|
|
69
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, month, day);
|
|
70
70
|
}
|
|
71
71
|
toJulianDay(date) {
|
|
72
72
|
let year = date.year;
|
|
73
|
-
if (date.era === 'AA') year -= $
|
|
74
|
-
return $
|
|
73
|
+
if (date.era === 'AA') year -= $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
|
|
74
|
+
return $b6b43214f5cff964$var$ceToJulianDay($b6b43214f5cff964$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
75
75
|
}
|
|
76
76
|
getDaysInMonth(date) {
|
|
77
|
-
return $
|
|
77
|
+
return $b6b43214f5cff964$var$getDaysInMonth(date.year, date.month);
|
|
78
78
|
}
|
|
79
79
|
getMonthsInYear() {
|
|
80
80
|
return 13;
|
|
81
81
|
}
|
|
82
82
|
getDaysInYear(date) {
|
|
83
|
-
return 365 + $
|
|
83
|
+
return 365 + $b6b43214f5cff964$var$getLeapDay(date.year);
|
|
84
84
|
}
|
|
85
85
|
getMaximumMonthsInYear() {
|
|
86
86
|
return 13;
|
|
@@ -104,11 +104,11 @@ class $4db04d1051af0f2f$export$26ba6eab5e20cd7d {
|
|
|
104
104
|
this.identifier = 'ethiopic';
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class $
|
|
107
|
+
class $b6b43214f5cff964$export$d72e0c37005a4914 extends $b6b43214f5cff964$export$26ba6eab5e20cd7d {
|
|
108
108
|
fromJulianDay(jd) {
|
|
109
|
-
let [year, month, day] = $
|
|
110
|
-
year += $
|
|
111
|
-
return new (0, $
|
|
109
|
+
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$ETHIOPIC_EPOCH, jd);
|
|
110
|
+
year += $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
|
|
111
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, 'AA', year, month, day);
|
|
112
112
|
}
|
|
113
113
|
getEras() {
|
|
114
114
|
return [
|
|
@@ -124,25 +124,25 @@ class $4db04d1051af0f2f$export$d72e0c37005a4914 extends $4db04d1051af0f2f$export
|
|
|
124
124
|
;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
class $
|
|
127
|
+
class $b6b43214f5cff964$export$fe6243cbe1a4b7c1 extends $b6b43214f5cff964$export$26ba6eab5e20cd7d {
|
|
128
128
|
fromJulianDay(jd) {
|
|
129
|
-
let [year, month, day] = $
|
|
129
|
+
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$COPTIC_EPOCH, jd);
|
|
130
130
|
let era = 'CE';
|
|
131
131
|
if (year <= 0) {
|
|
132
132
|
era = 'BCE';
|
|
133
133
|
year = 1 - year;
|
|
134
134
|
}
|
|
135
|
-
return new (0, $
|
|
135
|
+
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, month, day);
|
|
136
136
|
}
|
|
137
137
|
toJulianDay(date) {
|
|
138
138
|
let year = date.year;
|
|
139
139
|
if (date.era === 'BCE') year = 1 - year;
|
|
140
|
-
return $
|
|
140
|
+
return $b6b43214f5cff964$var$ceToJulianDay($b6b43214f5cff964$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
141
141
|
}
|
|
142
142
|
getDaysInMonth(date) {
|
|
143
143
|
let year = date.year;
|
|
144
144
|
if (date.era === 'BCE') year = 1 - year;
|
|
145
|
-
return $
|
|
145
|
+
return $b6b43214f5cff964$var$getDaysInMonth(year, date.month);
|
|
146
146
|
}
|
|
147
147
|
isInverseEra(date) {
|
|
148
148
|
return date.era === 'BCE';
|
|
@@ -171,4 +171,4 @@ class $4db04d1051af0f2f$export$fe6243cbe1a4b7c1 extends $4db04d1051af0f2f$export
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
|
|
174
|
-
//# sourceMappingURL=EthiopicCalendar.
|
|
174
|
+
//# sourceMappingURL=EthiopicCalendar.cjs.map
|
|
@@ -1 +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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;AAoDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\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 getMaximumMonthsInYear(): number {\n return 13;\n }\n\n getMaximumDaysInMonth(): number {\n return 30;\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(): string[] {\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: CalendarIdentifier = '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(): string[] {\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: CalendarIdentifier = '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): number {\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>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras(): string[] {\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.
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAA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AAI;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,EAAQ;QAChD,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,QAAQ,OAAO;YACvC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAiC;;AAoDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\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 getMaximumMonthsInYear(): number {\n return 13;\n }\n\n getMaximumDaysInMonth(): number {\n return 30;\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(): string[] {\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: CalendarIdentifier = '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(): string[] {\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: CalendarIdentifier = '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): number {\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>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras(): string[] {\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.cjs.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CalendarDate as $
|
|
1
|
+
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,12 +13,12 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./Calen
|
|
|
13
13
|
*/ // Portions of the code in this file are based on code from ICU.
|
|
14
14
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
15
15
|
|
|
16
|
-
const $
|
|
17
|
-
const $
|
|
16
|
+
const $ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH = 1723856;
|
|
17
|
+
const $ca8f5bca40aaf2d4$var$COPTIC_EPOCH = 1824665;
|
|
18
18
|
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
19
19
|
// AA 5501 = AM 1
|
|
20
|
-
const $
|
|
21
|
-
function $
|
|
20
|
+
const $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA = 5500;
|
|
21
|
+
function $ca8f5bca40aaf2d4$var$ceToJulianDay(epoch, year, month, day) {
|
|
22
22
|
return epoch // difference from Julian epoch to 1,1,1
|
|
23
23
|
+ 365 * year // number of days from years
|
|
24
24
|
+ Math.floor(year / 4) // extra day of leap year
|
|
@@ -26,20 +26,20 @@ function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
|
|
|
26
26
|
) + day - 1 // number of days for present month (1 based)
|
|
27
27
|
;
|
|
28
28
|
}
|
|
29
|
-
function $
|
|
29
|
+
function $ca8f5bca40aaf2d4$var$julianDayToCE(epoch, jd) {
|
|
30
30
|
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
31
|
-
let month = 1 + Math.floor((jd - $
|
|
32
|
-
let day = jd + 1 - $
|
|
31
|
+
let month = 1 + Math.floor((jd - $ca8f5bca40aaf2d4$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
32
|
+
let day = jd + 1 - $ca8f5bca40aaf2d4$var$ceToJulianDay(epoch, year, month, 1);
|
|
33
33
|
return [
|
|
34
34
|
year,
|
|
35
35
|
month,
|
|
36
36
|
day
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
function $
|
|
39
|
+
function $ca8f5bca40aaf2d4$var$getLeapDay(year) {
|
|
40
40
|
return Math.floor(year % 4 / 3);
|
|
41
41
|
}
|
|
42
|
-
function $
|
|
42
|
+
function $ca8f5bca40aaf2d4$var$getDaysInMonth(year, month) {
|
|
43
43
|
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
44
44
|
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
45
45
|
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
@@ -48,31 +48,31 @@ function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
|
|
|
48
48
|
if (month % 13 !== 0) // not intercalary month
|
|
49
49
|
return 30;
|
|
50
50
|
else // intercalary month 5 days + possible leap day
|
|
51
|
-
return $
|
|
51
|
+
return $ca8f5bca40aaf2d4$var$getLeapDay(year) + 5;
|
|
52
52
|
}
|
|
53
|
-
class $
|
|
53
|
+
class $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
|
|
54
54
|
fromJulianDay(jd) {
|
|
55
|
-
let [year, month, day] = $
|
|
55
|
+
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, jd);
|
|
56
56
|
let era = 'AM';
|
|
57
57
|
if (year <= 0) {
|
|
58
58
|
era = 'AA';
|
|
59
|
-
year += $
|
|
59
|
+
year += $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
|
|
60
60
|
}
|
|
61
|
-
return new (0, $
|
|
61
|
+
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
62
62
|
}
|
|
63
63
|
toJulianDay(date) {
|
|
64
64
|
let year = date.year;
|
|
65
|
-
if (date.era === 'AA') year -= $
|
|
66
|
-
return $
|
|
65
|
+
if (date.era === 'AA') year -= $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
|
|
66
|
+
return $ca8f5bca40aaf2d4$var$ceToJulianDay($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
67
67
|
}
|
|
68
68
|
getDaysInMonth(date) {
|
|
69
|
-
return $
|
|
69
|
+
return $ca8f5bca40aaf2d4$var$getDaysInMonth(date.year, date.month);
|
|
70
70
|
}
|
|
71
71
|
getMonthsInYear() {
|
|
72
72
|
return 13;
|
|
73
73
|
}
|
|
74
74
|
getDaysInYear(date) {
|
|
75
|
-
return 365 + $
|
|
75
|
+
return 365 + $ca8f5bca40aaf2d4$var$getLeapDay(date.year);
|
|
76
76
|
}
|
|
77
77
|
getMaximumMonthsInYear() {
|
|
78
78
|
return 13;
|
|
@@ -96,11 +96,11 @@ class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
|
96
96
|
this.identifier = 'ethiopic';
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
class $
|
|
99
|
+
class $ca8f5bca40aaf2d4$export$d72e0c37005a4914 extends $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
|
|
100
100
|
fromJulianDay(jd) {
|
|
101
|
-
let [year, month, day] = $
|
|
102
|
-
year += $
|
|
103
|
-
return new (0, $
|
|
101
|
+
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, jd);
|
|
102
|
+
year += $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
|
|
103
|
+
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, 'AA', year, month, day);
|
|
104
104
|
}
|
|
105
105
|
getEras() {
|
|
106
106
|
return [
|
|
@@ -116,25 +116,25 @@ class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export
|
|
|
116
116
|
;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class $
|
|
119
|
+
class $ca8f5bca40aaf2d4$export$fe6243cbe1a4b7c1 extends $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
|
|
120
120
|
fromJulianDay(jd) {
|
|
121
|
-
let [year, month, day] = $
|
|
121
|
+
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$COPTIC_EPOCH, jd);
|
|
122
122
|
let era = 'CE';
|
|
123
123
|
if (year <= 0) {
|
|
124
124
|
era = 'BCE';
|
|
125
125
|
year = 1 - year;
|
|
126
126
|
}
|
|
127
|
-
return new (0, $
|
|
127
|
+
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
128
128
|
}
|
|
129
129
|
toJulianDay(date) {
|
|
130
130
|
let year = date.year;
|
|
131
131
|
if (date.era === 'BCE') year = 1 - year;
|
|
132
|
-
return $
|
|
132
|
+
return $ca8f5bca40aaf2d4$var$ceToJulianDay($ca8f5bca40aaf2d4$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
133
133
|
}
|
|
134
134
|
getDaysInMonth(date) {
|
|
135
135
|
let year = date.year;
|
|
136
136
|
if (date.era === 'BCE') year = 1 - year;
|
|
137
|
-
return $
|
|
137
|
+
return $ca8f5bca40aaf2d4$var$getDaysInMonth(year, date.month);
|
|
138
138
|
}
|
|
139
139
|
isInverseEra(date) {
|
|
140
140
|
return date.era === 'BCE';
|
|
@@ -163,5 +163,5 @@ class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
export {$
|
|
167
|
-
//# sourceMappingURL=EthiopicCalendar.
|
|
166
|
+
export {$ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d as EthiopicCalendar, $ca8f5bca40aaf2d4$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $ca8f5bca40aaf2d4$export$fe6243cbe1a4b7c1 as CopticCalendar};
|
|
167
|
+
//# sourceMappingURL=EthiopicCalendar.js.map
|
|
@@ -1 +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,IAA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I;QAC3B;IACF;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAiC;;AAoDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\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 getMaximumMonthsInYear(): number {\n return 13;\n }\n\n getMaximumDaysInMonth(): number {\n return 30;\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(): string[] {\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: CalendarIdentifier = '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(): string[] {\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: CalendarIdentifier = '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): number {\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>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras(): string[] {\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 // BC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N,OAAO,IAAI;QACb;QAEA,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,OAAO;IAClD;IAEA,YAAY,IAAqB,EAAU;QACzC,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,EAAQ;QAChD,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,QAAQ,OAAO;YACvC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAiC;;AAoDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\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 getMaximumMonthsInYear(): number {\n return 13;\n }\n\n getMaximumDaysInMonth(): number {\n return 30;\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(): string[] {\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: CalendarIdentifier = '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(): string[] {\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: CalendarIdentifier = '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): number {\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>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras(): string[] {\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.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CalendarDate as $
|
|
1
|
+
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,12 +13,12 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./Calen
|
|
|
13
13
|
*/ // Portions of the code in this file are based on code from ICU.
|
|
14
14
|
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
15
15
|
|
|
16
|
-
const $
|
|
17
|
-
const $
|
|
16
|
+
const $97cfca9efd59523d$var$ETHIOPIC_EPOCH = 1723856;
|
|
17
|
+
const $97cfca9efd59523d$var$COPTIC_EPOCH = 1824665;
|
|
18
18
|
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
19
19
|
// AA 5501 = AM 1
|
|
20
|
-
const $
|
|
21
|
-
function $
|
|
20
|
+
const $97cfca9efd59523d$var$AMETE_MIHRET_DELTA = 5500;
|
|
21
|
+
function $97cfca9efd59523d$var$ceToJulianDay(epoch, year, month, day) {
|
|
22
22
|
return epoch // difference from Julian epoch to 1,1,1
|
|
23
23
|
+ 365 * year // number of days from years
|
|
24
24
|
+ Math.floor(year / 4) // extra day of leap year
|
|
@@ -26,20 +26,20 @@ function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
|
|
|
26
26
|
) + day - 1 // number of days for present month (1 based)
|
|
27
27
|
;
|
|
28
28
|
}
|
|
29
|
-
function $
|
|
29
|
+
function $97cfca9efd59523d$var$julianDayToCE(epoch, jd) {
|
|
30
30
|
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
31
|
-
let month = 1 + Math.floor((jd - $
|
|
32
|
-
let day = jd + 1 - $
|
|
31
|
+
let month = 1 + Math.floor((jd - $97cfca9efd59523d$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
32
|
+
let day = jd + 1 - $97cfca9efd59523d$var$ceToJulianDay(epoch, year, month, 1);
|
|
33
33
|
return [
|
|
34
34
|
year,
|
|
35
35
|
month,
|
|
36
36
|
day
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
function $
|
|
39
|
+
function $97cfca9efd59523d$var$getLeapDay(year) {
|
|
40
40
|
return Math.floor(year % 4 / 3);
|
|
41
41
|
}
|
|
42
|
-
function $
|
|
42
|
+
function $97cfca9efd59523d$var$getDaysInMonth(year, month) {
|
|
43
43
|
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
44
44
|
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
45
45
|
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
@@ -48,31 +48,31 @@ function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
|
|
|
48
48
|
if (month % 13 !== 0) // not intercalary month
|
|
49
49
|
return 30;
|
|
50
50
|
else // intercalary month 5 days + possible leap day
|
|
51
|
-
return $
|
|
51
|
+
return $97cfca9efd59523d$var$getLeapDay(year) + 5;
|
|
52
52
|
}
|
|
53
|
-
class $
|
|
53
|
+
class $97cfca9efd59523d$export$26ba6eab5e20cd7d {
|
|
54
54
|
fromJulianDay(jd) {
|
|
55
|
-
let [year, month, day] = $
|
|
55
|
+
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$ETHIOPIC_EPOCH, jd);
|
|
56
56
|
let era = 'AM';
|
|
57
57
|
if (year <= 0) {
|
|
58
58
|
era = 'AA';
|
|
59
|
-
year += $
|
|
59
|
+
year += $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
|
|
60
60
|
}
|
|
61
|
-
return new (0, $
|
|
61
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
62
62
|
}
|
|
63
63
|
toJulianDay(date) {
|
|
64
64
|
let year = date.year;
|
|
65
|
-
if (date.era === 'AA') year -= $
|
|
66
|
-
return $
|
|
65
|
+
if (date.era === 'AA') year -= $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
|
|
66
|
+
return $97cfca9efd59523d$var$ceToJulianDay($97cfca9efd59523d$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
67
67
|
}
|
|
68
68
|
getDaysInMonth(date) {
|
|
69
|
-
return $
|
|
69
|
+
return $97cfca9efd59523d$var$getDaysInMonth(date.year, date.month);
|
|
70
70
|
}
|
|
71
71
|
getMonthsInYear() {
|
|
72
72
|
return 13;
|
|
73
73
|
}
|
|
74
74
|
getDaysInYear(date) {
|
|
75
|
-
return 365 + $
|
|
75
|
+
return 365 + $97cfca9efd59523d$var$getLeapDay(date.year);
|
|
76
76
|
}
|
|
77
77
|
getMaximumMonthsInYear() {
|
|
78
78
|
return 13;
|
|
@@ -96,11 +96,11 @@ class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
|
96
96
|
this.identifier = 'ethiopic';
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
class $
|
|
99
|
+
class $97cfca9efd59523d$export$d72e0c37005a4914 extends $97cfca9efd59523d$export$26ba6eab5e20cd7d {
|
|
100
100
|
fromJulianDay(jd) {
|
|
101
|
-
let [year, month, day] = $
|
|
102
|
-
year += $
|
|
103
|
-
return new (0, $
|
|
101
|
+
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$ETHIOPIC_EPOCH, jd);
|
|
102
|
+
year += $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
|
|
103
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, 'AA', year, month, day);
|
|
104
104
|
}
|
|
105
105
|
getEras() {
|
|
106
106
|
return [
|
|
@@ -116,25 +116,25 @@ class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export
|
|
|
116
116
|
;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class $
|
|
119
|
+
class $97cfca9efd59523d$export$fe6243cbe1a4b7c1 extends $97cfca9efd59523d$export$26ba6eab5e20cd7d {
|
|
120
120
|
fromJulianDay(jd) {
|
|
121
|
-
let [year, month, day] = $
|
|
121
|
+
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$COPTIC_EPOCH, jd);
|
|
122
122
|
let era = 'CE';
|
|
123
123
|
if (year <= 0) {
|
|
124
124
|
era = 'BCE';
|
|
125
125
|
year = 1 - year;
|
|
126
126
|
}
|
|
127
|
-
return new (0, $
|
|
127
|
+
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, month, day);
|
|
128
128
|
}
|
|
129
129
|
toJulianDay(date) {
|
|
130
130
|
let year = date.year;
|
|
131
131
|
if (date.era === 'BCE') year = 1 - year;
|
|
132
|
-
return $
|
|
132
|
+
return $97cfca9efd59523d$var$ceToJulianDay($97cfca9efd59523d$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
133
133
|
}
|
|
134
134
|
getDaysInMonth(date) {
|
|
135
135
|
let year = date.year;
|
|
136
136
|
if (date.era === 'BCE') year = 1 - year;
|
|
137
|
-
return $
|
|
137
|
+
return $97cfca9efd59523d$var$getDaysInMonth(year, date.month);
|
|
138
138
|
}
|
|
139
139
|
isInverseEra(date) {
|
|
140
140
|
return date.era === 'BCE';
|
|
@@ -163,5 +163,5 @@ class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
export {$
|
|
167
|
-
//# sourceMappingURL=EthiopicCalendar.
|
|
166
|
+
export {$97cfca9efd59523d$export$26ba6eab5e20cd7d as EthiopicCalendar, $97cfca9efd59523d$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $97cfca9efd59523d$export$fe6243cbe1a4b7c1 as CopticCalendar};
|
|
167
|
+
//# sourceMappingURL=EthiopicCalendar.mjs.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,CA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AAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAiC;;AAoDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\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 getMaximumMonthsInYear(): number {\n return 13;\n }\n\n getMaximumDaysInMonth(): number {\n return 30;\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(): string[] {\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: CalendarIdentifier = '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(): string[] {\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: CalendarIdentifier = '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): number {\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>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras(): string[] {\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.mjs.map"}
|