@bereasoftware/time-guard 2.7.1 → 2.8.0
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/README.en.md +5 -1
- package/README.md +5 -1
- package/dist/angular/index.cjs +1 -148
- package/dist/angular/index.es.js +60 -112
- package/dist/calendars/index.cjs +1 -357
- package/dist/calendars/index.es.js +66 -99
- package/dist/chunk-C6qsp3rV.cjs +1 -0
- package/dist/core-Dxn1aRFk.js +1186 -0
- package/dist/core-TqmHKXY1.cjs +1 -0
- package/dist/core.d.ts +27 -1
- package/dist/index.d.ts +4 -2
- package/dist/locales/index.cjs +1 -7
- package/dist/locales/index.d.ts +11 -0
- package/dist/locales/index.es.js +3 -3
- package/dist/{locales-B1mDDyn_.cjs → locales-3Mw99lQ-.js} +201 -82
- package/dist/locales-bc-5kDuZ.cjs +1 -0
- package/dist/native/index.cjs +1 -48
- package/dist/native/index.es.js +8 -18
- package/dist/plugins/advanced-format.cjs +1 -105
- package/dist/plugins/advanced-format.es.js +43 -63
- package/dist/plugins/duration.cjs +1 -258
- package/dist/plugins/duration.es.js +59 -165
- package/dist/plugins/relative-time.cjs +1 -166
- package/dist/plugins/relative-time.es.js +36 -74
- package/dist/qwik/index.cjs +1 -104
- package/dist/qwik/index.es.js +33 -94
- package/dist/react/index.cjs +1 -112
- package/dist/react/index.es.js +57 -91
- package/dist/solid/index.cjs +1 -127
- package/dist/solid/index.es.js +34 -116
- package/dist/svelte/index.cjs +1 -398
- package/dist/svelte/index.es.js +85 -344
- package/dist/time-guard.cjs +3 -7359
- package/dist/time-guard.es.js +3412 -3625
- package/dist/time-guard.iife.js +3 -13549
- package/dist/time-guard.umd.js +3 -13550
- package/dist/vue/index.cjs +1 -143
- package/dist/vue/index.es.js +62 -116
- package/package.json +2 -3
- package/dist/chunk-BbtWAPZS.cjs +0 -36
- package/dist/core-BFdo248T.cjs +0 -1892
- package/dist/core-CyBR5PPd.js +0 -1809
- package/dist/locales-By7IK3Ep.js +0 -3514
package/dist/calendars/index.cjs
CHANGED
|
@@ -1,357 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
//#region src/calendars/index.ts
|
|
4
|
-
/**
|
|
5
|
-
* Islamic Calendar (Hijri)
|
|
6
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
7
|
-
*/
|
|
8
|
-
var IslamicCalendar = class {
|
|
9
|
-
id = "islamic";
|
|
10
|
-
name = "Islamic Calendar (Hijri)";
|
|
11
|
-
locale = "ar";
|
|
12
|
-
monthNames = [
|
|
13
|
-
"Muharram",
|
|
14
|
-
"Safar",
|
|
15
|
-
"Rabi al-awwal",
|
|
16
|
-
"Rabi al-thani",
|
|
17
|
-
"Jumada al-awwal",
|
|
18
|
-
"Jumada al-thani",
|
|
19
|
-
"Rajab",
|
|
20
|
-
"Sha'ban",
|
|
21
|
-
"Ramadan",
|
|
22
|
-
"Shawwal",
|
|
23
|
-
"Dhu al-Qi'dah",
|
|
24
|
-
"Dhu al-Hijjah"
|
|
25
|
-
];
|
|
26
|
-
getMonthName(month) {
|
|
27
|
-
return this.monthNames[Math.max(0, Math.min(11, month - 1))];
|
|
28
|
-
}
|
|
29
|
-
getWeekdayName(day, short = false) {
|
|
30
|
-
return (short ? [
|
|
31
|
-
"Ahd",
|
|
32
|
-
"Ith",
|
|
33
|
-
"Sel",
|
|
34
|
-
"Rab",
|
|
35
|
-
"Kha",
|
|
36
|
-
"Jum",
|
|
37
|
-
"Sab"
|
|
38
|
-
] : [
|
|
39
|
-
"Ahad",
|
|
40
|
-
"Ithnayn",
|
|
41
|
-
"Salasa",
|
|
42
|
-
"Rabi",
|
|
43
|
-
"Khamis",
|
|
44
|
-
"Jumah",
|
|
45
|
-
"Sabt"
|
|
46
|
-
])[Math.max(0, Math.min(6, day - 1))];
|
|
47
|
-
}
|
|
48
|
-
isLeapYear(year) {
|
|
49
|
-
return [
|
|
50
|
-
2,
|
|
51
|
-
5,
|
|
52
|
-
7,
|
|
53
|
-
10,
|
|
54
|
-
13,
|
|
55
|
-
16,
|
|
56
|
-
18,
|
|
57
|
-
21,
|
|
58
|
-
24,
|
|
59
|
-
26,
|
|
60
|
-
29
|
|
61
|
-
].includes(year % 30);
|
|
62
|
-
}
|
|
63
|
-
daysInMonth(year, month) {
|
|
64
|
-
if (month % 2 === 1) return 30;
|
|
65
|
-
if (month === 12 && this.isLeapYear(year)) return 30;
|
|
66
|
-
return 29;
|
|
67
|
-
}
|
|
68
|
-
daysInYear(year) {
|
|
69
|
-
return this.isLeapYear(year) ? 355 : 354;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Hebrew Calendar
|
|
74
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
75
|
-
*/
|
|
76
|
-
var HebrewCalendar = class {
|
|
77
|
-
id = "hebrew";
|
|
78
|
-
name = "Hebrew Calendar";
|
|
79
|
-
locale = "he";
|
|
80
|
-
monthNames = [
|
|
81
|
-
"Tishrei",
|
|
82
|
-
"Cheshvan",
|
|
83
|
-
"Kislev",
|
|
84
|
-
"Tevet",
|
|
85
|
-
"Shevat",
|
|
86
|
-
"Adar",
|
|
87
|
-
"Nisan",
|
|
88
|
-
"Iyar",
|
|
89
|
-
"Sivan",
|
|
90
|
-
"Tammuz",
|
|
91
|
-
"Av",
|
|
92
|
-
"Elul"
|
|
93
|
-
];
|
|
94
|
-
getMonthName(month) {
|
|
95
|
-
return this.monthNames[Math.max(0, Math.min(11, month - 1))];
|
|
96
|
-
}
|
|
97
|
-
getWeekdayName(day, short = false) {
|
|
98
|
-
return (short ? [
|
|
99
|
-
"Sun",
|
|
100
|
-
"Mon",
|
|
101
|
-
"Tue",
|
|
102
|
-
"Wed",
|
|
103
|
-
"Thu",
|
|
104
|
-
"Fri",
|
|
105
|
-
"Sat"
|
|
106
|
-
] : [
|
|
107
|
-
"Sunday",
|
|
108
|
-
"Monday",
|
|
109
|
-
"Tuesday",
|
|
110
|
-
"Wednesday",
|
|
111
|
-
"Thursday",
|
|
112
|
-
"Friday",
|
|
113
|
-
"Saturday"
|
|
114
|
-
])[Math.max(0, Math.min(6, day - 1))];
|
|
115
|
-
}
|
|
116
|
-
isLeapYear(year) {
|
|
117
|
-
return [
|
|
118
|
-
3,
|
|
119
|
-
6,
|
|
120
|
-
8,
|
|
121
|
-
11,
|
|
122
|
-
14,
|
|
123
|
-
17,
|
|
124
|
-
19
|
|
125
|
-
].includes(year % 19);
|
|
126
|
-
}
|
|
127
|
-
daysInMonth(_year, month) {
|
|
128
|
-
return [
|
|
129
|
-
30,
|
|
130
|
-
29,
|
|
131
|
-
30,
|
|
132
|
-
29,
|
|
133
|
-
30,
|
|
134
|
-
29,
|
|
135
|
-
30,
|
|
136
|
-
29,
|
|
137
|
-
30,
|
|
138
|
-
29,
|
|
139
|
-
30,
|
|
140
|
-
29
|
|
141
|
-
][Math.max(0, Math.min(11, month - 1))];
|
|
142
|
-
}
|
|
143
|
-
daysInYear(year) {
|
|
144
|
-
return this.isLeapYear(year) ? 384 : 354;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Chinese Calendar
|
|
149
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
150
|
-
*/
|
|
151
|
-
var ChineseCalendar = class {
|
|
152
|
-
id = "chinese";
|
|
153
|
-
name = "Chinese Calendar";
|
|
154
|
-
locale = "zh";
|
|
155
|
-
monthNames = [
|
|
156
|
-
"正月",
|
|
157
|
-
"二月",
|
|
158
|
-
"三月",
|
|
159
|
-
"四月",
|
|
160
|
-
"五月",
|
|
161
|
-
"六月",
|
|
162
|
-
"七月",
|
|
163
|
-
"八月",
|
|
164
|
-
"九月",
|
|
165
|
-
"十月",
|
|
166
|
-
"冬月",
|
|
167
|
-
"腊月"
|
|
168
|
-
];
|
|
169
|
-
terrestrialBranches = [
|
|
170
|
-
"子",
|
|
171
|
-
"丑",
|
|
172
|
-
"寅",
|
|
173
|
-
"卯",
|
|
174
|
-
"辰",
|
|
175
|
-
"巳",
|
|
176
|
-
"午",
|
|
177
|
-
"未",
|
|
178
|
-
"申",
|
|
179
|
-
"酉",
|
|
180
|
-
"戌",
|
|
181
|
-
"亥"
|
|
182
|
-
];
|
|
183
|
-
getMonthName(month) {
|
|
184
|
-
return this.monthNames[Math.max(0, Math.min(11, month - 1))];
|
|
185
|
-
}
|
|
186
|
-
getWeekdayName(day, short = false) {
|
|
187
|
-
return (short ? [
|
|
188
|
-
"日",
|
|
189
|
-
"一",
|
|
190
|
-
"二",
|
|
191
|
-
"三",
|
|
192
|
-
"四",
|
|
193
|
-
"五",
|
|
194
|
-
"六"
|
|
195
|
-
] : [
|
|
196
|
-
"星期日",
|
|
197
|
-
"星期一",
|
|
198
|
-
"星期二",
|
|
199
|
-
"星期三",
|
|
200
|
-
"星期四",
|
|
201
|
-
"星期五",
|
|
202
|
-
"星期六"
|
|
203
|
-
])[Math.max(0, Math.min(6, day - 1))];
|
|
204
|
-
}
|
|
205
|
-
isLeapYear(year) {
|
|
206
|
-
return year % 3 === 0;
|
|
207
|
-
}
|
|
208
|
-
daysInMonth(_year, month) {
|
|
209
|
-
return month % 2 === 0 ? 30 : 29;
|
|
210
|
-
}
|
|
211
|
-
daysInYear(year) {
|
|
212
|
-
return this.isLeapYear(year) ? 384 : 354;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Get zodiac sign for year
|
|
216
|
-
*/
|
|
217
|
-
getZodiacSign(year) {
|
|
218
|
-
return this.terrestrialBranches[year % 12];
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Japanese Calendar
|
|
223
|
-
* @experimental Uses Gregorian rules post-1873. Historical dates may not be accurate.
|
|
224
|
-
*/
|
|
225
|
-
var JapaneseCalendar = class {
|
|
226
|
-
id = "japanese";
|
|
227
|
-
name = "Japanese Calendar";
|
|
228
|
-
locale = "ja";
|
|
229
|
-
monthNames = [
|
|
230
|
-
"1月",
|
|
231
|
-
"2月",
|
|
232
|
-
"3月",
|
|
233
|
-
"4月",
|
|
234
|
-
"5月",
|
|
235
|
-
"6月",
|
|
236
|
-
"7月",
|
|
237
|
-
"8月",
|
|
238
|
-
"9月",
|
|
239
|
-
"10月",
|
|
240
|
-
"11月",
|
|
241
|
-
"12月"
|
|
242
|
-
];
|
|
243
|
-
getMonthName(month) {
|
|
244
|
-
return this.monthNames[Math.max(0, Math.min(11, month - 1))];
|
|
245
|
-
}
|
|
246
|
-
getWeekdayName(day, short = false) {
|
|
247
|
-
return (short ? [
|
|
248
|
-
"日",
|
|
249
|
-
"月",
|
|
250
|
-
"火",
|
|
251
|
-
"水",
|
|
252
|
-
"木",
|
|
253
|
-
"金",
|
|
254
|
-
"土"
|
|
255
|
-
] : [
|
|
256
|
-
"日曜日",
|
|
257
|
-
"月曜日",
|
|
258
|
-
"火曜日",
|
|
259
|
-
"水曜日",
|
|
260
|
-
"木曜日",
|
|
261
|
-
"金曜日",
|
|
262
|
-
"土曜日"
|
|
263
|
-
])[Math.max(0, Math.min(6, day - 1))];
|
|
264
|
-
}
|
|
265
|
-
isLeapYear(year) {
|
|
266
|
-
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
267
|
-
}
|
|
268
|
-
daysInMonth(year, month) {
|
|
269
|
-
const daysPerMonth = [
|
|
270
|
-
31,
|
|
271
|
-
28,
|
|
272
|
-
31,
|
|
273
|
-
30,
|
|
274
|
-
31,
|
|
275
|
-
30,
|
|
276
|
-
31,
|
|
277
|
-
31,
|
|
278
|
-
30,
|
|
279
|
-
31,
|
|
280
|
-
30,
|
|
281
|
-
31
|
|
282
|
-
];
|
|
283
|
-
if (month === 2 && this.isLeapYear(year)) return 29;
|
|
284
|
-
return daysPerMonth[Math.max(0, Math.min(11, month - 1))];
|
|
285
|
-
}
|
|
286
|
-
daysInYear(year) {
|
|
287
|
-
return this.isLeapYear(year) ? 366 : 365;
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* Buddhist Calendar
|
|
292
|
-
* @experimental Uses Gregorian rules with BE year offset (CE + 543).
|
|
293
|
-
*/
|
|
294
|
-
var BuddhistCalendar = class {
|
|
295
|
-
id = "buddhist";
|
|
296
|
-
name = "Buddhist Calendar";
|
|
297
|
-
locale = "th";
|
|
298
|
-
monthNames = [
|
|
299
|
-
"January",
|
|
300
|
-
"February",
|
|
301
|
-
"March",
|
|
302
|
-
"April",
|
|
303
|
-
"May",
|
|
304
|
-
"June",
|
|
305
|
-
"July",
|
|
306
|
-
"August",
|
|
307
|
-
"September",
|
|
308
|
-
"October",
|
|
309
|
-
"November",
|
|
310
|
-
"December"
|
|
311
|
-
];
|
|
312
|
-
getMonthName(month) {
|
|
313
|
-
return this.monthNames[Math.max(0, Math.min(11, month - 1))];
|
|
314
|
-
}
|
|
315
|
-
getWeekdayName(day) {
|
|
316
|
-
return [
|
|
317
|
-
"Sunday",
|
|
318
|
-
"Monday",
|
|
319
|
-
"Tuesday",
|
|
320
|
-
"Wednesday",
|
|
321
|
-
"Thursday",
|
|
322
|
-
"Friday",
|
|
323
|
-
"Saturday"
|
|
324
|
-
][Math.max(0, Math.min(6, day - 1))];
|
|
325
|
-
}
|
|
326
|
-
isLeapYear(year) {
|
|
327
|
-
const ceYear = year - 543;
|
|
328
|
-
return ceYear % 4 === 0 && ceYear % 100 !== 0 || ceYear % 400 === 0;
|
|
329
|
-
}
|
|
330
|
-
daysInMonth(year, month) {
|
|
331
|
-
const daysPerMonth = [
|
|
332
|
-
31,
|
|
333
|
-
28,
|
|
334
|
-
31,
|
|
335
|
-
30,
|
|
336
|
-
31,
|
|
337
|
-
30,
|
|
338
|
-
31,
|
|
339
|
-
31,
|
|
340
|
-
30,
|
|
341
|
-
31,
|
|
342
|
-
30,
|
|
343
|
-
31
|
|
344
|
-
];
|
|
345
|
-
if (month === 2 && this.isLeapYear(year)) return 29;
|
|
346
|
-
return daysPerMonth[Math.max(0, Math.min(11, month - 1))];
|
|
347
|
-
}
|
|
348
|
-
daysInYear(year) {
|
|
349
|
-
return this.isLeapYear(year) ? 366 : 365;
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
//#endregion
|
|
353
|
-
exports.BuddhistCalendar = BuddhistCalendar;
|
|
354
|
-
exports.ChineseCalendar = ChineseCalendar;
|
|
355
|
-
exports.HebrewCalendar = HebrewCalendar;
|
|
356
|
-
exports.IslamicCalendar = IslamicCalendar;
|
|
357
|
-
exports.JapaneseCalendar = JapaneseCalendar;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{id=`islamic`;name=`Islamic Calendar (Hijri)`;locale=`ar`;monthNames=[`Muharram`,`Safar`,`Rabi al-awwal`,`Rabi al-thani`,`Jumada al-awwal`,`Jumada al-thani`,`Rajab`,`Sha'ban`,`Ramadan`,`Shawwal`,`Dhu al-Qi'dah`,`Dhu al-Hijjah`];getMonthName(e){return this.monthNames[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e,t=!1){return(t?[`Ahd`,`Ith`,`Sel`,`Rab`,`Kha`,`Jum`,`Sab`]:[`Ahad`,`Ithnayn`,`Salasa`,`Rabi`,`Khamis`,`Jumah`,`Sabt`])[Math.max(0,Math.min(6,e-1))]}isLeapYear(e){return[2,5,7,10,13,16,18,21,24,26,29].includes(e%30)}daysInMonth(e,t){return t%2==1||t===12&&this.isLeapYear(e)?30:29}daysInYear(e){return this.isLeapYear(e)?355:354}},t=class{id=`hebrew`;name=`Hebrew Calendar`;locale=`he`;monthNames=[`Tishrei`,`Cheshvan`,`Kislev`,`Tevet`,`Shevat`,`Adar`,`Nisan`,`Iyar`,`Sivan`,`Tammuz`,`Av`,`Elul`];getMonthName(e){return this.monthNames[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e,t=!1){return(t?[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`])[Math.max(0,Math.min(6,e-1))]}isLeapYear(e){return[3,6,8,11,14,17,19].includes(e%19)}daysInMonth(e,t){return[30,29,30,29,30,29,30,29,30,29,30,29][Math.max(0,Math.min(11,t-1))]}daysInYear(e){return this.isLeapYear(e)?384:354}},n=class{id=`chinese`;name=`Chinese Calendar`;locale=`zh`;monthNames=[`正月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`冬月`,`腊月`];terrestrialBranches=[`子`,`丑`,`寅`,`卯`,`辰`,`巳`,`午`,`未`,`申`,`酉`,`戌`,`亥`];getMonthName(e){return this.monthNames[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e,t=!1){return(t?[`日`,`一`,`二`,`三`,`四`,`五`,`六`]:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`])[Math.max(0,Math.min(6,e-1))]}isLeapYear(e){return e%3==0}daysInMonth(e,t){return t%2==0?30:29}daysInYear(e){return this.isLeapYear(e)?384:354}getZodiacSign(e){return this.terrestrialBranches[e%12]}},r=class{id=`japanese`;name=`Japanese Calendar`;locale=`ja`;monthNames=[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`];getMonthName(e){return this.monthNames[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e,t=!1){return(t?[`日`,`月`,`火`,`水`,`木`,`金`,`土`]:[`日曜日`,`月曜日`,`火曜日`,`水曜日`,`木曜日`,`金曜日`,`土曜日`])[Math.max(0,Math.min(6,e-1))]}isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}daysInMonth(e,t){return t===2&&this.isLeapYear(e)?29:[31,28,31,30,31,30,31,31,30,31,30,31][Math.max(0,Math.min(11,t-1))]}daysInYear(e){return this.isLeapYear(e)?366:365}},i=class{id=`buddhist`;name=`Buddhist Calendar`;locale=`th`;monthNames=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];getMonthName(e){return this.monthNames[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`][Math.max(0,Math.min(6,e-1))]}isLeapYear(e){let t=e-543;return t%4==0&&t%100!=0||t%400==0}daysInMonth(e,t){return t===2&&this.isLeapYear(e)?29:[31,28,31,30,31,30,31,31,30,31,30,31][Math.max(0,Math.min(11,t-1))]}daysInYear(e){return this.isLeapYear(e)?366:365}};exports.BuddhistCalendar=i,exports.ChineseCalendar=n,exports.HebrewCalendar=t,exports.IslamicCalendar=e,exports.JapaneseCalendar=r;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/*! time-guard v2.
|
|
1
|
+
/*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
|
|
2
2
|
//#region src/calendars/index.ts
|
|
3
|
-
|
|
4
|
-
* Islamic Calendar (Hijri)
|
|
5
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
6
|
-
*/
|
|
7
|
-
var IslamicCalendar = class {
|
|
3
|
+
var e = class {
|
|
8
4
|
id = "islamic";
|
|
9
5
|
name = "Islamic Calendar (Hijri)";
|
|
10
6
|
locale = "ar";
|
|
@@ -22,11 +18,11 @@ var IslamicCalendar = class {
|
|
|
22
18
|
"Dhu al-Qi'dah",
|
|
23
19
|
"Dhu al-Hijjah"
|
|
24
20
|
];
|
|
25
|
-
getMonthName(
|
|
26
|
-
return this.monthNames[Math.max(0, Math.min(11,
|
|
21
|
+
getMonthName(e) {
|
|
22
|
+
return this.monthNames[Math.max(0, Math.min(11, e - 1))];
|
|
27
23
|
}
|
|
28
|
-
getWeekdayName(
|
|
29
|
-
return (
|
|
24
|
+
getWeekdayName(e, t = !1) {
|
|
25
|
+
return (t ? [
|
|
30
26
|
"Ahd",
|
|
31
27
|
"Ith",
|
|
32
28
|
"Sel",
|
|
@@ -42,9 +38,9 @@ var IslamicCalendar = class {
|
|
|
42
38
|
"Khamis",
|
|
43
39
|
"Jumah",
|
|
44
40
|
"Sabt"
|
|
45
|
-
])[Math.max(0, Math.min(6,
|
|
41
|
+
])[Math.max(0, Math.min(6, e - 1))];
|
|
46
42
|
}
|
|
47
|
-
isLeapYear(
|
|
43
|
+
isLeapYear(e) {
|
|
48
44
|
return [
|
|
49
45
|
2,
|
|
50
46
|
5,
|
|
@@ -57,22 +53,15 @@ var IslamicCalendar = class {
|
|
|
57
53
|
24,
|
|
58
54
|
26,
|
|
59
55
|
29
|
|
60
|
-
].includes(
|
|
56
|
+
].includes(e % 30);
|
|
61
57
|
}
|
|
62
|
-
daysInMonth(
|
|
63
|
-
|
|
64
|
-
if (month === 12 && this.isLeapYear(year)) return 30;
|
|
65
|
-
return 29;
|
|
58
|
+
daysInMonth(e, t) {
|
|
59
|
+
return t % 2 == 1 || t === 12 && this.isLeapYear(e) ? 30 : 29;
|
|
66
60
|
}
|
|
67
|
-
daysInYear(
|
|
68
|
-
return this.isLeapYear(
|
|
61
|
+
daysInYear(e) {
|
|
62
|
+
return this.isLeapYear(e) ? 355 : 354;
|
|
69
63
|
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Hebrew Calendar
|
|
73
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
74
|
-
*/
|
|
75
|
-
var HebrewCalendar = class {
|
|
64
|
+
}, t = class {
|
|
76
65
|
id = "hebrew";
|
|
77
66
|
name = "Hebrew Calendar";
|
|
78
67
|
locale = "he";
|
|
@@ -90,11 +79,11 @@ var HebrewCalendar = class {
|
|
|
90
79
|
"Av",
|
|
91
80
|
"Elul"
|
|
92
81
|
];
|
|
93
|
-
getMonthName(
|
|
94
|
-
return this.monthNames[Math.max(0, Math.min(11,
|
|
82
|
+
getMonthName(e) {
|
|
83
|
+
return this.monthNames[Math.max(0, Math.min(11, e - 1))];
|
|
95
84
|
}
|
|
96
|
-
getWeekdayName(
|
|
97
|
-
return (
|
|
85
|
+
getWeekdayName(e, t = !1) {
|
|
86
|
+
return (t ? [
|
|
98
87
|
"Sun",
|
|
99
88
|
"Mon",
|
|
100
89
|
"Tue",
|
|
@@ -110,9 +99,9 @@ var HebrewCalendar = class {
|
|
|
110
99
|
"Thursday",
|
|
111
100
|
"Friday",
|
|
112
101
|
"Saturday"
|
|
113
|
-
])[Math.max(0, Math.min(6,
|
|
102
|
+
])[Math.max(0, Math.min(6, e - 1))];
|
|
114
103
|
}
|
|
115
|
-
isLeapYear(
|
|
104
|
+
isLeapYear(e) {
|
|
116
105
|
return [
|
|
117
106
|
3,
|
|
118
107
|
6,
|
|
@@ -121,9 +110,9 @@ var HebrewCalendar = class {
|
|
|
121
110
|
14,
|
|
122
111
|
17,
|
|
123
112
|
19
|
|
124
|
-
].includes(
|
|
113
|
+
].includes(e % 19);
|
|
125
114
|
}
|
|
126
|
-
daysInMonth(
|
|
115
|
+
daysInMonth(e, t) {
|
|
127
116
|
return [
|
|
128
117
|
30,
|
|
129
118
|
29,
|
|
@@ -137,17 +126,12 @@ var HebrewCalendar = class {
|
|
|
137
126
|
29,
|
|
138
127
|
30,
|
|
139
128
|
29
|
|
140
|
-
][Math.max(0, Math.min(11,
|
|
129
|
+
][Math.max(0, Math.min(11, t - 1))];
|
|
141
130
|
}
|
|
142
|
-
daysInYear(
|
|
143
|
-
return this.isLeapYear(
|
|
131
|
+
daysInYear(e) {
|
|
132
|
+
return this.isLeapYear(e) ? 384 : 354;
|
|
144
133
|
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Chinese Calendar
|
|
148
|
-
* @experimental Uses simplified calculations. May not be accurate for all dates.
|
|
149
|
-
*/
|
|
150
|
-
var ChineseCalendar = class {
|
|
134
|
+
}, n = class {
|
|
151
135
|
id = "chinese";
|
|
152
136
|
name = "Chinese Calendar";
|
|
153
137
|
locale = "zh";
|
|
@@ -179,11 +163,11 @@ var ChineseCalendar = class {
|
|
|
179
163
|
"戌",
|
|
180
164
|
"亥"
|
|
181
165
|
];
|
|
182
|
-
getMonthName(
|
|
183
|
-
return this.monthNames[Math.max(0, Math.min(11,
|
|
166
|
+
getMonthName(e) {
|
|
167
|
+
return this.monthNames[Math.max(0, Math.min(11, e - 1))];
|
|
184
168
|
}
|
|
185
|
-
getWeekdayName(
|
|
186
|
-
return (
|
|
169
|
+
getWeekdayName(e, t = !1) {
|
|
170
|
+
return (t ? [
|
|
187
171
|
"日",
|
|
188
172
|
"一",
|
|
189
173
|
"二",
|
|
@@ -199,29 +183,21 @@ var ChineseCalendar = class {
|
|
|
199
183
|
"星期四",
|
|
200
184
|
"星期五",
|
|
201
185
|
"星期六"
|
|
202
|
-
])[Math.max(0, Math.min(6,
|
|
186
|
+
])[Math.max(0, Math.min(6, e - 1))];
|
|
203
187
|
}
|
|
204
|
-
isLeapYear(
|
|
205
|
-
return
|
|
188
|
+
isLeapYear(e) {
|
|
189
|
+
return e % 3 == 0;
|
|
206
190
|
}
|
|
207
|
-
daysInMonth(
|
|
208
|
-
return
|
|
191
|
+
daysInMonth(e, t) {
|
|
192
|
+
return t % 2 == 0 ? 30 : 29;
|
|
209
193
|
}
|
|
210
|
-
daysInYear(
|
|
211
|
-
return this.isLeapYear(
|
|
194
|
+
daysInYear(e) {
|
|
195
|
+
return this.isLeapYear(e) ? 384 : 354;
|
|
212
196
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*/
|
|
216
|
-
getZodiacSign(year) {
|
|
217
|
-
return this.terrestrialBranches[year % 12];
|
|
197
|
+
getZodiacSign(e) {
|
|
198
|
+
return this.terrestrialBranches[e % 12];
|
|
218
199
|
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Japanese Calendar
|
|
222
|
-
* @experimental Uses Gregorian rules post-1873. Historical dates may not be accurate.
|
|
223
|
-
*/
|
|
224
|
-
var JapaneseCalendar = class {
|
|
200
|
+
}, r = class {
|
|
225
201
|
id = "japanese";
|
|
226
202
|
name = "Japanese Calendar";
|
|
227
203
|
locale = "ja";
|
|
@@ -239,11 +215,11 @@ var JapaneseCalendar = class {
|
|
|
239
215
|
"11月",
|
|
240
216
|
"12月"
|
|
241
217
|
];
|
|
242
|
-
getMonthName(
|
|
243
|
-
return this.monthNames[Math.max(0, Math.min(11,
|
|
218
|
+
getMonthName(e) {
|
|
219
|
+
return this.monthNames[Math.max(0, Math.min(11, e - 1))];
|
|
244
220
|
}
|
|
245
|
-
getWeekdayName(
|
|
246
|
-
return (
|
|
221
|
+
getWeekdayName(e, t = !1) {
|
|
222
|
+
return (t ? [
|
|
247
223
|
"日",
|
|
248
224
|
"月",
|
|
249
225
|
"火",
|
|
@@ -259,13 +235,13 @@ var JapaneseCalendar = class {
|
|
|
259
235
|
"木曜日",
|
|
260
236
|
"金曜日",
|
|
261
237
|
"土曜日"
|
|
262
|
-
])[Math.max(0, Math.min(6,
|
|
238
|
+
])[Math.max(0, Math.min(6, e - 1))];
|
|
263
239
|
}
|
|
264
|
-
isLeapYear(
|
|
265
|
-
return
|
|
240
|
+
isLeapYear(e) {
|
|
241
|
+
return e % 4 == 0 && e % 100 != 0 || e % 400 == 0;
|
|
266
242
|
}
|
|
267
|
-
daysInMonth(
|
|
268
|
-
|
|
243
|
+
daysInMonth(e, t) {
|
|
244
|
+
return t === 2 && this.isLeapYear(e) ? 29 : [
|
|
269
245
|
31,
|
|
270
246
|
28,
|
|
271
247
|
31,
|
|
@@ -278,19 +254,12 @@ var JapaneseCalendar = class {
|
|
|
278
254
|
31,
|
|
279
255
|
30,
|
|
280
256
|
31
|
|
281
|
-
];
|
|
282
|
-
if (month === 2 && this.isLeapYear(year)) return 29;
|
|
283
|
-
return daysPerMonth[Math.max(0, Math.min(11, month - 1))];
|
|
257
|
+
][Math.max(0, Math.min(11, t - 1))];
|
|
284
258
|
}
|
|
285
|
-
daysInYear(
|
|
286
|
-
return this.isLeapYear(
|
|
259
|
+
daysInYear(e) {
|
|
260
|
+
return this.isLeapYear(e) ? 366 : 365;
|
|
287
261
|
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Buddhist Calendar
|
|
291
|
-
* @experimental Uses Gregorian rules with BE year offset (CE + 543).
|
|
292
|
-
*/
|
|
293
|
-
var BuddhistCalendar = class {
|
|
262
|
+
}, i = class {
|
|
294
263
|
id = "buddhist";
|
|
295
264
|
name = "Buddhist Calendar";
|
|
296
265
|
locale = "th";
|
|
@@ -308,10 +277,10 @@ var BuddhistCalendar = class {
|
|
|
308
277
|
"November",
|
|
309
278
|
"December"
|
|
310
279
|
];
|
|
311
|
-
getMonthName(
|
|
312
|
-
return this.monthNames[Math.max(0, Math.min(11,
|
|
280
|
+
getMonthName(e) {
|
|
281
|
+
return this.monthNames[Math.max(0, Math.min(11, e - 1))];
|
|
313
282
|
}
|
|
314
|
-
getWeekdayName(
|
|
283
|
+
getWeekdayName(e) {
|
|
315
284
|
return [
|
|
316
285
|
"Sunday",
|
|
317
286
|
"Monday",
|
|
@@ -320,14 +289,14 @@ var BuddhistCalendar = class {
|
|
|
320
289
|
"Thursday",
|
|
321
290
|
"Friday",
|
|
322
291
|
"Saturday"
|
|
323
|
-
][Math.max(0, Math.min(6,
|
|
292
|
+
][Math.max(0, Math.min(6, e - 1))];
|
|
324
293
|
}
|
|
325
|
-
isLeapYear(
|
|
326
|
-
|
|
327
|
-
return
|
|
294
|
+
isLeapYear(e) {
|
|
295
|
+
let t = e - 543;
|
|
296
|
+
return t % 4 == 0 && t % 100 != 0 || t % 400 == 0;
|
|
328
297
|
}
|
|
329
|
-
daysInMonth(
|
|
330
|
-
|
|
298
|
+
daysInMonth(e, t) {
|
|
299
|
+
return t === 2 && this.isLeapYear(e) ? 29 : [
|
|
331
300
|
31,
|
|
332
301
|
28,
|
|
333
302
|
31,
|
|
@@ -340,13 +309,11 @@ var BuddhistCalendar = class {
|
|
|
340
309
|
31,
|
|
341
310
|
30,
|
|
342
311
|
31
|
|
343
|
-
];
|
|
344
|
-
if (month === 2 && this.isLeapYear(year)) return 29;
|
|
345
|
-
return daysPerMonth[Math.max(0, Math.min(11, month - 1))];
|
|
312
|
+
][Math.max(0, Math.min(11, t - 1))];
|
|
346
313
|
}
|
|
347
|
-
daysInYear(
|
|
348
|
-
return this.isLeapYear(
|
|
314
|
+
daysInYear(e) {
|
|
315
|
+
return this.isLeapYear(e) ? 366 : 365;
|
|
349
316
|
}
|
|
350
317
|
};
|
|
351
318
|
//#endregion
|
|
352
|
-
export { BuddhistCalendar, ChineseCalendar, HebrewCalendar, IslamicCalendar, JapaneseCalendar };
|
|
319
|
+
export { i as BuddhistCalendar, n as ChineseCalendar, t as HebrewCalendar, e as IslamicCalendar, r as JapaneseCalendar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|