@internationalized/date 3.5.3-nightly.4555 → 3.5.3-nightly.4560
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,175 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
|
|
2
|
+
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.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 the TC39 Temporal proposal.
|
|
15
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $62225008020f0a13$var$ERA_START_DATES = [
|
|
19
|
+
[
|
|
20
|
+
1868,
|
|
21
|
+
9,
|
|
22
|
+
8
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
1912,
|
|
26
|
+
7,
|
|
27
|
+
30
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
1926,
|
|
31
|
+
12,
|
|
32
|
+
25
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
1989,
|
|
36
|
+
1,
|
|
37
|
+
8
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
2019,
|
|
41
|
+
5,
|
|
42
|
+
1
|
|
43
|
+
]
|
|
44
|
+
];
|
|
45
|
+
const $62225008020f0a13$var$ERA_END_DATES = [
|
|
46
|
+
[
|
|
47
|
+
1912,
|
|
48
|
+
7,
|
|
49
|
+
29
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
1926,
|
|
53
|
+
12,
|
|
54
|
+
24
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
1989,
|
|
58
|
+
1,
|
|
59
|
+
7
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
2019,
|
|
63
|
+
4,
|
|
64
|
+
30
|
|
65
|
+
]
|
|
66
|
+
];
|
|
67
|
+
const $62225008020f0a13$var$ERA_ADDENDS = [
|
|
68
|
+
1867,
|
|
69
|
+
1911,
|
|
70
|
+
1925,
|
|
71
|
+
1988,
|
|
72
|
+
2018
|
|
73
|
+
];
|
|
74
|
+
const $62225008020f0a13$var$ERA_NAMES = [
|
|
75
|
+
"meiji",
|
|
76
|
+
"taisho",
|
|
77
|
+
"showa",
|
|
78
|
+
"heisei",
|
|
79
|
+
"reiwa"
|
|
80
|
+
];
|
|
81
|
+
function $62225008020f0a13$var$findEraFromGregorianDate(date) {
|
|
82
|
+
const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day])=>{
|
|
83
|
+
if (date.year < year) return true;
|
|
84
|
+
if (date.year === year && date.month < month) return true;
|
|
85
|
+
if (date.year === year && date.month === month && date.day < day) return true;
|
|
86
|
+
return false;
|
|
87
|
+
});
|
|
88
|
+
if (idx === -1) return $62225008020f0a13$var$ERA_START_DATES.length - 1;
|
|
89
|
+
if (idx === 0) return 0;
|
|
90
|
+
return idx - 1;
|
|
91
|
+
}
|
|
92
|
+
function $62225008020f0a13$var$toGregorian(date) {
|
|
93
|
+
let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date.era)];
|
|
94
|
+
if (!eraAddend) throw new Error("Unknown era: " + date.era);
|
|
95
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
|
|
96
|
+
}
|
|
97
|
+
class $62225008020f0a13$export$b746ab2b60cdffbf extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
|
|
98
|
+
fromJulianDay(jd) {
|
|
99
|
+
let date = super.fromJulianDay(jd);
|
|
100
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(date);
|
|
101
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, $62225008020f0a13$var$ERA_NAMES[era], date.year - $62225008020f0a13$var$ERA_ADDENDS[era], date.month, date.day);
|
|
102
|
+
}
|
|
103
|
+
toJulianDay(date) {
|
|
104
|
+
return super.toJulianDay($62225008020f0a13$var$toGregorian(date));
|
|
105
|
+
}
|
|
106
|
+
balanceDate(date) {
|
|
107
|
+
let gregorianDate = $62225008020f0a13$var$toGregorian(date);
|
|
108
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
|
|
109
|
+
if ($62225008020f0a13$var$ERA_NAMES[era] !== date.era) {
|
|
110
|
+
date.era = $62225008020f0a13$var$ERA_NAMES[era];
|
|
111
|
+
date.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
|
|
112
|
+
}
|
|
113
|
+
// Constrain in case we went before the first supported era.
|
|
114
|
+
this.constrainDate(date);
|
|
115
|
+
}
|
|
116
|
+
constrainDate(date) {
|
|
117
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
118
|
+
let end = $62225008020f0a13$var$ERA_END_DATES[idx];
|
|
119
|
+
if (end != null) {
|
|
120
|
+
let [endYear, endMonth, endDay] = end;
|
|
121
|
+
// Constrain the year to the maximum possible value in the era.
|
|
122
|
+
// Then constrain the month and day fields within that.
|
|
123
|
+
let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
|
|
124
|
+
date.year = Math.max(1, Math.min(maxYear, date.year));
|
|
125
|
+
if (date.year === maxYear) {
|
|
126
|
+
date.month = Math.min(endMonth, date.month);
|
|
127
|
+
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (date.year === 1 && idx >= 0) {
|
|
131
|
+
let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
132
|
+
date.month = Math.max(startMonth, date.month);
|
|
133
|
+
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
getEras() {
|
|
137
|
+
return $62225008020f0a13$var$ERA_NAMES;
|
|
138
|
+
}
|
|
139
|
+
getYearsInEra(date) {
|
|
140
|
+
// Get the number of years in the era, taking into account the date's month and day fields.
|
|
141
|
+
let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
142
|
+
let cur = $62225008020f0a13$var$ERA_START_DATES[era];
|
|
143
|
+
let next = $62225008020f0a13$var$ERA_START_DATES[era + 1];
|
|
144
|
+
if (next == null) // 9999 gregorian is the maximum year allowed.
|
|
145
|
+
return 9999 - cur[0] + 1;
|
|
146
|
+
let years = next[0] - cur[0];
|
|
147
|
+
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
|
|
148
|
+
return years;
|
|
149
|
+
}
|
|
150
|
+
getDaysInMonth(date) {
|
|
151
|
+
return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date));
|
|
152
|
+
}
|
|
153
|
+
getMinimumMonthInYear(date) {
|
|
154
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
155
|
+
return start ? start[1] : 1;
|
|
156
|
+
}
|
|
157
|
+
getMinimumDayInMonth(date) {
|
|
158
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
159
|
+
return start && date.month === start[1] ? start[2] : 1;
|
|
160
|
+
}
|
|
161
|
+
constructor(...args){
|
|
162
|
+
super(...args);
|
|
163
|
+
this.identifier = "japanese";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function $62225008020f0a13$var$getMinimums(date) {
|
|
167
|
+
if (date.year === 1) {
|
|
168
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
169
|
+
return $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
export {$62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar};
|
|
175
|
+
//# sourceMappingURL=JapaneseCalendar.mjs.map
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
|
|
2
|
+
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
|
|
15
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $62225008020f0a13$var$ERA_START_DATES = [
|
|
19
|
+
[
|
|
20
|
+
1868,
|
|
21
|
+
9,
|
|
22
|
+
8
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
1912,
|
|
26
|
+
7,
|
|
27
|
+
30
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
1926,
|
|
31
|
+
12,
|
|
32
|
+
25
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
1989,
|
|
36
|
+
1,
|
|
37
|
+
8
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
2019,
|
|
41
|
+
5,
|
|
42
|
+
1
|
|
43
|
+
]
|
|
44
|
+
];
|
|
45
|
+
const $62225008020f0a13$var$ERA_END_DATES = [
|
|
46
|
+
[
|
|
47
|
+
1912,
|
|
48
|
+
7,
|
|
49
|
+
29
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
1926,
|
|
53
|
+
12,
|
|
54
|
+
24
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
1989,
|
|
58
|
+
1,
|
|
59
|
+
7
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
2019,
|
|
63
|
+
4,
|
|
64
|
+
30
|
|
65
|
+
]
|
|
66
|
+
];
|
|
67
|
+
const $62225008020f0a13$var$ERA_ADDENDS = [
|
|
68
|
+
1867,
|
|
69
|
+
1911,
|
|
70
|
+
1925,
|
|
71
|
+
1988,
|
|
72
|
+
2018
|
|
73
|
+
];
|
|
74
|
+
const $62225008020f0a13$var$ERA_NAMES = [
|
|
75
|
+
"meiji",
|
|
76
|
+
"taisho",
|
|
77
|
+
"showa",
|
|
78
|
+
"heisei",
|
|
79
|
+
"reiwa"
|
|
80
|
+
];
|
|
81
|
+
function $62225008020f0a13$var$findEraFromGregorianDate(date) {
|
|
82
|
+
const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day])=>{
|
|
83
|
+
if (date.year < year) return true;
|
|
84
|
+
if (date.year === year && date.month < month) return true;
|
|
85
|
+
if (date.year === year && date.month === month && date.day < day) return true;
|
|
86
|
+
return false;
|
|
87
|
+
});
|
|
88
|
+
if (idx === -1) return $62225008020f0a13$var$ERA_START_DATES.length - 1;
|
|
89
|
+
if (idx === 0) return 0;
|
|
90
|
+
return idx - 1;
|
|
91
|
+
}
|
|
92
|
+
function $62225008020f0a13$var$toGregorian(date) {
|
|
93
|
+
let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date.era)];
|
|
94
|
+
if (!eraAddend) throw new Error("Unknown era: " + date.era);
|
|
95
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
|
|
96
|
+
}
|
|
97
|
+
class $62225008020f0a13$export$b746ab2b60cdffbf extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
|
|
98
|
+
fromJulianDay(jd) {
|
|
99
|
+
let date = super.fromJulianDay(jd);
|
|
100
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(date);
|
|
101
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, $62225008020f0a13$var$ERA_NAMES[era], date.year - $62225008020f0a13$var$ERA_ADDENDS[era], date.month, date.day);
|
|
102
|
+
}
|
|
103
|
+
toJulianDay(date) {
|
|
104
|
+
return super.toJulianDay($62225008020f0a13$var$toGregorian(date));
|
|
105
|
+
}
|
|
106
|
+
balanceDate(date) {
|
|
107
|
+
let gregorianDate = $62225008020f0a13$var$toGregorian(date);
|
|
108
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
|
|
109
|
+
if ($62225008020f0a13$var$ERA_NAMES[era] !== date.era) {
|
|
110
|
+
date.era = $62225008020f0a13$var$ERA_NAMES[era];
|
|
111
|
+
date.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
|
|
112
|
+
}
|
|
113
|
+
// Constrain in case we went before the first supported era.
|
|
114
|
+
this.constrainDate(date);
|
|
115
|
+
}
|
|
116
|
+
constrainDate(date) {
|
|
117
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
118
|
+
let end = $62225008020f0a13$var$ERA_END_DATES[idx];
|
|
119
|
+
if (end != null) {
|
|
120
|
+
let [endYear, endMonth, endDay] = end;
|
|
121
|
+
// Constrain the year to the maximum possible value in the era.
|
|
122
|
+
// Then constrain the month and day fields within that.
|
|
123
|
+
let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
|
|
124
|
+
date.year = Math.max(1, Math.min(maxYear, date.year));
|
|
125
|
+
if (date.year === maxYear) {
|
|
126
|
+
date.month = Math.min(endMonth, date.month);
|
|
127
|
+
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (date.year === 1 && idx >= 0) {
|
|
131
|
+
let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
132
|
+
date.month = Math.max(startMonth, date.month);
|
|
133
|
+
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
getEras() {
|
|
137
|
+
return $62225008020f0a13$var$ERA_NAMES;
|
|
138
|
+
}
|
|
139
|
+
getYearsInEra(date) {
|
|
140
|
+
// Get the number of years in the era, taking into account the date's month and day fields.
|
|
141
|
+
let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
142
|
+
let cur = $62225008020f0a13$var$ERA_START_DATES[era];
|
|
143
|
+
let next = $62225008020f0a13$var$ERA_START_DATES[era + 1];
|
|
144
|
+
if (next == null) // 9999 gregorian is the maximum year allowed.
|
|
145
|
+
return 9999 - cur[0] + 1;
|
|
146
|
+
let years = next[0] - cur[0];
|
|
147
|
+
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
|
|
148
|
+
return years;
|
|
149
|
+
}
|
|
150
|
+
getDaysInMonth(date) {
|
|
151
|
+
return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date));
|
|
152
|
+
}
|
|
153
|
+
getMinimumMonthInYear(date) {
|
|
154
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
155
|
+
return start ? start[1] : 1;
|
|
156
|
+
}
|
|
157
|
+
getMinimumDayInMonth(date) {
|
|
158
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
159
|
+
return start && date.month === start[1] ? start[2] : 1;
|
|
160
|
+
}
|
|
161
|
+
constructor(...args){
|
|
162
|
+
super(...args);
|
|
163
|
+
this.identifier = "japanese";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function $62225008020f0a13$var$getMinimums(date) {
|
|
167
|
+
if (date.year === 1) {
|
|
168
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
169
|
+
return $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
export {$62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar};
|
|
175
|
+
//# sourceMappingURL=JapaneseCalendar.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAE;CAAC;AACjG,MAAM,sCAAgB;IAAC;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;CAAC;AAClF,MAAM,oCAAc;IAAC;IAAM;IAAM;IAAM;IAAM;CAAK;AAClD,MAAM,kCAAY;IAAC;IAAS;IAAU;IAAS;IAAU;CAAQ;AAEjE,SAAS,+CAAyB,IAAqB;IACrD,MAAM,MAAM,sCAAgB,SAAS,CAAC,CAAC,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,IAAK,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,EAAE,EACvE;QAGF,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,sBAAsB,IAAqB,EAAU;QACnD,IAAI,QAAQ,kCAAY;QACxB,OAAO,QAAQ,KAAK,CAAC,EAAE,GAAG;IAC5B;IAEA,qBAAqB,IAAqB,EAAU;QAClD,IAAI,QAAQ,kCAAY;QACxB,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;;aAhGA,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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 the TC39 Temporal proposal.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\n }\n\n return idx - 1;\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let eraAddend = ERA_ADDENDS[ERA_NAMES.indexOf(date.era)];\n if (!eraAddend) {\n throw new Error('Unknown era: ' + date.era);\n }\n\n return new CalendarDate(\n date.year + eraAddend,\n date.month,\n date.day\n );\n}\n\n/**\n * The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.\n * Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.\n * Note that eras before 1868 (Gregorian) are not currently supported by this implementation.\n */\nexport class JapaneseCalendar extends GregorianCalendar {\n identifier = 'japanese';\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let era = findEraFromGregorianDate(date);\n\n return new CalendarDate(\n this,\n ERA_NAMES[era],\n date.year - ERA_ADDENDS[era],\n date.month,\n date.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let gregorianDate = toGregorian(date);\n let era = findEraFromGregorianDate(gregorianDate);\n\n if (ERA_NAMES[era] !== date.era) {\n date.era = ERA_NAMES[era];\n date.year = gregorianDate.year - ERA_ADDENDS[era];\n }\n\n // Constrain in case we went before the first supported era.\n this.constrainDate(date);\n }\n\n constrainDate(date: Mutable<AnyCalendarDate>) {\n let idx = ERA_NAMES.indexOf(date.era);\n let end = ERA_END_DATES[idx];\n if (end != null) {\n let [endYear, endMonth, endDay] = end;\n\n // Constrain the year to the maximum possible value in the era.\n // Then constrain the month and day fields within that.\n let maxYear = endYear - ERA_ADDENDS[idx];\n date.year = Math.max(1, Math.min(maxYear, date.year));\n if (date.year === maxYear) {\n date.month = Math.min(endMonth, date.month);\n\n if (date.month === endMonth) {\n date.day = Math.min(endDay, date.day);\n }\n }\n }\n\n if (date.year === 1 && idx >= 0) {\n let [, startMonth, startDay] = ERA_START_DATES[idx];\n date.month = Math.max(startMonth, date.month);\n\n if (date.month === startMonth) {\n date.day = Math.max(startDay, date.day);\n }\n }\n }\n\n getEras() {\n return ERA_NAMES;\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // Get the number of years in the era, taking into account the date's month and day fields.\n let era = ERA_NAMES.indexOf(date.era);\n let cur = ERA_START_DATES[era];\n let next = ERA_START_DATES[era + 1];\n if (next == null) {\n // 9999 gregorian is the maximum year allowed.\n return 9999 - cur[0] + 1;\n }\n\n let years = next[0] - cur[0];\n\n if (date.month < next[1] || (date.month === next[1] && date.day < next[2])) {\n years++;\n }\n\n return years;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getMinimumMonthInYear(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start ? start[1] : 1;\n }\n\n getMinimumDayInMonth(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start && date.month === start[1] ? start[2] : 1;\n }\n}\n\nfunction getMinimums(date: AnyCalendarDate) {\n if (date.year === 1) {\n let idx = ERA_NAMES.indexOf(date.era);\n return ERA_START_DATES[idx];\n }\n}\n"],"names":[],"version":3,"file":"JapaneseCalendar.module.js.map"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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, "PersianCalendar", () => $3c060181fc7249ae$export$37fccdbfd14c5939);
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
21
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $3c060181fc7249ae$var$PERSIAN_EPOCH = 1948320;
|
|
25
|
+
// Number of days from the start of the year to the start of each month.
|
|
26
|
+
const $3c060181fc7249ae$var$MONTH_START = [
|
|
27
|
+
0,
|
|
28
|
+
31,
|
|
29
|
+
62,
|
|
30
|
+
93,
|
|
31
|
+
124,
|
|
32
|
+
155,
|
|
33
|
+
186,
|
|
34
|
+
216,
|
|
35
|
+
246,
|
|
36
|
+
276,
|
|
37
|
+
306,
|
|
38
|
+
336 // Esfand
|
|
39
|
+
];
|
|
40
|
+
class $3c060181fc7249ae$export$37fccdbfd14c5939 {
|
|
41
|
+
fromJulianDay(jd) {
|
|
42
|
+
let daysSinceEpoch = jd - $3c060181fc7249ae$var$PERSIAN_EPOCH;
|
|
43
|
+
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
|
|
44
|
+
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
|
|
45
|
+
let dayOfYear = daysSinceEpoch - farvardin1;
|
|
46
|
+
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
|
|
47
|
+
let day = dayOfYear - $3c060181fc7249ae$var$MONTH_START[month] + 1;
|
|
48
|
+
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, year, month + 1, day);
|
|
49
|
+
}
|
|
50
|
+
toJulianDay(date) {
|
|
51
|
+
let jd = $3c060181fc7249ae$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
|
|
52
|
+
jd += $3c060181fc7249ae$var$MONTH_START[date.month - 1];
|
|
53
|
+
jd += date.day;
|
|
54
|
+
return jd;
|
|
55
|
+
}
|
|
56
|
+
getMonthsInYear() {
|
|
57
|
+
return 12;
|
|
58
|
+
}
|
|
59
|
+
getDaysInMonth(date) {
|
|
60
|
+
if (date.month <= 6) return 31;
|
|
61
|
+
if (date.month <= 11) return 30;
|
|
62
|
+
let isLeapYear = (0, $a5090d6430502238$exports.mod)(25 * date.year + 11, 33) < 8;
|
|
63
|
+
return isLeapYear ? 30 : 29;
|
|
64
|
+
}
|
|
65
|
+
getEras() {
|
|
66
|
+
return [
|
|
67
|
+
"AP"
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
getYearsInEra() {
|
|
71
|
+
// 9378-10-10 persian is 9999-12-31 gregorian.
|
|
72
|
+
// Round down to 9377 to set the maximum full year.
|
|
73
|
+
return 9377;
|
|
74
|
+
}
|
|
75
|
+
constructor(){
|
|
76
|
+
this.identifier = "persian";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=PersianCalendar.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,g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;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aA9CA,aAAa;;AA+Cf","sources":["packages/@internationalized/date/src/calendars/PersianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n"],"names":[],"version":3,"file":"PersianCalendar.main.js.map"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
|
|
19
|
+
// Number of days from the start of the year to the start of each month.
|
|
20
|
+
const $f3ed2e4472ae7e25$var$MONTH_START = [
|
|
21
|
+
0,
|
|
22
|
+
31,
|
|
23
|
+
62,
|
|
24
|
+
93,
|
|
25
|
+
124,
|
|
26
|
+
155,
|
|
27
|
+
186,
|
|
28
|
+
216,
|
|
29
|
+
246,
|
|
30
|
+
276,
|
|
31
|
+
306,
|
|
32
|
+
336 // Esfand
|
|
33
|
+
];
|
|
34
|
+
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
|
|
35
|
+
fromJulianDay(jd) {
|
|
36
|
+
let daysSinceEpoch = jd - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
|
|
37
|
+
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
|
|
38
|
+
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
|
|
39
|
+
let dayOfYear = daysSinceEpoch - farvardin1;
|
|
40
|
+
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
|
|
41
|
+
let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
|
|
42
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month + 1, day);
|
|
43
|
+
}
|
|
44
|
+
toJulianDay(date) {
|
|
45
|
+
let jd = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
|
|
46
|
+
jd += $f3ed2e4472ae7e25$var$MONTH_START[date.month - 1];
|
|
47
|
+
jd += date.day;
|
|
48
|
+
return jd;
|
|
49
|
+
}
|
|
50
|
+
getMonthsInYear() {
|
|
51
|
+
return 12;
|
|
52
|
+
}
|
|
53
|
+
getDaysInMonth(date) {
|
|
54
|
+
if (date.month <= 6) return 31;
|
|
55
|
+
if (date.month <= 11) return 30;
|
|
56
|
+
let isLeapYear = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
|
|
57
|
+
return isLeapYear ? 30 : 29;
|
|
58
|
+
}
|
|
59
|
+
getEras() {
|
|
60
|
+
return [
|
|
61
|
+
"AP"
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
getYearsInEra() {
|
|
65
|
+
// 9378-10-10 persian is 9999-12-31 gregorian.
|
|
66
|
+
// Round down to 9377 to set the maximum full year.
|
|
67
|
+
return 9377;
|
|
68
|
+
}
|
|
69
|
+
constructor(){
|
|
70
|
+
this.identifier = "persian";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export {$f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar};
|
|
76
|
+
//# sourceMappingURL=PersianCalendar.mjs.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
|
|
2
|
+
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.module.js";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/ // Portions of the code in this file are based on code from ICU.
|
|
15
|
+
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
|
|
19
|
+
// Number of days from the start of the year to the start of each month.
|
|
20
|
+
const $f3ed2e4472ae7e25$var$MONTH_START = [
|
|
21
|
+
0,
|
|
22
|
+
31,
|
|
23
|
+
62,
|
|
24
|
+
93,
|
|
25
|
+
124,
|
|
26
|
+
155,
|
|
27
|
+
186,
|
|
28
|
+
216,
|
|
29
|
+
246,
|
|
30
|
+
276,
|
|
31
|
+
306,
|
|
32
|
+
336 // Esfand
|
|
33
|
+
];
|
|
34
|
+
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
|
|
35
|
+
fromJulianDay(jd) {
|
|
36
|
+
let daysSinceEpoch = jd - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
|
|
37
|
+
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
|
|
38
|
+
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
|
|
39
|
+
let dayOfYear = daysSinceEpoch - farvardin1;
|
|
40
|
+
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
|
|
41
|
+
let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
|
|
42
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month + 1, day);
|
|
43
|
+
}
|
|
44
|
+
toJulianDay(date) {
|
|
45
|
+
let jd = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
|
|
46
|
+
jd += $f3ed2e4472ae7e25$var$MONTH_START[date.month - 1];
|
|
47
|
+
jd += date.day;
|
|
48
|
+
return jd;
|
|
49
|
+
}
|
|
50
|
+
getMonthsInYear() {
|
|
51
|
+
return 12;
|
|
52
|
+
}
|
|
53
|
+
getDaysInMonth(date) {
|
|
54
|
+
if (date.month <= 6) return 31;
|
|
55
|
+
if (date.month <= 11) return 30;
|
|
56
|
+
let isLeapYear = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
|
|
57
|
+
return isLeapYear ? 30 : 29;
|
|
58
|
+
}
|
|
59
|
+
getEras() {
|
|
60
|
+
return [
|
|
61
|
+
"AP"
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
getYearsInEra() {
|
|
65
|
+
// 9378-10-10 persian is 9999-12-31 gregorian.
|
|
66
|
+
// Round down to 9377 to set the maximum full year.
|
|
67
|
+
return 9377;
|
|
68
|
+
}
|
|
69
|
+
constructor(){
|
|
70
|
+
this.identifier = "persian";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export {$f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar};
|
|
76
|
+
//# sourceMappingURL=PersianCalendar.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,sCAAgB;AAEtB,wEAAwE;AACxE,MAAM,oCAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAK,SAAS;CACf;AAQM,MAAM;IAGX,cAAc,EAAU,EAAgB;QACtC,IAAI,iBAAiB,KAAK;QAC1B,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,iBAAiB,CAAA,IAAK;QACtD,IAAI,aAAa,MAAO,CAAA,OAAO,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,OAAO,EAAC,IAAK;QACjE,IAAI,YAAY,iBAAiB;QACjC,IAAI,QAAQ,YAAY,MACpB,KAAK,KAAK,CAAC,YAAY,MACvB,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACjC,IAAI,MAAM,YAAY,iCAAW,CAAC,MAAM,GAAG;QAC3C,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,MAAM,QAAQ,GAAG;IACjD;IAEA,YAAY,IAAqB,EAAU;QACzC,IAAI,KAAK,sCAAgB,IAAI,MAAO,CAAA,KAAK,IAAI,GAAG,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAI,GAAG,EAAC,IAAK;QACvF,MAAM,iCAAW,CAAC,KAAK,KAAK,GAAG,EAAE;QACjC,MAAM,KAAK,GAAG;QACd,OAAO;IACT;IAEA,kBAA0B;QACxB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,IAAI,GAChB,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,IAChB,OAAO;QAGT,IAAI,aAAa,CAAA,GAAA,yCAAE,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,MAAM;QAChD,OAAO,aAAa,KAAK;IAC3B;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aA9CA,aAAa;;AA+Cf","sources":["packages/@internationalized/date/src/calendars/PersianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n"],"names":[],"version":3,"file":"PersianCalendar.module.js.map"}
|