@formatjs/intl-datetimeformat-calendar-japanese 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +71 -80
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
|
+
// packages/ecma262-abstract/intrinsics.js
|
|
2
|
+
const floor = Math.floor;
|
|
3
|
+
const numberFrom = Number;
|
|
4
|
+
const numberIsInteger = Number.isInteger;
|
|
5
|
+
const numberIsFinite = Number.isFinite;
|
|
6
|
+
const numberIsSafeInteger = Number.isSafeInteger;
|
|
7
|
+
const ErrorConstructor = Error;
|
|
8
|
+
const RangeErrorConstructor = RangeError;
|
|
9
|
+
const arrayApply = Reflect.apply;
|
|
10
|
+
Array.prototype.every;
|
|
11
|
+
Array.prototype.some;
|
|
12
|
+
const includes = Array.prototype.includes;
|
|
13
|
+
Array.prototype.indexOf;
|
|
14
|
+
function arrayIncludes(values, search) {
|
|
15
|
+
return arrayApply(includes, values, [search]);
|
|
16
|
+
}
|
|
1
17
|
// packages/ecma262-abstract/DateOperations.js
|
|
2
18
|
const MS_PER_DAY = 864e5;
|
|
3
19
|
function Day(t) {
|
|
4
|
-
return
|
|
20
|
+
return floor(t / MS_PER_DAY);
|
|
5
21
|
}
|
|
6
22
|
function DayFromYear(y) {
|
|
7
|
-
return 365 * (y - 1970) +
|
|
23
|
+
return 365 * (y - 1970) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400);
|
|
8
24
|
}
|
|
9
25
|
function YearFromTime(t) {
|
|
10
|
-
if (!
|
|
26
|
+
if (!numberIsFinite(t)) return NaN;
|
|
11
27
|
const day = Day(t);
|
|
12
|
-
let year = 1970 +
|
|
28
|
+
let year = 1970 + floor(day / 365.2425);
|
|
13
29
|
while (DayFromYear(year) > day) year--;
|
|
14
30
|
while (DayFromYear(year + 1) <= day) year++;
|
|
15
31
|
return year;
|
|
@@ -20,47 +36,6 @@ function DaysInYear(y) {
|
|
|
20
36
|
if (y % 400 !== 0) return 365;
|
|
21
37
|
return 366;
|
|
22
38
|
}
|
|
23
|
-
function DayWithinYear(t) {
|
|
24
|
-
return Day(t) - DayFromYear(YearFromTime(t));
|
|
25
|
-
}
|
|
26
|
-
function InLeapYear(t) {
|
|
27
|
-
return DaysInYear(YearFromTime(t)) === 365 ? 0 : 1;
|
|
28
|
-
}
|
|
29
|
-
function MonthFromTime(t) {
|
|
30
|
-
const dwy = DayWithinYear(t);
|
|
31
|
-
const leap = InLeapYear(t);
|
|
32
|
-
if (dwy >= 0 && dwy < 31) return 0;
|
|
33
|
-
if (dwy < 59 + leap) return 1;
|
|
34
|
-
if (dwy < 90 + leap) return 2;
|
|
35
|
-
if (dwy < 120 + leap) return 3;
|
|
36
|
-
if (dwy < 151 + leap) return 4;
|
|
37
|
-
if (dwy < 181 + leap) return 5;
|
|
38
|
-
if (dwy < 212 + leap) return 6;
|
|
39
|
-
if (dwy < 243 + leap) return 7;
|
|
40
|
-
if (dwy < 273 + leap) return 8;
|
|
41
|
-
if (dwy < 304 + leap) return 9;
|
|
42
|
-
if (dwy < 334 + leap) return 10;
|
|
43
|
-
if (dwy < 365 + leap) return 11;
|
|
44
|
-
throw new Error("Invalid time");
|
|
45
|
-
}
|
|
46
|
-
function DateFromTime(t) {
|
|
47
|
-
const dwy = DayWithinYear(t);
|
|
48
|
-
const mft = MonthFromTime(t);
|
|
49
|
-
const leap = InLeapYear(t);
|
|
50
|
-
if (mft === 0) return dwy + 1;
|
|
51
|
-
if (mft === 1) return dwy - 30;
|
|
52
|
-
if (mft === 2) return dwy - 58 - leap;
|
|
53
|
-
if (mft === 3) return dwy - 89 - leap;
|
|
54
|
-
if (mft === 4) return dwy - 119 - leap;
|
|
55
|
-
if (mft === 5) return dwy - 150 - leap;
|
|
56
|
-
if (mft === 6) return dwy - 180 - leap;
|
|
57
|
-
if (mft === 7) return dwy - 211 - leap;
|
|
58
|
-
if (mft === 8) return dwy - 242 - leap;
|
|
59
|
-
if (mft === 9) return dwy - 272 - leap;
|
|
60
|
-
if (mft === 10) return dwy - 303 - leap;
|
|
61
|
-
if (mft === 11) return dwy - 333 - leap;
|
|
62
|
-
throw new Error("Invalid time");
|
|
63
|
-
}
|
|
64
39
|
// packages/ecma402-abstract/Calendar/Arithmetic.js
|
|
65
40
|
const monthStarts = [
|
|
66
41
|
0,
|
|
@@ -76,30 +51,30 @@ const monthStarts = [
|
|
|
76
51
|
304,
|
|
77
52
|
334
|
|
78
53
|
];
|
|
79
|
-
const mod = (value, divisor) => value -
|
|
54
|
+
const mod = (value, divisor) => value - floor(value / divisor) * divisor;
|
|
80
55
|
function integer(value) {
|
|
81
|
-
if (!
|
|
56
|
+
if (!numberIsSafeInteger(value)) throw new RangeErrorConstructor("Expected safe integer");
|
|
82
57
|
return value;
|
|
83
58
|
}
|
|
84
59
|
function HebrewLeapYear(year) {
|
|
85
60
|
return mod(7 * year + 1, 19) < 7;
|
|
86
61
|
}
|
|
87
62
|
function HebrewElapsedMonths(year) {
|
|
88
|
-
return
|
|
63
|
+
return floor((235 * year - 234) / 19);
|
|
89
64
|
}
|
|
90
65
|
function hebrewDelay(year) {
|
|
91
66
|
const months = HebrewElapsedMonths(year);
|
|
92
|
-
const day = 29 * months +
|
|
93
|
-
return day +
|
|
67
|
+
const day = 29 * months + floor((12084 + 13753 * months) / 25920);
|
|
68
|
+
return day + numberFrom(mod(3 * (day + 1), 7) < 3);
|
|
94
69
|
}
|
|
95
70
|
function IsISOCalendar(calendar) {
|
|
96
|
-
return [
|
|
71
|
+
return arrayIncludes([
|
|
97
72
|
"iso8601",
|
|
98
73
|
"gregory",
|
|
99
74
|
"buddhist",
|
|
100
75
|
"japanese",
|
|
101
76
|
"roc"
|
|
102
|
-
]
|
|
77
|
+
], calendar);
|
|
103
78
|
}
|
|
104
79
|
function CalendarISOYear(calendar, year) {
|
|
105
80
|
return year + (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0);
|
|
@@ -107,48 +82,48 @@ function CalendarISOYear(calendar, year) {
|
|
|
107
82
|
function ArithmeticCalendarStartOfYear(calendar, year) {
|
|
108
83
|
if (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));
|
|
109
84
|
switch (calendar) {
|
|
110
|
-
case "coptic": return -615923 + 365 * year +
|
|
111
|
-
case "ethiopic": return -716732 + 365 * year +
|
|
85
|
+
case "coptic": return -615923 + 365 * year + floor(year / 4);
|
|
86
|
+
case "ethiopic": return -716732 + 365 * year + floor(year / 4);
|
|
112
87
|
case "ethioaa": {
|
|
113
88
|
const value = year - 5500;
|
|
114
|
-
return -716732 + 365 * value +
|
|
89
|
+
return -716732 + 365 * value + floor(value / 4);
|
|
115
90
|
}
|
|
116
91
|
case "indian": return DayFromYear(year + 78) + 80;
|
|
117
92
|
case "islamic-civil":
|
|
118
|
-
case "islamic-tbla": return -492148 -
|
|
119
|
-
case "persian": return -492268 + 365 * (year - 1) +
|
|
93
|
+
case "islamic-tbla": return -492148 - numberFrom(calendar === "islamic-tbla") + 354 * (year - 1) + floor((3 + 11 * year) / 30);
|
|
94
|
+
case "persian": return -492268 + 365 * (year - 1) + floor((8 * year + 21) / 33);
|
|
120
95
|
}
|
|
121
96
|
const present = hebrewDelay(year);
|
|
122
97
|
return -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);
|
|
123
98
|
}
|
|
124
99
|
function ArithmeticCalendarMonthsInYear(calendar, year) {
|
|
125
|
-
return [
|
|
100
|
+
return arrayIncludes([
|
|
126
101
|
"coptic",
|
|
127
102
|
"ethiopic",
|
|
128
103
|
"ethioaa"
|
|
129
|
-
]
|
|
104
|
+
], calendar) || calendar === "hebrew" && HebrewLeapYear(year) ? 13 : 12;
|
|
130
105
|
}
|
|
131
106
|
function ArithmeticCalendarDaysInMonth(calendar, year, month) {
|
|
132
107
|
const count = ArithmeticCalendarMonthsInYear(calendar, year);
|
|
133
|
-
if (integer(month) < 1 || month > count) throw new
|
|
134
|
-
if (IsISOCalendar(calendar)) return month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] +
|
|
108
|
+
if (integer(month) < 1 || month > count) throw new RangeErrorConstructor("Invalid calendar month");
|
|
109
|
+
if (IsISOCalendar(calendar)) return month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] + numberFrom(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);
|
|
135
110
|
const length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);
|
|
136
|
-
if ([
|
|
111
|
+
if (arrayIncludes([
|
|
137
112
|
"coptic",
|
|
138
113
|
"ethiopic",
|
|
139
114
|
"ethioaa"
|
|
140
|
-
]
|
|
141
|
-
if (calendar === "indian") return month === 1 ? 30 +
|
|
115
|
+
], calendar)) return month === 13 ? length - 360 : 30;
|
|
116
|
+
if (calendar === "indian") return month === 1 ? 30 + numberFrom(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;
|
|
142
117
|
if (calendar === "islamic-civil" || calendar === "islamic-tbla") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;
|
|
143
118
|
if (calendar === "persian") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;
|
|
144
|
-
const code = month +
|
|
145
|
-
if ([
|
|
119
|
+
const code = month + numberFrom(!HebrewLeapYear(year) && month >= 6);
|
|
120
|
+
if (arrayIncludes([
|
|
146
121
|
4,
|
|
147
122
|
7,
|
|
148
123
|
9,
|
|
149
124
|
11,
|
|
150
125
|
13
|
|
151
|
-
]
|
|
126
|
+
], code)) return 29;
|
|
152
127
|
if (code === 2) return length % 10 === 5 ? 30 : 29;
|
|
153
128
|
if (code === 3) return length % 10 === 3 ? 29 : 30;
|
|
154
129
|
return 30;
|
|
@@ -156,41 +131,54 @@ function ArithmeticCalendarDaysInMonth(calendar, year, month) {
|
|
|
156
131
|
function ArithmeticCalendarMonthCode(calendar, year, month) {
|
|
157
132
|
const leap = calendar === "hebrew" && HebrewLeapYear(year);
|
|
158
133
|
if (leap && month === 6) return "M05L";
|
|
159
|
-
const code = month -
|
|
134
|
+
const code = month - numberFrom(leap && month > 6);
|
|
160
135
|
return "M" + (code < 10 ? "0" : "") + code;
|
|
161
136
|
}
|
|
137
|
+
function ArithmeticGregorianFromEpochDay(calendar, epoch) {
|
|
138
|
+
const shifted = epoch + 719468, era = floor(shifted / 146097), dayOfEra = shifted - era * 146097 >>> 0, yearOfEra = (dayOfEra - (dayOfEra / 1460 | 0) + (dayOfEra / 36524 | 0) - (dayOfEra / 146096 | 0)) / 365 | 0, ordinal = dayOfEra - (365 * yearOfEra + (yearOfEra / 4 | 0) - (yearOfEra / 100 | 0)), marchMonth = (5 * ordinal + 2) / 153 | 0, month = marchMonth < 10 ? marchMonth + 3 : marchMonth - 9, year = yearOfEra + era * 400 + numberFrom(month <= 2) - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0);
|
|
139
|
+
return {
|
|
140
|
+
year,
|
|
141
|
+
month,
|
|
142
|
+
monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
|
|
143
|
+
day: ordinal - ((153 * marchMonth + 2) / 5 | 0) + 1
|
|
144
|
+
};
|
|
145
|
+
}
|
|
162
146
|
function ArithmeticCalendarFromEpochDay(calendar, epoch) {
|
|
147
|
+
const iso = IsISOCalendar(calendar);
|
|
148
|
+
if (iso && numberIsInteger(epoch) && epoch >= -11e7 && epoch <= 11e7) return ArithmeticGregorianFromEpochDay(calendar, epoch);
|
|
163
149
|
const t = epoch * 864e5, civilYear = YearFromTime(t);
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
150
|
+
if (iso) {
|
|
151
|
+
const ordinal = floor(t / 864e5) - DayFromYear(civilYear), leap = DaysInYear(civilYear) === 366 ? 1 : 0;
|
|
152
|
+
if (!(ordinal >= 0 && ordinal < 365 + leap)) throw new ErrorConstructor("Invalid time");
|
|
153
|
+
const year = civilYear - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0), month = ordinal < 31 ? 1 : ordinal < 59 + leap ? 2 : 3 + floor((5 * (ordinal - 59 - leap) + 2) / 153);
|
|
166
154
|
return {
|
|
167
155
|
year,
|
|
168
156
|
month,
|
|
169
157
|
monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
|
|
170
|
-
day:
|
|
158
|
+
day: ordinal - monthStarts[month - 1] - (month > 2 ? leap : 0) + 1
|
|
171
159
|
};
|
|
172
160
|
}
|
|
173
161
|
const jd = epoch + 2440588;
|
|
174
162
|
let year;
|
|
175
163
|
switch (calendar) {
|
|
176
164
|
case "coptic":
|
|
177
|
-
year =
|
|
165
|
+
year = floor((4 * (jd - 1824665) + 3) / 1461);
|
|
178
166
|
break;
|
|
179
167
|
case "ethiopic":
|
|
180
168
|
case "ethioaa":
|
|
181
|
-
year =
|
|
169
|
+
year = floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === "ethioaa" ? 5500 : 0);
|
|
182
170
|
break;
|
|
183
171
|
case "islamic-civil":
|
|
184
172
|
case "islamic-tbla":
|
|
185
|
-
year =
|
|
173
|
+
year = floor((30 * (jd - 1948440 + numberFrom(calendar === "islamic-tbla")) + 10646) / 10631);
|
|
186
174
|
break;
|
|
187
175
|
case "persian":
|
|
188
|
-
year = 1 +
|
|
176
|
+
year = 1 + floor((33 * (jd - 1948320) + 3) / 12053);
|
|
189
177
|
break;
|
|
190
178
|
case "indian":
|
|
191
179
|
year = civilYear - 78;
|
|
192
180
|
break;
|
|
193
|
-
default: year =
|
|
181
|
+
default: year = floor((epoch + 2092590) * 492480 / 179876755) + 1;
|
|
194
182
|
}
|
|
195
183
|
while (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;
|
|
196
184
|
while (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;
|
|
@@ -267,10 +255,13 @@ function ArithmeticCalendarEra(calendar, epoch, year) {
|
|
|
267
255
|
era: year > 0 ? "ah" : "bh",
|
|
268
256
|
eraYear: year > 0 ? year : 1 - year
|
|
269
257
|
};
|
|
270
|
-
case "japanese": for (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
258
|
+
case "japanese": for (let index = 0; index < JapaneseEras.length; index++) {
|
|
259
|
+
const entry = JapaneseEras[index];
|
|
260
|
+
if (epoch >= entry[0]) return {
|
|
261
|
+
era: entry[1],
|
|
262
|
+
eraYear: year - entry[2]
|
|
263
|
+
};
|
|
264
|
+
}
|
|
274
265
|
}
|
|
275
266
|
return {
|
|
276
267
|
era: year > 0 ? "ce" : "bce",
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["sources/packages/ecma262-abstract/DateOperations.js","sources/packages/ecma402-abstract/Calendar/Arithmetic.js","sources/packages/intl-datetimeformat/calendars/arithmetic.js","sources/packages/intl-datetimeformat/calendars/implementations/japanese.js","sources/packages/intl-datetimeformat/register-calendar-data.ts","sources/packages/intl-datetimeformat/calendar-data/japanese.ts"],"sourcesContent":["const MS_PER_DAY = 864e5;\nfunction mod(x, y) {\n\treturn x - Math.floor(x / y) * y;\n}\nexport function Day(t) {\n\treturn Math.floor(t / MS_PER_DAY);\n}\nexport function WeekDay(t) {\n\treturn mod(Day(t) + 4, 7);\n}\nexport function DayFromYear(y) {\n\t// ECMA-262 §21.4.1.5 DayFromYear, steps 2–6: count days arithmetically.\n\t// The first day of the minimum representable year lies outside Date's range.\n\t// https://tc39.es/ecma262/#sec-dayfromyear\n\t// https://github.com/tc39/ecma262/blob/b7865f0eed2021720f84d561289401bc414874d0/spec.html#L34143-L34147\n\treturn 365 * (y - 1970) + Math.floor((y - 1969) / 4) - Math.floor((y - 1901) / 100) + Math.floor((y - 1601) / 400);\n}\nexport function YearFromTime(t) {\n\t// ECMA-262 §21.4.1.7 YearFromTime, step 1: locate the enclosing year.\n\t// Local timezone adjustment may move an otherwise valid instant past Date's bounds.\n\t// https://tc39.es/ecma262/#sec-yearfromtime\n\t// https://github.com/tc39/ecma262/blob/b7865f0eed2021720f84d561289401bc414874d0/spec.html#L34177\n\tif (!Number.isFinite(t)) return NaN;\n\tconst day = Day(t);\n\tlet year = 1970 + Math.floor(day / 365.2425);\n\twhile (DayFromYear(year) > day) year--;\n\twhile (DayFromYear(year + 1) <= day) year++;\n\treturn year;\n}\nexport function DaysInYear(y) {\n\tif (y % 4 !== 0) return 365;\n\tif (y % 100 !== 0) return 366;\n\tif (y % 400 !== 0) return 365;\n\treturn 366;\n}\nexport function DayWithinYear(t) {\n\treturn Day(t) - DayFromYear(YearFromTime(t));\n}\nexport function InLeapYear(t) {\n\treturn DaysInYear(YearFromTime(t)) === 365 ? 0 : 1;\n}\nexport function MonthFromTime(t) {\n\tconst dwy = DayWithinYear(t);\n\tconst leap = InLeapYear(t);\n\tif (dwy >= 0 && dwy < 31) return 0;\n\tif (dwy < 59 + leap) return 1;\n\tif (dwy < 90 + leap) return 2;\n\tif (dwy < 120 + leap) return 3;\n\tif (dwy < 151 + leap) return 4;\n\tif (dwy < 181 + leap) return 5;\n\tif (dwy < 212 + leap) return 6;\n\tif (dwy < 243 + leap) return 7;\n\tif (dwy < 273 + leap) return 8;\n\tif (dwy < 304 + leap) return 9;\n\tif (dwy < 334 + leap) return 10;\n\tif (dwy < 365 + leap) return 11;\n\tthrow new Error(\"Invalid time\");\n}\nexport function DateFromTime(t) {\n\tconst dwy = DayWithinYear(t);\n\tconst mft = MonthFromTime(t);\n\tconst leap = InLeapYear(t);\n\tif (mft === 0) return dwy + 1;\n\tif (mft === 1) return dwy - 30;\n\tif (mft === 2) return dwy - 58 - leap;\n\tif (mft === 3) return dwy - 89 - leap;\n\tif (mft === 4) return dwy - 119 - leap;\n\tif (mft === 5) return dwy - 150 - leap;\n\tif (mft === 6) return dwy - 180 - leap;\n\tif (mft === 7) return dwy - 211 - leap;\n\tif (mft === 8) return dwy - 242 - leap;\n\tif (mft === 9) return dwy - 272 - leap;\n\tif (mft === 10) return dwy - 303 - leap;\n\tif (mft === 11) return dwy - 333 - leap;\n\tthrow new Error(\"Invalid time\");\n}\nconst HOURS_PER_DAY = 24;\nconst MINUTES_PER_HOUR = 60;\nconst SECONDS_PER_MINUTE = 60;\nconst MS_PER_SECOND = 1e3;\nconst MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;\nconst MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;\nexport function HourFromTime(t) {\n\treturn mod(Math.floor(t / MS_PER_HOUR), HOURS_PER_DAY);\n}\nexport function MinFromTime(t) {\n\treturn mod(Math.floor(t / MS_PER_MINUTE), MINUTES_PER_HOUR);\n}\nexport function SecFromTime(t) {\n\treturn mod(Math.floor(t / MS_PER_SECOND), SECONDS_PER_MINUTE);\n}\nexport function msFromTime(t) {\n\treturn mod(t, MS_PER_SECOND);\n}\n","import { DateFromTime, DayFromYear, DaysInYear, MonthFromTime, YearFromTime } from \"#packages/ecma262-abstract/DateOperations.js\";\n// Shared numeric calendar helpers; not named ECMA-402 abstract operations.\nexport const arithmeticCalendars = [\n\t\"iso8601\",\n\t\"gregory\",\n\t\"buddhist\",\n\t\"japanese\",\n\t\"roc\",\n\t\"coptic\",\n\t\"ethiopic\",\n\t\"ethioaa\",\n\t\"hebrew\",\n\t\"indian\",\n\t\"islamic-civil\",\n\t\"islamic-tbla\",\n\t\"persian\"\n];\nconst monthStarts = [\n\t0,\n\t31,\n\t59,\n\t90,\n\t120,\n\t151,\n\t181,\n\t212,\n\t243,\n\t273,\n\t304,\n\t334\n];\nconst mod = (value, divisor) => value - Math.floor(value / divisor) * divisor;\nfunction integer(value) {\n\tif (!Number.isSafeInteger(value)) throw new RangeError(\"Expected safe integer\");\n\treturn value;\n}\nexport function HebrewLeapYear(year) {\n\treturn mod(7 * year + 1, 19) < 7;\n}\nexport function HebrewElapsedMonths(year) {\n\treturn Math.floor((235 * year - 234) / 19);\n}\n// Same postponement arithmetic as crates/intl_datetimeformat_calendars/core.rs.\nfunction hebrewDelay(year) {\n\tconst months = HebrewElapsedMonths(year);\n\tconst day = 29 * months + Math.floor((12084 + 13753 * months) / 25920);\n\treturn day + Number(mod(3 * (day + 1), 7) < 3);\n}\nfunction IsISOCalendar(calendar) {\n\treturn [\n\t\t\"iso8601\",\n\t\t\"gregory\",\n\t\t\"buddhist\",\n\t\t\"japanese\",\n\t\t\"roc\"\n\t].includes(calendar);\n}\nfunction CalendarISOYear(calendar, year) {\n\treturn year + (calendar === \"buddhist\" ? -543 : calendar === \"roc\" ? 1911 : 0);\n}\nexport function ArithmeticCalendarStartOfYear(calendar, year) {\n\tif (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));\n\tswitch (calendar) {\n\t\tcase \"coptic\": return 1824665 - 2440588 + 365 * year + Math.floor(year / 4);\n\t\tcase \"ethiopic\": return 1723856 - 2440588 + 365 * year + Math.floor(year / 4);\n\t\tcase \"ethioaa\": {\n\t\t\tconst value = year - 5500;\n\t\t\treturn 1723856 - 2440588 + 365 * value + Math.floor(value / 4);\n\t\t}\n\t\tcase \"indian\": {\n\t\t\tconst value = year + 78;\n\t\t\treturn DayFromYear(value) + 80;\n\t\t}\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\": return 1948440 - 2440588 - Number(calendar === \"islamic-tbla\") + 354 * (year - 1) + Math.floor((3 + 11 * year) / 30);\n\t\tcase \"persian\": return 1948320 - 2440588 + 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n\t}\n\tconst present = hebrewDelay(year);\n\treturn -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);\n}\nexport function ArithmeticCalendarMonthsInYear(calendar, year) {\n\treturn [\n\t\t\"coptic\",\n\t\t\"ethiopic\",\n\t\t\"ethioaa\"\n\t].includes(calendar) || calendar === \"hebrew\" && HebrewLeapYear(year) ? 13 : 12;\n}\nexport function ArithmeticCalendarDaysInMonth(calendar, year, month) {\n\tconst count = ArithmeticCalendarMonthsInYear(calendar, year);\n\tif (integer(month) < 1 || month > count) throw new RangeError(\"Invalid calendar month\");\n\tif (IsISOCalendar(calendar)) {\n\t\treturn month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] + Number(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);\n\t}\n\tconst length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);\n\tif ([\n\t\t\"coptic\",\n\t\t\"ethiopic\",\n\t\t\"ethioaa\"\n\t].includes(calendar)) return month === 13 ? length - 360 : 30;\n\tif (calendar === \"indian\") return month === 1 ? 30 + Number(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;\n\tif (calendar === \"islamic-civil\" || calendar === \"islamic-tbla\") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;\n\tif (calendar === \"persian\") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;\n\tconst code = month + Number(!HebrewLeapYear(year) && month >= 6);\n\tif ([\n\t\t4,\n\t\t7,\n\t\t9,\n\t\t11,\n\t\t13\n\t].includes(code)) return 29;\n\tif (code === 2) return length % 10 === 5 ? 30 : 29;\n\tif (code === 3) return length % 10 === 3 ? 29 : 30;\n\treturn 30;\n}\nexport function ArithmeticCalendarMonthCode(calendar, year, month) {\n\tconst leap = calendar === \"hebrew\" && HebrewLeapYear(year);\n\tif (leap && month === 6) return \"M05L\";\n\tconst code = month - Number(leap && month > 6);\n\treturn \"M\" + (code < 10 ? \"0\" : \"\") + code;\n}\nexport function ArithmeticCalendarFromEpochDay(calendar, epoch) {\n\tconst t = epoch * 864e5, civilYear = YearFromTime(t);\n\tif (IsISOCalendar(calendar)) {\n\t\tconst year = civilYear - (calendar === \"buddhist\" ? -543 : calendar === \"roc\" ? 1911 : 0), month = MonthFromTime(t) + 1;\n\t\treturn {\n\t\t\tyear,\n\t\t\tmonth,\n\t\t\tmonthCode: ArithmeticCalendarMonthCode(calendar, year, month),\n\t\t\tday: DateFromTime(t)\n\t\t};\n\t}\n\tconst jd = epoch + 2440588;\n\tlet year;\n\tswitch (calendar) {\n\t\tcase \"coptic\":\n\t\t\tyear = Math.floor((4 * (jd - 1824665) + 3) / 1461);\n\t\t\tbreak;\n\t\tcase \"ethiopic\":\n\t\tcase \"ethioaa\":\n\t\t\tyear = Math.floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === \"ethioaa\" ? 5500 : 0);\n\t\t\tbreak;\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\":\n\t\t\tyear = Math.floor((30 * (jd - 1948440 + Number(calendar === \"islamic-tbla\")) + 10646) / 10631);\n\t\t\tbreak;\n\t\tcase \"persian\":\n\t\t\tyear = 1 + Math.floor((33 * (jd - 1948320) + 3) / 12053);\n\t\t\tbreak;\n\t\tcase \"indian\":\n\t\t\tyear = civilYear - 78;\n\t\t\tbreak;\n\t\tdefault: year = Math.floor((epoch + 2092590) * 492480 / 179876755) + 1;\n\t}\n\twhile (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;\n\twhile (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;\n\tlet month = 1, remaining = epoch - ArithmeticCalendarStartOfYear(calendar, year);\n\twhile (remaining >= ArithmeticCalendarDaysInMonth(calendar, year, month)) remaining -= ArithmeticCalendarDaysInMonth(calendar, year, month++);\n\treturn {\n\t\tyear,\n\t\tmonth,\n\t\tmonthCode: ArithmeticCalendarMonthCode(calendar, year, month),\n\t\tday: remaining + 1\n\t};\n}\nexport const JapaneseEras = [\n\t[\n\t\t18017,\n\t\t\"reiwa\",\n\t\t2018\n\t],\n\t[\n\t\t6947,\n\t\t\"heisei\",\n\t\t1988\n\t],\n\t[\n\t\t-15713,\n\t\t\"showa\",\n\t\t1925\n\t],\n\t[\n\t\t-20974,\n\t\t\"taisho\",\n\t\t1911\n\t],\n\t[\n\t\t-35428,\n\t\t\"meiji\",\n\t\t1867\n\t]\n];\nexport function ArithmeticCalendarEra(calendar, epoch, year) {\n\tswitch (calendar) {\n\t\tcase \"iso8601\": return undefined;\n\t\tcase \"buddhist\": return {\n\t\t\tera: \"be\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"coptic\":\n\t\tcase \"hebrew\": return {\n\t\t\tera: \"am\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"ethiopic\": return {\n\t\t\tera: year > 0 ? \"am\" : \"aa\",\n\t\t\teraYear: year > 0 ? year : year + 5500\n\t\t};\n\t\tcase \"ethioaa\": return {\n\t\t\tera: \"aa\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"indian\": return {\n\t\t\tera: \"shaka\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"persian\": return {\n\t\t\tera: \"ap\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"roc\": return {\n\t\t\tera: year > 0 ? \"roc\" : \"broc\",\n\t\t\teraYear: year > 0 ? year : 1 - year\n\t\t};\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\": return {\n\t\t\tera: year > 0 ? \"ah\" : \"bh\",\n\t\t\teraYear: year > 0 ? year : 1 - year\n\t\t};\n\t\tcase \"japanese\": for (const [start, era, offset] of JapaneseEras) if (epoch >= start) return {\n\t\t\tera,\n\t\t\teraYear: year - offset\n\t\t};\n\t}\n\treturn {\n\t\tera: year > 0 ? \"ce\" : \"bce\",\n\t\teraYear: year > 0 ? year : 1 - year\n\t};\n}\n","import { ArithmeticCalendarFromEpochDay, ArithmeticCalendarMonthsInYear, ArithmeticCalendarEra } from \"#packages/ecma402-abstract/Calendar/Arithmetic.js\";\n// Temporal era identifiers mapped to CLDR calendar era keys.\nconst eras = {\n\tbe: \"0\",\n\tam: \"1\",\n\taa: \"0\",\n\troc: \"1\",\n\tbroc: \"0\",\n\tce: \"AD\",\n\tbce: \"BC\",\n\tmeiji: \"232\",\n\ttaisho: \"233\",\n\tshowa: \"234\",\n\theisei: \"235\",\n\treiwa: \"236\",\n\tshaka: \"0\",\n\tah: \"0\",\n\tbh: \"1\",\n\tap: \"0\"\n};\n/**\n* Adapt shared calendar fields to CLDR era keys and month-name indices.\n* This is an implementation helper for ECMA-402 ToLocalTime, not a spec AO.\n* https://tc39.es/ecma402/#sec-tolocaltime\n* https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements\n*/\nexport function arithmeticCalendar(calendar, hebrew = false) {\n\treturn {\n\t\tcalendar,\n\t\tdateFromTime(t) {\n\t\t\tconst epochDay = Math.floor(t / 864e5);\n\t\t\t// Keep one day of padding around Date's range for timezone offsets.\n\t\t\tif (!Number.isFinite(t) || epochDay < -100000001 || epochDay > 1e8) {\n\t\t\t\tthrow new RangeError(\"Calendar date out of range\");\n\t\t\t}\n\t\t\tconst date = ArithmeticCalendarFromEpochDay(calendar, epochDay);\n\t\t\tif (hebrew) {\n\t\t\t\t// CLDR reserves month 6 for Adar I and a separate name for leap-year Adar II.\n\t\t\t\tconst monthCode = Number(date.monthCode.slice(1, 3));\n\t\t\t\tconst monthNameIndex = date.monthCode === \"M05L\" ? 5 : monthCode === 6 && ArithmeticCalendarMonthsInYear(calendar, date.year) === 13 ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;\n\t\t\t\treturn {\n\t\t\t\t\tera: \"0\",\n\t\t\t\t\tyear: date.year,\n\t\t\t\t\tmonth: date.month - 1,\n\t\t\t\t\tmonthNameIndex,\n\t\t\t\t\tday: date.day\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst era = ArithmeticCalendarEra(calendar, epochDay, date.year);\n\t\t\treturn {\n\t\t\t\tera: eras[era.era],\n\t\t\t\tyear: era?.eraYear ?? date.year,\n\t\t\t\tmonth: date.month - 1,\n\t\t\t\tday: date.day\n\t\t\t};\n\t\t}\n\t};\n}\n","import { arithmeticCalendar } from \"#packages/intl-datetimeformat/calendars/arithmetic.js\";\nconst data = arithmeticCalendar(\"japanese\");\nexport default data;\n","import type {CalendarData} from '#packages/ecma402-abstract/DateTimeFormat/CalendarDateFromTime.js'\n\n/** Register after installation, or queue until the polyfill is installed. */\nexport function registerCalendarData(...data: CalendarData[]): void {\n const dtf = globalThis.Intl?.DateTimeFormat as typeof Intl.DateTimeFormat & {\n __addCalendarData?: (...data: CalendarData[]) => void\n }\n if (typeof dtf?.__addCalendarData === 'function') {\n dtf.__addCalendarData(...data)\n } else {\n const globals = globalThis as typeof globalThis & {\n __FORMATJS_DATETIMEFORMAT_CALENDAR_DATA__?: CalendarData[]\n }\n ;(globals.__FORMATJS_DATETIMEFORMAT_CALENDAR_DATA__ ??= []).push(...data)\n }\n}\n","import data from '#packages/intl-datetimeformat/calendars/implementations/japanese.js'\nimport {registerCalendarData} from '#packages/intl-datetimeformat/register-calendar-data.js'\n\nregisterCalendarData(data)\nexport default data\n"],"mappings":";AAAA,MAAM,aAAa;AAInB,SAAgB,IAAI,GAAG;CACtB,OAAO,KAAK,MAAM,IAAI,UAAU;AACjC;AAIA,SAAgB,YAAY,GAAG;CAK9B,OAAO,OAAO,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,IAAI,QAAQ,GAAG,IAAI,KAAK,OAAO,IAAI,QAAQ,GAAG;AAClH;AACA,SAAgB,aAAa,GAAG;CAK/B,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,MAAM,IAAI,CAAC;CACjB,IAAI,OAAO,OAAO,KAAK,MAAM,MAAM,QAAQ;CAC3C,OAAO,YAAY,IAAI,IAAI,KAAK;CAChC,OAAO,YAAY,OAAO,CAAC,KAAK,KAAK;CACrC,OAAO;AACR;AACA,SAAgB,WAAW,GAAG;CAC7B,IAAI,IAAI,MAAM,GAAG,OAAO;CACxB,IAAI,IAAI,QAAQ,GAAG,OAAO;CAC1B,IAAI,IAAI,QAAQ,GAAG,OAAO;CAC1B,OAAO;AACR;AACA,SAAgB,cAAc,GAAG;CAChC,OAAO,IAAI,CAAC,IAAI,YAAY,aAAa,CAAC,CAAC;AAC5C;AACA,SAAgB,WAAW,GAAG;C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;ACE1C,SAAgB,qBAAqB,GAAG,MAA4B;CAClE,MAAM,MAAM,WAAW,MAAM;CAG7B,IAAI,OAAO,KAAK,sBAAsB,YACpC,IAAI,kBAAkB,GAAG,IAAI;MACxB;EACL,MAAM,UAAU;EAGf,CAAC,QAAQ,8CAA8C,CAAC,EAAA,CAAG,KAAK,GAAG,IAAI;CAC1E;AACF;;ACZA,qBAAqB,IAAI;AACzB,IAAA,mBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["sources/packages/ecma262-abstract/intrinsics.js","sources/packages/ecma262-abstract/DateOperations.js","sources/packages/ecma402-abstract/Calendar/Arithmetic.js","sources/packages/intl-datetimeformat/calendars/arithmetic.js","sources/packages/intl-datetimeformat/calendars/implementations/japanese.js","sources/packages/intl-datetimeformat/register-calendar-data.ts","sources/packages/intl-datetimeformat/calendar-data/japanese.ts"],"sourcesContent":["// Specification arithmetic must not consult a replacement installed by user code.\nexport const floor = Math.floor;\n// Number/BigInt calls retain constructor conversion semantics.\nexport const numberFrom = Number;\nexport const bigIntFrom = BigInt;\nexport const objectFrom = Object;\nexport const mathAbs = Math.abs;\nexport const mathMin = Math.min;\nexport const mathMax = Math.max;\nexport const mathTrunc = Math.trunc;\nexport const mathSign = Math.sign;\nexport const numberIsInteger = Number.isInteger;\nexport const numberIsFinite = Number.isFinite;\nexport const numberIsSafeInteger = Number.isSafeInteger;\n// Specification exceptions use the original constructors of this realm.\nexport const ErrorConstructor = Error;\nexport const TypeErrorConstructor = TypeError;\nexport const RangeErrorConstructor = RangeError;\nconst arrayApply = Reflect.apply;\nconst every = Array.prototype.every;\nconst some = Array.prototype.some;\n// Specification Lists do not consult mutable Array.prototype methods.\nexport function arrayEvery(values, predicate) {\n\treturn arrayApply(every, values, [predicate]);\n}\nexport function arraySome(values, predicate) {\n\treturn arrayApply(some, values, [predicate]);\n}\nconst includes = Array.prototype.includes;\nconst indexOf = Array.prototype.indexOf;\nexport function arrayIncludes(values, search) {\n\treturn arrayApply(includes, values, [search]);\n}\nexport function arrayIndexOf(values, search) {\n\treturn arrayApply(indexOf, values, [search]);\n}\nconst defineProperty = Object.defineProperty;\n// Private Record fields must not invoke inherited setters or descriptor getters.\nexport function setDataProperty(target, key, value) {\n\tconst descriptor = {\n\t\t__proto__: null,\n\t\tvalue,\n\t\twritable: true,\n\t\tenumerable: true,\n\t\tconfigurable: true\n\t};\n\tdefineProperty(target, key, descriptor);\n}\n","import { ErrorConstructor, floor, numberIsFinite } from \"#packages/ecma262-abstract/intrinsics.js\";\nconst MS_PER_DAY = 864e5;\nfunction mod(x, y) {\n\treturn x - floor(x / y) * y;\n}\n// ECMA-262 §21.4.1.3 step 1: mathematical floor, including pre-epoch days.\nexport function Day(t) {\n\treturn floor(t / MS_PER_DAY);\n}\n// ECMA-262 §21.4.1.12 step 1: nonnegative weekday remainder.\nexport function WeekDay(t) {\n\treturn mod(Day(t) + 4, 7);\n}\nexport function DayFromYear(y) {\n\t// ECMA-262 §21.4.1.5 DayFromYear, steps 2–6: count days arithmetically.\n\t// The first day of the minimum representable year lies outside Date's range.\n\t// https://tc39.es/ecma262/#sec-dayfromyear\n\treturn 365 * (y - 1970) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400);\n}\nexport function YearFromTime(t) {\n\t// ECMA-262 §21.4.1.7 YearFromTime, step 1: locate the enclosing year.\n\t// Local timezone adjustment may move an otherwise valid instant past Date's bounds.\n\t// https://tc39.es/ecma262/#sec-yearfromtime\n\tif (!numberIsFinite(t)) return NaN;\n\tconst day = Day(t);\n\tlet year = 1970 + floor(day / 365.2425);\n\twhile (DayFromYear(year) > day) year--;\n\twhile (DayFromYear(year + 1) <= day) year++;\n\treturn year;\n}\n// ECMA-262 §21.4.1.9 steps 1–4: equivalent divisibility order; adapt Boolean to day count.\nexport function DaysInYear(y) {\n\tif (y % 4 !== 0) return 365;\n\tif (y % 100 !== 0) return 366;\n\tif (y % 400 !== 0) return 365;\n\treturn 366;\n}\n// ECMA-262 §21.4.1.8 step 1: subtract the enclosing year origin.\nexport function DayWithinYear(t) {\n\treturn Day(t) - DayFromYear(YearFromTime(t));\n}\n// ECMA-262 §21.4.1.9 applied to §21.4.1.7: private numeric leap-year offset.\nexport function InLeapYear(t) {\n\treturn DaysInYear(YearFromTime(t)) === 365 ? 0 : 1;\n}\n// ECMA-262 §21.4.1.10 steps 1–16: ordered month thresholds with leap-day adjustment.\nexport function MonthFromTime(t) {\n\tconst dwy = DayWithinYear(t);\n\tconst leap = InLeapYear(t);\n\tif (dwy >= 0 && dwy < 31) return 0;\n\tif (dwy < 59 + leap) return 1;\n\tif (dwy < 90 + leap) return 2;\n\tif (dwy < 120 + leap) return 3;\n\tif (dwy < 151 + leap) return 4;\n\tif (dwy < 181 + leap) return 5;\n\tif (dwy < 212 + leap) return 6;\n\tif (dwy < 243 + leap) return 7;\n\tif (dwy < 273 + leap) return 8;\n\tif (dwy < 304 + leap) return 9;\n\tif (dwy < 334 + leap) return 10;\n\tif (dwy < 365 + leap) return 11;\n\tthrow new ErrorConstructor(\"Invalid time\");\n}\n// ECMA-262 §21.4.1.11 steps 1–17: month-specific subtraction yields one-based date.\nexport function DateFromTime(t) {\n\tconst dwy = DayWithinYear(t);\n\tconst mft = MonthFromTime(t);\n\tconst leap = InLeapYear(t);\n\tif (mft === 0) return dwy + 1;\n\tif (mft === 1) return dwy - 30;\n\tif (mft === 2) return dwy - 58 - leap;\n\tif (mft === 3) return dwy - 89 - leap;\n\tif (mft === 4) return dwy - 119 - leap;\n\tif (mft === 5) return dwy - 150 - leap;\n\tif (mft === 6) return dwy - 180 - leap;\n\tif (mft === 7) return dwy - 211 - leap;\n\tif (mft === 8) return dwy - 242 - leap;\n\tif (mft === 9) return dwy - 272 - leap;\n\tif (mft === 10) return dwy - 303 - leap;\n\tif (mft === 11) return dwy - 333 - leap;\n\tthrow new ErrorConstructor(\"Invalid time\");\n}\nconst HOURS_PER_DAY = 24;\nconst MINUTES_PER_HOUR = 60;\nconst SECONDS_PER_MINUTE = 60;\nconst MS_PER_SECOND = 1e3;\nconst MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;\nconst MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;\n// ECMA-262 §21.4.1.13 step 1: floor before nonnegative modulo.\nexport function HourFromTime(t) {\n\treturn mod(floor(t / MS_PER_HOUR), HOURS_PER_DAY);\n}\n// ECMA-262 §21.4.1.14 step 1: floor before nonnegative modulo.\nexport function MinFromTime(t) {\n\treturn mod(floor(t / MS_PER_MINUTE), MINUTES_PER_HOUR);\n}\n// ECMA-262 §21.4.1.15 step 1: floor before nonnegative modulo.\nexport function SecFromTime(t) {\n\treturn mod(floor(t / MS_PER_SECOND), SECONDS_PER_MINUTE);\n}\n// ECMA-262 §21.4.1.16 step 1: nonnegative millisecond remainder.\nexport function msFromTime(t) {\n\treturn mod(t, MS_PER_SECOND);\n}\n","import { ErrorConstructor, RangeErrorConstructor, arrayIncludes, floor, numberFrom, numberIsInteger, numberIsSafeInteger } from \"#packages/ecma262-abstract/intrinsics.js\";\nimport { DayFromYear, DaysInYear, YearFromTime } from \"#packages/ecma262-abstract/DateOperations.js\";\n// Shared numeric calendar helpers; not named ECMA-402 abstract operations.\nexport const arithmeticCalendars = [\n\t\"iso8601\",\n\t\"gregory\",\n\t\"buddhist\",\n\t\"japanese\",\n\t\"roc\",\n\t\"coptic\",\n\t\"ethiopic\",\n\t\"ethioaa\",\n\t\"hebrew\",\n\t\"indian\",\n\t\"islamic-civil\",\n\t\"islamic-tbla\",\n\t\"persian\"\n];\nconst monthStarts = [\n\t0,\n\t31,\n\t59,\n\t90,\n\t120,\n\t151,\n\t181,\n\t212,\n\t243,\n\t273,\n\t304,\n\t334\n];\nconst mod = (value, divisor) => value - floor(value / divisor) * divisor;\nfunction integer(value) {\n\tif (!numberIsSafeInteger(value)) throw new RangeErrorConstructor(\"Expected safe integer\");\n\treturn value;\n}\nexport function HebrewLeapYear(year) {\n\treturn mod(7 * year + 1, 19) < 7;\n}\nexport function HebrewElapsedMonths(year) {\n\treturn floor((235 * year - 234) / 19);\n}\n// Same postponement arithmetic as crates/intl_datetimeformat_calendars/core.rs.\nfunction hebrewDelay(year) {\n\tconst months = HebrewElapsedMonths(year);\n\tconst day = 29 * months + floor((12084 + 13753 * months) / 25920);\n\treturn day + numberFrom(mod(3 * (day + 1), 7) < 3);\n}\nfunction IsISOCalendar(calendar) {\n\treturn arrayIncludes([\n\t\t\"iso8601\",\n\t\t\"gregory\",\n\t\t\"buddhist\",\n\t\t\"japanese\",\n\t\t\"roc\"\n\t], calendar);\n}\nfunction CalendarISOYear(calendar, year) {\n\treturn year + (calendar === \"buddhist\" ? -543 : calendar === \"roc\" ? 1911 : 0);\n}\nexport function ArithmeticCalendarStartOfYear(calendar, year) {\n\tif (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));\n\tswitch (calendar) {\n\t\tcase \"coptic\": return 1824665 - 2440588 + 365 * year + floor(year / 4);\n\t\tcase \"ethiopic\": return 1723856 - 2440588 + 365 * year + floor(year / 4);\n\t\tcase \"ethioaa\": {\n\t\t\tconst value = year - 5500;\n\t\t\treturn 1723856 - 2440588 + 365 * value + floor(value / 4);\n\t\t}\n\t\tcase \"indian\": {\n\t\t\tconst value = year + 78;\n\t\t\treturn DayFromYear(value) + 80;\n\t\t}\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\": return 1948440 - 2440588 - numberFrom(calendar === \"islamic-tbla\") + 354 * (year - 1) + floor((3 + 11 * year) / 30);\n\t\tcase \"persian\": return 1948320 - 2440588 + 365 * (year - 1) + floor((8 * year + 21) / 33);\n\t}\n\tconst present = hebrewDelay(year);\n\treturn -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);\n}\n// Month and day must already be validated.\nexport function ArithmeticCalendarToEpochDay(calendar, year, month, day) {\n\tif (IsISOCalendar(calendar)) {\n\t\tconst isoYear = CalendarISOYear(calendar, year);\n\t\treturn DayFromYear(isoYear) + monthStarts[month - 1] + numberFrom(month > 2 && DaysInYear(isoYear) === 366) + day - 1;\n\t}\n\tlet epoch = ArithmeticCalendarStartOfYear(calendar, year) + day - 1;\n\tfor (let m = 1; m < month; m++) epoch += ArithmeticCalendarDaysInMonth(calendar, year, m);\n\treturn epoch;\n}\nexport function ArithmeticCalendarMonthsInYear(calendar, year) {\n\treturn arrayIncludes([\n\t\t\"coptic\",\n\t\t\"ethiopic\",\n\t\t\"ethioaa\"\n\t], calendar) || calendar === \"hebrew\" && HebrewLeapYear(year) ? 13 : 12;\n}\nexport function ArithmeticCalendarDaysInMonth(calendar, year, month) {\n\tconst count = ArithmeticCalendarMonthsInYear(calendar, year);\n\tif (integer(month) < 1 || month > count) throw new RangeErrorConstructor(\"Invalid calendar month\");\n\tif (IsISOCalendar(calendar)) {\n\t\treturn month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] + numberFrom(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);\n\t}\n\tconst length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);\n\tif (arrayIncludes([\n\t\t\"coptic\",\n\t\t\"ethiopic\",\n\t\t\"ethioaa\"\n\t], calendar)) return month === 13 ? length - 360 : 30;\n\tif (calendar === \"indian\") return month === 1 ? 30 + numberFrom(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;\n\tif (calendar === \"islamic-civil\" || calendar === \"islamic-tbla\") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;\n\tif (calendar === \"persian\") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;\n\tconst code = month + numberFrom(!HebrewLeapYear(year) && month >= 6);\n\tif (arrayIncludes([\n\t\t4,\n\t\t7,\n\t\t9,\n\t\t11,\n\t\t13\n\t], code)) return 29;\n\tif (code === 2) return length % 10 === 5 ? 30 : 29;\n\tif (code === 3) return length % 10 === 3 ? 29 : 30;\n\treturn 30;\n}\nexport function ArithmeticCalendarMonthCode(calendar, year, month) {\n\tconst leap = calendar === \"hebrew\" && HebrewLeapYear(year);\n\tif (leap && month === 6) return \"M05L\";\n\tconst code = month - numberFrom(leap && month > 6);\n\treturn \"M\" + (code < 10 ? \"0\" : \"\") + code;\n}\n// Validated integer epoch days within ±110000000.\nexport function ArithmeticGregorianFromEpochDay(calendar, epoch) {\n\t// Same March-based 400-year conversion as the Rust calendar core.\n\tconst shifted = epoch + 719468, era = floor(shifted / 146097), dayOfEra = shifted - era * 146097 >>> 0, yearOfEra = (dayOfEra - (dayOfEra / 1460 | 0) + (dayOfEra / 36524 | 0) - (dayOfEra / 146096 | 0)) / 365 | 0, ordinal = dayOfEra - (365 * yearOfEra + (yearOfEra / 4 | 0) - (yearOfEra / 100 | 0)), marchMonth = (5 * ordinal + 2) / 153 | 0, month = marchMonth < 10 ? marchMonth + 3 : marchMonth - 9, year = yearOfEra + era * 400 + numberFrom(month <= 2) - (calendar === \"buddhist\" ? -543 : calendar === \"roc\" ? 1911 : 0);\n\treturn {\n\t\tyear,\n\t\tmonth,\n\t\tmonthCode: ArithmeticCalendarMonthCode(calendar, year, month),\n\t\tday: ordinal - ((153 * marchMonth + 2) / 5 | 0) + 1\n\t};\n}\nexport function ArithmeticCalendarFromEpochDay(calendar, epoch) {\n\tconst iso = IsISOCalendar(calendar);\n\tif (iso && numberIsInteger(epoch) && epoch >= -11e7 && epoch <= 11e7) return ArithmeticGregorianFromEpochDay(calendar, epoch);\n\tconst t = epoch * 864e5, civilYear = YearFromTime(t);\n\tif (iso) {\n\t\tconst ordinal = floor(t / 864e5) - DayFromYear(civilYear), leap = DaysInYear(civilYear) === 366 ? 1 : 0;\n\t\tif (!(ordinal >= 0 && ordinal < 365 + leap)) throw new ErrorConstructor(\"Invalid time\");\n\t\tconst year = civilYear - (calendar === \"buddhist\" ? -543 : calendar === \"roc\" ? 1911 : 0), month = ordinal < 31 ? 1 : ordinal < 59 + leap ? 2 : 3 + floor((5 * (ordinal - 59 - leap) + 2) / 153);\n\t\treturn {\n\t\t\tyear,\n\t\t\tmonth,\n\t\t\tmonthCode: ArithmeticCalendarMonthCode(calendar, year, month),\n\t\t\tday: ordinal - monthStarts[month - 1] - (month > 2 ? leap : 0) + 1\n\t\t};\n\t}\n\tconst jd = epoch + 2440588;\n\tlet year;\n\tswitch (calendar) {\n\t\tcase \"coptic\":\n\t\t\tyear = floor((4 * (jd - 1824665) + 3) / 1461);\n\t\t\tbreak;\n\t\tcase \"ethiopic\":\n\t\tcase \"ethioaa\":\n\t\t\tyear = floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === \"ethioaa\" ? 5500 : 0);\n\t\t\tbreak;\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\":\n\t\t\tyear = floor((30 * (jd - 1948440 + numberFrom(calendar === \"islamic-tbla\")) + 10646) / 10631);\n\t\t\tbreak;\n\t\tcase \"persian\":\n\t\t\tyear = 1 + floor((33 * (jd - 1948320) + 3) / 12053);\n\t\t\tbreak;\n\t\tcase \"indian\":\n\t\t\tyear = civilYear - 78;\n\t\t\tbreak;\n\t\tdefault: year = floor((epoch + 2092590) * 492480 / 179876755) + 1;\n\t}\n\twhile (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;\n\twhile (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;\n\tlet month = 1, remaining = epoch - ArithmeticCalendarStartOfYear(calendar, year);\n\twhile (remaining >= ArithmeticCalendarDaysInMonth(calendar, year, month)) remaining -= ArithmeticCalendarDaysInMonth(calendar, year, month++);\n\treturn {\n\t\tyear,\n\t\tmonth,\n\t\tmonthCode: ArithmeticCalendarMonthCode(calendar, year, month),\n\t\tday: remaining + 1\n\t};\n}\nexport const JapaneseEras = [\n\t[\n\t\t18017,\n\t\t\"reiwa\",\n\t\t2018\n\t],\n\t[\n\t\t6947,\n\t\t\"heisei\",\n\t\t1988\n\t],\n\t[\n\t\t-15713,\n\t\t\"showa\",\n\t\t1925\n\t],\n\t[\n\t\t-20974,\n\t\t\"taisho\",\n\t\t1911\n\t],\n\t[\n\t\t-35428,\n\t\t\"meiji\",\n\t\t1867\n\t]\n];\nexport function ArithmeticCalendarEra(calendar, epoch, year) {\n\tswitch (calendar) {\n\t\tcase \"iso8601\": return undefined;\n\t\tcase \"buddhist\": return {\n\t\t\tera: \"be\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"coptic\":\n\t\tcase \"hebrew\": return {\n\t\t\tera: \"am\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"ethiopic\": return {\n\t\t\tera: year > 0 ? \"am\" : \"aa\",\n\t\t\teraYear: year > 0 ? year : year + 5500\n\t\t};\n\t\tcase \"ethioaa\": return {\n\t\t\tera: \"aa\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"indian\": return {\n\t\t\tera: \"shaka\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"persian\": return {\n\t\t\tera: \"ap\",\n\t\t\teraYear: year\n\t\t};\n\t\tcase \"roc\": return {\n\t\t\tera: year > 0 ? \"roc\" : \"broc\",\n\t\t\teraYear: year > 0 ? year : 1 - year\n\t\t};\n\t\tcase \"islamic-civil\":\n\t\tcase \"islamic-tbla\": return {\n\t\t\tera: year > 0 ? \"ah\" : \"bh\",\n\t\t\teraYear: year > 0 ? year : 1 - year\n\t\t};\n\t\tcase \"japanese\":\n // Temporal comparison §12.3.25 / §12.3.1 Table18: project private era data.\n\t\t// https://tc39.es/proposal-temporal/#sec-temporal-nonisocalendarisotodate\n\t\tfor (let index = 0; index < JapaneseEras.length; index++) {\n\t\t\tconst entry = JapaneseEras[index];\n\t\t\tif (epoch >= entry[0]) return {\n\t\t\t\tera: entry[1],\n\t\t\t\teraYear: year - entry[2]\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tera: year > 0 ? \"ce\" : \"bce\",\n\t\teraYear: year > 0 ? year : 1 - year\n\t};\n}\n","import { ArithmeticCalendarFromEpochDay, ArithmeticCalendarMonthsInYear, ArithmeticCalendarEra } from \"#packages/ecma402-abstract/Calendar/Arithmetic.js\";\n// Temporal era identifiers mapped to CLDR calendar era keys.\nconst eras = {\n\tbe: \"0\",\n\tam: \"1\",\n\taa: \"0\",\n\troc: \"1\",\n\tbroc: \"0\",\n\tce: \"AD\",\n\tbce: \"BC\",\n\tmeiji: \"232\",\n\ttaisho: \"233\",\n\tshowa: \"234\",\n\theisei: \"235\",\n\treiwa: \"236\",\n\tshaka: \"0\",\n\tah: \"0\",\n\tbh: \"1\",\n\tap: \"0\"\n};\n/**\n* Adapt shared calendar fields to CLDR era keys and month-name indices.\n* This is an implementation helper for ECMA-402 ToLocalTime, not a spec AO.\n* https://tc39.es/ecma402/#sec-tolocaltime\n* https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements\n*/\nexport function arithmeticCalendar(calendar, hebrew = false) {\n\treturn {\n\t\tcalendar,\n\t\tdateFromTime(t) {\n\t\t\tconst epochDay = Math.floor(t / 864e5);\n\t\t\t// Keep one day of padding around Date's range for timezone offsets.\n\t\t\tif (!Number.isFinite(t) || epochDay < -100000001 || epochDay > 1e8) {\n\t\t\t\tthrow new RangeError(\"Calendar date out of range\");\n\t\t\t}\n\t\t\tconst date = ArithmeticCalendarFromEpochDay(calendar, epochDay);\n\t\t\tif (hebrew) {\n\t\t\t\t// CLDR reserves month 6 for Adar I and a separate name for leap-year Adar II.\n\t\t\t\tconst monthCode = Number(date.monthCode.slice(1, 3));\n\t\t\t\tconst monthNameIndex = date.monthCode === \"M05L\" ? 5 : monthCode === 6 && ArithmeticCalendarMonthsInYear(calendar, date.year) === 13 ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;\n\t\t\t\treturn {\n\t\t\t\t\tera: \"0\",\n\t\t\t\t\tyear: date.year,\n\t\t\t\t\tmonth: date.month - 1,\n\t\t\t\t\tmonthNameIndex,\n\t\t\t\t\tday: date.day\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst era = ArithmeticCalendarEra(calendar, epochDay, date.year);\n\t\t\treturn {\n\t\t\t\tera: eras[era.era],\n\t\t\t\tyear: era?.eraYear ?? date.year,\n\t\t\t\tmonth: date.month - 1,\n\t\t\t\tday: date.day\n\t\t\t};\n\t\t}\n\t};\n}\n","import { arithmeticCalendar } from \"#packages/intl-datetimeformat/calendars/arithmetic.js\";\nconst data = arithmeticCalendar(\"japanese\");\nexport default data;\n","import type {CalendarData} from '#packages/ecma402-abstract/DateTimeFormat/CalendarDateFromTime.js'\n\n/** Register after installation, or queue until the polyfill is installed. */\nexport function registerCalendarData(...data: CalendarData[]): void {\n const dtf = globalThis.Intl?.DateTimeFormat as typeof Intl.DateTimeFormat & {\n __addCalendarData?: (...data: CalendarData[]) => void\n }\n if (typeof dtf?.__addCalendarData === 'function') {\n dtf.__addCalendarData(...data)\n } else {\n const globals = globalThis as typeof globalThis & {\n __FORMATJS_DATETIMEFORMAT_CALENDAR_DATA__?: CalendarData[]\n }\n ;(globals.__FORMATJS_DATETIMEFORMAT_CALENDAR_DATA__ ??= []).push(...data)\n }\n}\n","import data from '#packages/intl-datetimeformat/calendars/implementations/japanese.js'\nimport {registerCalendarData} from '#packages/intl-datetimeformat/register-calendar-data.js'\n\nregisterCalendarData(data)\nexport default data\n"],"mappings":";AACA,MAAa,QAAQ,KAAK;AAE1B,MAAa,aAAa;AAQ1B,MAAa,kBAAkB,OAAO;AACtC,MAAa,iBAAiB,OAAO;AACrC,MAAa,sBAAsB,OAAO;AAE1C,MAAa,mBAAmB;AAEhC,MAAa,wBAAwB;AACrC,MAAM,aAAa,QAAQ;AACb,MAAM,UAAU;AACjB,MAAM,UAAU;AAQ7B,MAAM,WAAW,MAAM,UAAU;AACjB,MAAM,UAAU;AAChC,SAAgB,cAAc,QAAQ,QAAQ;CAC7C,OAAO,WAAW,UAAU,QAAQ,CAAC,MAAM,CAAC;AAC7C;;AC/BA,MAAM,aAAa;AAKnB,SAAgB,IAAI,GAAG;CACtB,OAAO,MAAM,IAAI,UAAU;AAC5B;AA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AAK,KAAK,IAAI;IACd,MAAM,KAAK,WAAW,KAAK;IAC3B,OAAO,KAAK,QAAQ;IACpB,KAAK,KAAK;GACX;EACD;CACD;AACD;;ACxDA,MAAM,OAAO,mBAAmB,UAAU;;;ACE1C,SAAgB,qBAAqB,GAAG,MAA4B;CAClE,MAAM,MAAM,WAAW,MAAM;CAG7B,IAAI,OAAO,KAAK,sBAAsB,YACpC,IAAI,kBAAkB,GAAG,IAAI;MACxB;EACL,MAAM,UAAU;EAGf,CAAC,QAAQ,8CAA8C,CAAC,EAAA,CAAG,KAAK,GAAG,IAAI;CAC1E;AACF;;ACZA,qBAAqB,IAAI;AACzB,IAAA,mBAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-datetimeformat-calendar-japanese",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "japanese calendar data for the Intl.DateTimeFormat polyfill",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"./locale-data/*": "./locale-data/*"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@formatjs/intl-datetimeformat": "8.2.
|
|
17
|
+
"@formatjs/intl-datetimeformat": "8.2.1"
|
|
18
18
|
}
|
|
19
19
|
}
|