@hebcal/core 3.45.2 → 3.45.4
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.md +6 -6
- package/dist/bundle.js +378 -1144
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +113 -293
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +118 -338
- package/dist/hdate.mjs +3 -3
- package/dist/hdate0-bundle.js +38 -68
- package/dist/hdate0-bundle.min.js +1 -1
- package/dist/hdate0.mjs +1 -1
- package/dist/index.js +372 -1171
- package/dist/index.mjs +375 -1169
- package/package.json +8 -8
- package/po/he.po +1 -1
- package/dist/foo.html +0 -10
package/dist/hdate.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.45.
|
|
1
|
+
/*! @hebcal/core v3.45.4 */
|
|
2
2
|
const GERESH = '׳';
|
|
3
3
|
const GERSHAYIM = '״';
|
|
4
4
|
|
|
@@ -1120,7 +1120,7 @@ class HDate {
|
|
|
1120
1120
|
* import {HDate, months} from '@hebcal/core';
|
|
1121
1121
|
*
|
|
1122
1122
|
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
1123
|
-
* console.log(hd.render()); // '15th of Cheshvan, 5769'
|
|
1123
|
+
* console.log(hd.render('en')); // '15th of Cheshvan, 5769'
|
|
1124
1124
|
* console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
|
|
1125
1125
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
1126
1126
|
* @param {boolean} [showYear=true] Display year (defaults to true).
|
|
@@ -1761,7 +1761,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1761
1761
|
return new HDate(day, month, hyear);
|
|
1762
1762
|
}
|
|
1763
1763
|
|
|
1764
|
-
const version="3.45.
|
|
1764
|
+
const version="3.45.4";
|
|
1765
1765
|
|
|
1766
1766
|
const headers={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
|
|
1767
1767
|
|
package/dist/hdate0-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.45.
|
|
1
|
+
/*! @hebcal/core v3.45.4 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -19,50 +19,49 @@ function _typeof(obj) {
|
|
|
19
19
|
/** @private */
|
|
20
20
|
var lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
21
21
|
/** @private */
|
|
22
|
-
|
|
23
22
|
var monthLengths = [lengths, lengths.slice()];
|
|
24
23
|
monthLengths[1][2] = 29;
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* @private
|
|
27
27
|
* @param {number} x
|
|
28
28
|
* @param {number} y
|
|
29
29
|
* @return {number}
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
31
|
function mod(x, y) {
|
|
33
32
|
return x - y * Math.floor(x / y);
|
|
34
33
|
}
|
|
34
|
+
|
|
35
35
|
/**
|
|
36
36
|
* @private
|
|
37
37
|
* @param {number} x
|
|
38
38
|
* @param {number} y
|
|
39
39
|
* @return {number}
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
41
|
function quotient(x, y) {
|
|
43
42
|
return Math.floor(x / y);
|
|
44
43
|
}
|
|
44
|
+
|
|
45
45
|
/**
|
|
46
46
|
* Returns true if the Gregorian year is a leap year
|
|
47
47
|
* @private
|
|
48
48
|
* @param {number} year Gregorian year
|
|
49
49
|
* @return {boolean}
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
51
|
function isLeapYear$1(year) {
|
|
54
52
|
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
55
53
|
}
|
|
54
|
+
|
|
56
55
|
/**
|
|
57
56
|
* Returns true if the object is a Javascript Date
|
|
58
57
|
* @private
|
|
59
58
|
* @param {Object} obj
|
|
60
59
|
* @return {boolean}
|
|
61
60
|
*/
|
|
62
|
-
|
|
63
61
|
function isDate(obj) {
|
|
64
62
|
return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
|
|
65
63
|
}
|
|
64
|
+
|
|
66
65
|
/*
|
|
67
66
|
const ABS_14SEP1752 = 639797;
|
|
68
67
|
const ABS_2SEP1752 = 639785;
|
|
@@ -74,27 +73,24 @@ const ABS_2SEP1752 = 639785;
|
|
|
74
73
|
* @param {Date} date Gregorian date
|
|
75
74
|
* @return {number}
|
|
76
75
|
*/
|
|
77
|
-
|
|
78
76
|
function greg2abs(date) {
|
|
79
77
|
if (!isDate(date)) {
|
|
80
78
|
throw new TypeError("Argument not a Date: ".concat(date));
|
|
81
79
|
}
|
|
82
|
-
|
|
83
80
|
var abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
84
81
|
/*
|
|
85
82
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
86
83
|
throw new RangeError(`Invalid Date: ${date}`);
|
|
87
84
|
}
|
|
88
85
|
*/
|
|
89
|
-
|
|
90
86
|
return abs;
|
|
91
87
|
}
|
|
88
|
+
|
|
92
89
|
/**
|
|
93
90
|
* @private
|
|
94
91
|
* @param {number} abs - R.D. number of days
|
|
95
92
|
* @return {number}
|
|
96
93
|
*/
|
|
97
|
-
|
|
98
94
|
function yearFromFixed(abs) {
|
|
99
95
|
var l0 = abs - 1;
|
|
100
96
|
var n400 = quotient(l0, 146097);
|
|
@@ -107,6 +103,7 @@ function yearFromFixed(abs) {
|
|
|
107
103
|
var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
108
104
|
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
109
105
|
}
|
|
106
|
+
|
|
110
107
|
/**
|
|
111
108
|
* @private
|
|
112
109
|
* @param {number} year
|
|
@@ -114,12 +111,11 @@ function yearFromFixed(abs) {
|
|
|
114
111
|
* @param {number} day (1-31)
|
|
115
112
|
* @return {number}
|
|
116
113
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
114
|
function toFixed(year, month, day) {
|
|
120
115
|
var py = year - 1;
|
|
121
116
|
return 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + (month <= 2 ? 0 : isLeapYear$1(year) ? -1 : -2) + day;
|
|
122
117
|
}
|
|
118
|
+
|
|
123
119
|
/**
|
|
124
120
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
125
121
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
@@ -130,108 +126,92 @@ function toFixed(year, month, day) {
|
|
|
130
126
|
* @param {number} abs - R.D. number of days
|
|
131
127
|
* @return {Date}
|
|
132
128
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
129
|
function abs2greg(abs) {
|
|
136
130
|
if (typeof abs !== 'number') {
|
|
137
131
|
throw new TypeError("Argument not a Number: ".concat(abs));
|
|
138
132
|
}
|
|
139
|
-
|
|
140
133
|
abs = Math.trunc(abs);
|
|
141
134
|
/*
|
|
142
135
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
143
136
|
throw new RangeError(`Invalid Date: ${abs}`);
|
|
144
137
|
}
|
|
145
138
|
*/
|
|
146
|
-
|
|
147
139
|
var year = yearFromFixed(abs);
|
|
148
140
|
var priorDays = abs - toFixed(year, 1, 1);
|
|
149
141
|
var correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
|
|
150
142
|
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
151
143
|
var day = abs - toFixed(year, month, 1) + 1;
|
|
152
144
|
var dt = new Date(year, month - 1, day);
|
|
153
|
-
|
|
154
145
|
if (year < 100 && year >= 0) {
|
|
155
146
|
dt.setFullYear(year);
|
|
156
147
|
}
|
|
157
|
-
|
|
158
148
|
return dt;
|
|
159
149
|
}
|
|
160
150
|
|
|
161
151
|
/*
|
|
162
152
|
* More minimal HDate
|
|
163
153
|
*/
|
|
164
|
-
var NISAN = 1;
|
|
165
|
-
var IYYAR = 2; // const SIVAN = 3;
|
|
166
|
-
|
|
167
|
-
var TAMUZ = 4; // const AV = 5;
|
|
168
154
|
|
|
155
|
+
var NISAN = 1;
|
|
156
|
+
var IYYAR = 2;
|
|
157
|
+
// const SIVAN = 3;
|
|
158
|
+
var TAMUZ = 4;
|
|
159
|
+
// const AV = 5;
|
|
169
160
|
var ELUL = 6;
|
|
170
161
|
var TISHREI = 7;
|
|
171
162
|
var CHESHVAN = 8;
|
|
172
163
|
var KISLEV = 9;
|
|
173
|
-
var TEVET = 10;
|
|
174
|
-
|
|
164
|
+
var TEVET = 10;
|
|
165
|
+
// const SHVAT = 11;
|
|
175
166
|
var ADAR_I = 12;
|
|
176
167
|
var ADAR_II = 13;
|
|
168
|
+
|
|
177
169
|
/**
|
|
178
170
|
* Hebrew months of the year (NISAN=1, TISHREI=7)
|
|
179
171
|
* @readonly
|
|
180
172
|
* @enum {number}
|
|
181
173
|
*/
|
|
182
|
-
|
|
183
174
|
var months = {
|
|
184
175
|
/** Nissan / ניסן */
|
|
185
176
|
NISAN: 1,
|
|
186
|
-
|
|
187
177
|
/** Iyyar / אייר */
|
|
188
178
|
IYYAR: 2,
|
|
189
|
-
|
|
190
179
|
/** Sivan / סיון */
|
|
191
180
|
SIVAN: 3,
|
|
192
|
-
|
|
193
181
|
/** Tamuz (sometimes Tammuz) / תמוז */
|
|
194
182
|
TAMUZ: 4,
|
|
195
|
-
|
|
196
183
|
/** Av / אב */
|
|
197
184
|
AV: 5,
|
|
198
|
-
|
|
199
185
|
/** Elul / אלול */
|
|
200
186
|
ELUL: 6,
|
|
201
|
-
|
|
202
187
|
/** Tishrei / תִשְׁרֵי */
|
|
203
188
|
TISHREI: 7,
|
|
204
|
-
|
|
205
189
|
/** Cheshvan / חשון */
|
|
206
190
|
CHESHVAN: 8,
|
|
207
|
-
|
|
208
191
|
/** Kislev / כסלו */
|
|
209
192
|
KISLEV: 9,
|
|
210
|
-
|
|
211
193
|
/** Tevet / טבת */
|
|
212
194
|
TEVET: 10,
|
|
213
|
-
|
|
214
195
|
/** Sh'vat / שבט */
|
|
215
196
|
SHVAT: 11,
|
|
216
|
-
|
|
217
197
|
/** Adar or Adar Rishon / אדר */
|
|
218
198
|
ADAR_I: 12,
|
|
219
|
-
|
|
220
199
|
/** Adar Sheini (only on leap years) / אדר ב׳ */
|
|
221
200
|
ADAR_II: 13
|
|
222
201
|
};
|
|
223
202
|
var monthNames0 = ['', 'Nisan', 'Iyyar', 'Sivan', 'Tamuz', 'Av', 'Elul', 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Sh\'vat'];
|
|
203
|
+
|
|
224
204
|
/**
|
|
225
205
|
* Transliterations of Hebrew month names.
|
|
226
206
|
* Regular years are index 0 and leap years are index 1.
|
|
227
207
|
* @private
|
|
228
208
|
*/
|
|
229
|
-
|
|
230
209
|
var monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
|
|
231
210
|
var edCache = Object.create(null);
|
|
232
|
-
var EPOCH = -1373428;
|
|
233
|
-
|
|
211
|
+
var EPOCH = -1373428;
|
|
212
|
+
// Avg year length in the cycle (19 solar years with 235 lunar months)
|
|
234
213
|
var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
214
|
+
|
|
235
215
|
/**
|
|
236
216
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
237
217
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
@@ -242,15 +222,12 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
242
222
|
* @param {number} day Hebrew date (1-30)
|
|
243
223
|
* @return {number}
|
|
244
224
|
*/
|
|
245
|
-
|
|
246
225
|
function hebrew2abs(year, month, day) {
|
|
247
226
|
var tempabs = day;
|
|
248
|
-
|
|
249
227
|
if (month < TISHREI) {
|
|
250
228
|
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
251
229
|
tempabs += daysInMonth(m, year);
|
|
252
230
|
}
|
|
253
|
-
|
|
254
231
|
for (var _m = NISAN; _m < month; _m++) {
|
|
255
232
|
tempabs += daysInMonth(_m, year);
|
|
256
233
|
}
|
|
@@ -259,46 +236,40 @@ function hebrew2abs(year, month, day) {
|
|
|
259
236
|
tempabs += daysInMonth(_m2, year);
|
|
260
237
|
}
|
|
261
238
|
}
|
|
262
|
-
|
|
263
239
|
return EPOCH + elapsedDays(year) + tempabs - 1;
|
|
264
240
|
}
|
|
241
|
+
|
|
265
242
|
/**
|
|
266
243
|
* @private
|
|
267
244
|
* @param {number} year
|
|
268
245
|
* @return {number}
|
|
269
246
|
*/
|
|
270
|
-
|
|
271
247
|
function newYear(year) {
|
|
272
248
|
return EPOCH + elapsedDays(year);
|
|
273
249
|
}
|
|
250
|
+
|
|
274
251
|
/**
|
|
275
252
|
* Converts absolute R.D. days to Hebrew date
|
|
276
253
|
* @private
|
|
277
254
|
* @param {number} abs absolute R.D. days
|
|
278
255
|
* @return {SimpleHebrewDate}
|
|
279
256
|
*/
|
|
280
|
-
|
|
281
|
-
|
|
282
257
|
function abs2hebrew(abs) {
|
|
283
258
|
if (typeof abs !== 'number' || isNaN(abs)) {
|
|
284
259
|
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
285
260
|
}
|
|
261
|
+
abs = Math.trunc(abs);
|
|
286
262
|
|
|
287
|
-
|
|
288
|
-
|
|
263
|
+
// first, quickly approximate year
|
|
289
264
|
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
290
|
-
|
|
291
265
|
while (newYear(year) <= abs) {
|
|
292
266
|
++year;
|
|
293
267
|
}
|
|
294
|
-
|
|
295
268
|
--year;
|
|
296
269
|
var month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
297
|
-
|
|
298
270
|
while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
|
|
299
271
|
++month;
|
|
300
272
|
}
|
|
301
|
-
|
|
302
273
|
var day = 1 + abs - hebrew2abs(year, month, 1);
|
|
303
274
|
return {
|
|
304
275
|
yy: year,
|
|
@@ -306,26 +277,27 @@ function abs2hebrew(abs) {
|
|
|
306
277
|
dd: day
|
|
307
278
|
};
|
|
308
279
|
}
|
|
280
|
+
|
|
309
281
|
/**
|
|
310
282
|
* Returns true if Hebrew year is a leap year
|
|
311
283
|
* @private
|
|
312
284
|
* @param {number} year Hebrew year
|
|
313
285
|
* @return {boolean}
|
|
314
286
|
*/
|
|
315
|
-
|
|
316
287
|
function isLeapYear(year) {
|
|
317
288
|
return (1 + year * 7) % 19 < 7;
|
|
318
289
|
}
|
|
290
|
+
|
|
319
291
|
/**
|
|
320
292
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
321
293
|
* @private
|
|
322
294
|
* @param {number} year Hebrew year
|
|
323
295
|
* @return {number}
|
|
324
296
|
*/
|
|
325
|
-
|
|
326
297
|
function monthsInYear(year) {
|
|
327
298
|
return 12 + isLeapYear(year); // boolean is cast to 1 or 0
|
|
328
299
|
}
|
|
300
|
+
|
|
329
301
|
/**
|
|
330
302
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
331
303
|
* @private
|
|
@@ -333,7 +305,6 @@ function monthsInYear(year) {
|
|
|
333
305
|
* @param {number} year Hebrew year
|
|
334
306
|
* @return {number}
|
|
335
307
|
*/
|
|
336
|
-
|
|
337
308
|
function daysInMonth(month, year) {
|
|
338
309
|
switch (month) {
|
|
339
310
|
case IYYAR:
|
|
@@ -343,13 +314,13 @@ function daysInMonth(month, year) {
|
|
|
343
314
|
case ADAR_II:
|
|
344
315
|
return 29;
|
|
345
316
|
}
|
|
346
|
-
|
|
347
317
|
if (month === ADAR_I && !isLeapYear(year) || month === CHESHVAN && !longCheshvan(year) || month === KISLEV && shortKislev(year)) {
|
|
348
318
|
return 29;
|
|
349
319
|
} else {
|
|
350
320
|
return 30;
|
|
351
321
|
}
|
|
352
322
|
}
|
|
323
|
+
|
|
353
324
|
/**
|
|
354
325
|
* Returns a transliterated string name of Hebrew month in year,
|
|
355
326
|
* for example 'Elul' or 'Cheshvan'.
|
|
@@ -358,14 +329,13 @@ function daysInMonth(month, year) {
|
|
|
358
329
|
* @param {number} year Hebrew year
|
|
359
330
|
* @return {string}
|
|
360
331
|
*/
|
|
361
|
-
|
|
362
332
|
function getMonthName(month, year) {
|
|
363
333
|
if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
|
|
364
334
|
throw new TypeError("bad month argument ".concat(month));
|
|
365
335
|
}
|
|
366
|
-
|
|
367
336
|
return monthNames[+isLeapYear(year)][month];
|
|
368
337
|
}
|
|
338
|
+
|
|
369
339
|
/**
|
|
370
340
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
371
341
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -373,11 +343,11 @@ function getMonthName(month, year) {
|
|
|
373
343
|
* @param {number} year Hebrew year
|
|
374
344
|
* @return {number}
|
|
375
345
|
*/
|
|
376
|
-
|
|
377
346
|
function elapsedDays(year) {
|
|
378
347
|
var elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
|
|
379
348
|
return elapsed;
|
|
380
349
|
}
|
|
350
|
+
|
|
381
351
|
/**
|
|
382
352
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
383
353
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -385,11 +355,12 @@ function elapsedDays(year) {
|
|
|
385
355
|
* @param {number} year Hebrew year
|
|
386
356
|
* @return {number}
|
|
387
357
|
*/
|
|
388
|
-
|
|
389
358
|
function elapsedDays0(year) {
|
|
390
359
|
var prevYear = year - 1;
|
|
391
|
-
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
392
|
-
|
|
360
|
+
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
361
|
+
// Months in complete 19 year lunar (Metonic) cycles so far
|
|
362
|
+
12 * (prevYear % 19) +
|
|
363
|
+
// Regular months in this cycle
|
|
393
364
|
Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
|
|
394
365
|
|
|
395
366
|
var pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
@@ -399,6 +370,7 @@ function elapsedDays0(year) {
|
|
|
399
370
|
var altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
|
|
400
371
|
return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
|
|
401
372
|
}
|
|
373
|
+
|
|
402
374
|
/**
|
|
403
375
|
* Number of days in the hebrew YEAR.
|
|
404
376
|
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
@@ -407,28 +379,26 @@ function elapsedDays0(year) {
|
|
|
407
379
|
* @param {number} year Hebrew year
|
|
408
380
|
* @return {number}
|
|
409
381
|
*/
|
|
410
|
-
|
|
411
|
-
|
|
412
382
|
function daysInYear(year) {
|
|
413
383
|
return elapsedDays(year + 1) - elapsedDays(year);
|
|
414
384
|
}
|
|
385
|
+
|
|
415
386
|
/**
|
|
416
387
|
* true if Cheshvan is long in Hebrew year
|
|
417
388
|
* @private
|
|
418
389
|
* @param {number} year Hebrew year
|
|
419
390
|
* @return {boolean}
|
|
420
391
|
*/
|
|
421
|
-
|
|
422
392
|
function longCheshvan(year) {
|
|
423
393
|
return daysInYear(year) % 10 === 5;
|
|
424
394
|
}
|
|
395
|
+
|
|
425
396
|
/**
|
|
426
397
|
* true if Kislev is short in Hebrew year
|
|
427
398
|
* @private
|
|
428
399
|
* @param {number} year Hebrew year
|
|
429
400
|
* @return {boolean}
|
|
430
401
|
*/
|
|
431
|
-
|
|
432
402
|
function shortKislev(year) {
|
|
433
403
|
return daysInYear(year) % 10 === 3;
|
|
434
404
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @hebcal/core v3.45.
|
|
1
|
+
/*! @hebcal/core v3.45.4 */
|
|
2
2
|
var hebcal=function(r){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t(r)}var n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e(r,t){return r-t*Math.floor(r/t)}function o(r,t){return Math.floor(r/t)}function a(r){return!(r%4||!(r%100)&&r%400)}function u(r,t,n){var e=r-1;return 365*e+o(e,4)-o(e,100)+o(e,400)+o(367*t-362,12)+(t<=2?0:a(r)?-1:-2)+n}[n,n.slice()][1][2]=29;var c=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],f=[c.concat(["Adar","Nisan"]),c.concat(["Adar I","Adar II","Nisan"])],i=Object.create(null),s=-1373428;function h(r,t,n){var e=n;if(t<7){for(var o=7;o<=v(r);o++)e+=b(o,r);for(var a=1;a<t;a++)e+=b(a,r)}else for(var u=7;u<t;u++)e+=b(u,r);return s+m(r)+e-1}function l(r){return s+m(r)}function y(r){return(1+7*r)%19<7}function v(r){return 12+y(r)}function b(r,t){switch(r){case 2:case 4:case 6:case 10:case 13:return 29}return 12===r&&!y(t)||8===r&&!A(t)||9===r&&I(t)?29:30}function m(r){var t=i[r]=i[r]||function(r){var t=r-1,n=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),e=204+n%1080*793,o=5+12*n+793*Math.floor(n/1080)+Math.floor(e/1080),a=e%1080+o%24*1080,u=1+29*n+Math.floor(o/24),c=u+(a>=19440||2==u%7&&a>=9924&&!y(r)||1==u%7&&a>=16789&&y(t));return c+(c%7==0||c%7==3||c%7==5)}(r);return t}function p(r){return m(r+1)-m(r)}function A(r){return p(r)%10==5}function I(r){return p(r)%10==3}var M={abs2hebrew:function(r){if("number"!=typeof r||isNaN(r))throw new TypeError("invalid parameter to abs2hebrew ".concat(r));r=Math.trunc(r);for(var t=Math.floor((r-s)/365.24682220597794);l(t)<=r;)++t;for(var n=r<h(--t,1,1)?7:1;r>h(t,n,b(n,t));)++n;return{yy:t,mm:n,dd:1+r-h(t,n,1)}},daysInMonth:b,daysInYear:p,getMonthName:function(r,t){if("number"!=typeof r||isNaN(r)||r<1||r>14)throw new TypeError("bad month argument ".concat(r));return f[+y(t)][r]},hebrew2abs:h,isLeapYear:y,longCheshvan:A,months:{NISAN:1,IYYAR:2,SIVAN:3,TAMUZ:4,AV:5,ELUL:6,TISHREI:7,CHESHVAN:8,KISLEV:9,TEVET:10,SHVAT:11,ADAR_I:12,ADAR_II:13},monthsInYear:v,shortKislev:I};return r.abs2greg=function(r){if("number"!=typeof r)throw new TypeError("Argument not a Number: ".concat(r));var t=function(r){var t=r-1,n=o(t,146097),a=e(t,146097),u=o(a,36524),c=e(a,36524),f=o(c,1461),i=o(e(c,1461),365),s=400*n+100*u+4*f+i;return 4!=u&&4!=i?s+1:s}(r=Math.trunc(r)),n=o(12*(r-u(t,1,1)+(r<u(t,3,1)?0:a(t)?1:2))+373,367),c=r-u(t,n,1)+1,f=new Date(t,n-1,c);return t<100&&t>=0&&f.setFullYear(t),f},r.greg2abs=function(r){if("object"!==t(n=r)||Date.prototype!==n.__proto__)throw new TypeError("Argument not a Date: ".concat(r));var n;return u(r.getFullYear(),r.getMonth()+1,r.getDate())},r.hdate=M,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
|
package/dist/hdate0.mjs
CHANGED