@hebcal/core 3.45.3 → 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 +1 -1
- package/dist/bundle.js +368 -1139
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +112 -292
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +117 -337
- package/dist/hdate.mjs +2 -2
- 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 +362 -1166
- package/dist/index.mjs +365 -1164
- package/package.json +7 -7
package/dist/hdate-bundle.js
CHANGED
|
@@ -1,119 +1,92 @@
|
|
|
1
|
-
/*! @hebcal/core v3.45.
|
|
1
|
+
/*! @hebcal/core v3.45.4 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var GERESH = '׳';
|
|
6
6
|
var GERSHAYIM = '״';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* @private
|
|
9
10
|
* @param {number} num
|
|
10
11
|
* @return {string}
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
13
|
function num2heb(num) {
|
|
14
14
|
switch (num) {
|
|
15
15
|
case 1:
|
|
16
16
|
return 'א';
|
|
17
|
-
|
|
18
17
|
case 2:
|
|
19
18
|
return 'ב';
|
|
20
|
-
|
|
21
19
|
case 3:
|
|
22
20
|
return 'ג';
|
|
23
|
-
|
|
24
21
|
case 4:
|
|
25
22
|
return 'ד';
|
|
26
|
-
|
|
27
23
|
case 5:
|
|
28
24
|
return 'ה';
|
|
29
|
-
|
|
30
25
|
case 6:
|
|
31
26
|
return 'ו';
|
|
32
|
-
|
|
33
27
|
case 7:
|
|
34
28
|
return 'ז';
|
|
35
|
-
|
|
36
29
|
case 8:
|
|
37
30
|
return 'ח';
|
|
38
|
-
|
|
39
31
|
case 9:
|
|
40
32
|
return 'ט';
|
|
41
|
-
|
|
42
33
|
case 10:
|
|
43
34
|
return 'י';
|
|
44
|
-
|
|
45
35
|
case 20:
|
|
46
36
|
return 'כ';
|
|
47
|
-
|
|
48
37
|
case 30:
|
|
49
38
|
return 'ל';
|
|
50
|
-
|
|
51
39
|
case 40:
|
|
52
40
|
return 'מ';
|
|
53
|
-
|
|
54
41
|
case 50:
|
|
55
42
|
return 'נ';
|
|
56
|
-
|
|
57
43
|
case 60:
|
|
58
44
|
return 'ס';
|
|
59
|
-
|
|
60
45
|
case 70:
|
|
61
46
|
return 'ע';
|
|
62
|
-
|
|
63
47
|
case 80:
|
|
64
48
|
return 'פ';
|
|
65
|
-
|
|
66
49
|
case 90:
|
|
67
50
|
return 'צ';
|
|
68
|
-
|
|
69
51
|
case 100:
|
|
70
52
|
return 'ק';
|
|
71
|
-
|
|
72
53
|
case 200:
|
|
73
54
|
return 'ר';
|
|
74
|
-
|
|
75
55
|
case 300:
|
|
76
56
|
return 'ש';
|
|
77
|
-
|
|
78
57
|
case 400:
|
|
79
58
|
return 'ת';
|
|
80
|
-
|
|
81
59
|
default:
|
|
82
60
|
return '*INVALID*';
|
|
83
61
|
}
|
|
84
62
|
}
|
|
63
|
+
|
|
85
64
|
/**
|
|
86
65
|
* @private
|
|
87
66
|
* @param {number} num
|
|
88
67
|
* @return {number[]}
|
|
89
68
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
69
|
function num2digits(num) {
|
|
93
70
|
var digits = [];
|
|
94
|
-
|
|
95
71
|
while (num > 0) {
|
|
96
72
|
if (num === 15 || num === 16) {
|
|
97
73
|
digits.push(9);
|
|
98
74
|
digits.push(num - 9);
|
|
99
75
|
break;
|
|
100
76
|
}
|
|
101
|
-
|
|
102
77
|
var incr = 100;
|
|
103
78
|
var i = void 0;
|
|
104
|
-
|
|
105
79
|
for (i = 400; i > num; i -= incr) {
|
|
106
80
|
if (i === incr) {
|
|
107
81
|
incr = incr / 10;
|
|
108
82
|
}
|
|
109
83
|
}
|
|
110
|
-
|
|
111
84
|
digits.push(i);
|
|
112
85
|
num -= i;
|
|
113
86
|
}
|
|
114
|
-
|
|
115
87
|
return digits;
|
|
116
88
|
}
|
|
89
|
+
|
|
117
90
|
/**
|
|
118
91
|
* Converts a numerical value to a string of Hebrew letters.
|
|
119
92
|
*
|
|
@@ -128,42 +101,30 @@ function num2digits(num) {
|
|
|
128
101
|
* @param {number} number
|
|
129
102
|
* @return {string}
|
|
130
103
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
104
|
function gematriya(number) {
|
|
134
105
|
var num = parseInt(number, 10);
|
|
135
|
-
|
|
136
106
|
if (!num) {
|
|
137
107
|
throw new TypeError("invalid parameter to gematriya ".concat(number));
|
|
138
108
|
}
|
|
139
|
-
|
|
140
109
|
var str = '';
|
|
141
110
|
var thousands = Math.floor(num / 1000);
|
|
142
|
-
|
|
143
111
|
if (thousands > 0 && thousands !== 5) {
|
|
144
112
|
var tdigits = num2digits(thousands);
|
|
145
|
-
|
|
146
113
|
for (var i = 0; i < tdigits.length; i++) {
|
|
147
114
|
str += num2heb(tdigits[i]);
|
|
148
115
|
}
|
|
149
|
-
|
|
150
116
|
str += GERESH;
|
|
151
117
|
}
|
|
152
|
-
|
|
153
118
|
var digits = num2digits(num % 1000);
|
|
154
|
-
|
|
155
119
|
if (digits.length == 1) {
|
|
156
120
|
return str + num2heb(digits[0]) + GERESH;
|
|
157
121
|
}
|
|
158
|
-
|
|
159
122
|
for (var _i = 0; _i < digits.length; _i++) {
|
|
160
123
|
if (_i + 1 === digits.length) {
|
|
161
124
|
str += GERSHAYIM;
|
|
162
125
|
}
|
|
163
|
-
|
|
164
126
|
str += num2heb(digits[_i]);
|
|
165
127
|
}
|
|
166
|
-
|
|
167
128
|
return str;
|
|
168
129
|
}
|
|
169
130
|
|
|
@@ -176,13 +137,11 @@ function _typeof(obj) {
|
|
|
176
137
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
177
138
|
}, _typeof(obj);
|
|
178
139
|
}
|
|
179
|
-
|
|
180
140
|
function _classCallCheck(instance, Constructor) {
|
|
181
141
|
if (!(instance instanceof Constructor)) {
|
|
182
142
|
throw new TypeError("Cannot call a class as a function");
|
|
183
143
|
}
|
|
184
144
|
}
|
|
185
|
-
|
|
186
145
|
function _defineProperties(target, props) {
|
|
187
146
|
for (var i = 0; i < props.length; i++) {
|
|
188
147
|
var descriptor = props[i];
|
|
@@ -192,7 +151,6 @@ function _defineProperties(target, props) {
|
|
|
192
151
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
193
152
|
}
|
|
194
153
|
}
|
|
195
|
-
|
|
196
154
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
197
155
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
198
156
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -201,7 +159,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
201
159
|
});
|
|
202
160
|
return Constructor;
|
|
203
161
|
}
|
|
204
|
-
|
|
205
162
|
function _defineProperty(obj, key, value) {
|
|
206
163
|
if (key in obj) {
|
|
207
164
|
Object.defineProperty(obj, key, {
|
|
@@ -213,7 +170,6 @@ function _defineProperty(obj, key, value) {
|
|
|
213
170
|
} else {
|
|
214
171
|
obj[key] = value;
|
|
215
172
|
}
|
|
216
|
-
|
|
217
173
|
return obj;
|
|
218
174
|
}
|
|
219
175
|
|
|
@@ -224,40 +180,39 @@ function _defineProperty(obj, key, value) {
|
|
|
224
180
|
/** @private */
|
|
225
181
|
var lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
226
182
|
/** @private */
|
|
227
|
-
|
|
228
183
|
var monthLengths = [lengths, lengths.slice()];
|
|
229
184
|
monthLengths[1][2] = 29;
|
|
185
|
+
|
|
230
186
|
/**
|
|
231
187
|
* @private
|
|
232
188
|
* @param {number} x
|
|
233
189
|
* @param {number} y
|
|
234
190
|
* @return {number}
|
|
235
191
|
*/
|
|
236
|
-
|
|
237
192
|
function mod(x, y) {
|
|
238
193
|
return x - y * Math.floor(x / y);
|
|
239
194
|
}
|
|
195
|
+
|
|
240
196
|
/**
|
|
241
197
|
* @private
|
|
242
198
|
* @param {number} x
|
|
243
199
|
* @param {number} y
|
|
244
200
|
* @return {number}
|
|
245
201
|
*/
|
|
246
|
-
|
|
247
202
|
function quotient(x, y) {
|
|
248
203
|
return Math.floor(x / y);
|
|
249
204
|
}
|
|
205
|
+
|
|
250
206
|
/**
|
|
251
207
|
* Returns true if the Gregorian year is a leap year
|
|
252
208
|
* @private
|
|
253
209
|
* @param {number} year Gregorian year
|
|
254
210
|
* @return {boolean}
|
|
255
211
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
212
|
function isLeapYear$1(year) {
|
|
259
213
|
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
260
214
|
}
|
|
215
|
+
|
|
261
216
|
/**
|
|
262
217
|
* Number of days in the Gregorian month for given year
|
|
263
218
|
* @private
|
|
@@ -265,21 +220,21 @@ function isLeapYear$1(year) {
|
|
|
265
220
|
* @param {number} year Gregorian year
|
|
266
221
|
* @return {number}
|
|
267
222
|
*/
|
|
268
|
-
|
|
269
223
|
function daysInMonth$1(month, year) {
|
|
270
224
|
// 1 based months
|
|
271
225
|
return monthLengths[+isLeapYear$1(year)][month];
|
|
272
226
|
}
|
|
227
|
+
|
|
273
228
|
/**
|
|
274
229
|
* Returns true if the object is a Javascript Date
|
|
275
230
|
* @private
|
|
276
231
|
* @param {Object} obj
|
|
277
232
|
* @return {boolean}
|
|
278
233
|
*/
|
|
279
|
-
|
|
280
234
|
function isDate(obj) {
|
|
281
235
|
return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
|
|
282
236
|
}
|
|
237
|
+
|
|
283
238
|
/*
|
|
284
239
|
const ABS_14SEP1752 = 639797;
|
|
285
240
|
const ABS_2SEP1752 = 639785;
|
|
@@ -291,27 +246,24 @@ const ABS_2SEP1752 = 639785;
|
|
|
291
246
|
* @param {Date} date Gregorian date
|
|
292
247
|
* @return {number}
|
|
293
248
|
*/
|
|
294
|
-
|
|
295
249
|
function greg2abs(date) {
|
|
296
250
|
if (!isDate(date)) {
|
|
297
251
|
throw new TypeError("Argument not a Date: ".concat(date));
|
|
298
252
|
}
|
|
299
|
-
|
|
300
253
|
var abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
301
254
|
/*
|
|
302
255
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
303
256
|
throw new RangeError(`Invalid Date: ${date}`);
|
|
304
257
|
}
|
|
305
258
|
*/
|
|
306
|
-
|
|
307
259
|
return abs;
|
|
308
260
|
}
|
|
261
|
+
|
|
309
262
|
/**
|
|
310
263
|
* @private
|
|
311
264
|
* @param {number} abs - R.D. number of days
|
|
312
265
|
* @return {number}
|
|
313
266
|
*/
|
|
314
|
-
|
|
315
267
|
function yearFromFixed(abs) {
|
|
316
268
|
var l0 = abs - 1;
|
|
317
269
|
var n400 = quotient(l0, 146097);
|
|
@@ -324,6 +276,7 @@ function yearFromFixed(abs) {
|
|
|
324
276
|
var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
325
277
|
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
326
278
|
}
|
|
279
|
+
|
|
327
280
|
/**
|
|
328
281
|
* @private
|
|
329
282
|
* @param {number} year
|
|
@@ -331,12 +284,11 @@ function yearFromFixed(abs) {
|
|
|
331
284
|
* @param {number} day (1-31)
|
|
332
285
|
* @return {number}
|
|
333
286
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
287
|
function toFixed(year, month, day) {
|
|
337
288
|
var py = year - 1;
|
|
338
289
|
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;
|
|
339
290
|
}
|
|
291
|
+
|
|
340
292
|
/**
|
|
341
293
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
342
294
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
@@ -347,43 +299,35 @@ function toFixed(year, month, day) {
|
|
|
347
299
|
* @param {number} abs - R.D. number of days
|
|
348
300
|
* @return {Date}
|
|
349
301
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
302
|
function abs2greg(abs) {
|
|
353
303
|
if (typeof abs !== 'number') {
|
|
354
304
|
throw new TypeError("Argument not a Number: ".concat(abs));
|
|
355
305
|
}
|
|
356
|
-
|
|
357
306
|
abs = Math.trunc(abs);
|
|
358
307
|
/*
|
|
359
308
|
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
360
309
|
throw new RangeError(`Invalid Date: ${abs}`);
|
|
361
310
|
}
|
|
362
311
|
*/
|
|
363
|
-
|
|
364
312
|
var year = yearFromFixed(abs);
|
|
365
313
|
var priorDays = abs - toFixed(year, 1, 1);
|
|
366
314
|
var correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
|
|
367
315
|
var month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
368
316
|
var day = abs - toFixed(year, month, 1) + 1;
|
|
369
317
|
var dt = new Date(year, month - 1, day);
|
|
370
|
-
|
|
371
318
|
if (year < 100 && year >= 0) {
|
|
372
319
|
dt.setFullYear(year);
|
|
373
320
|
}
|
|
374
|
-
|
|
375
321
|
return dt;
|
|
376
322
|
}
|
|
377
323
|
|
|
378
324
|
/**
|
|
379
325
|
* Gregorian date helper functions.
|
|
380
326
|
*/
|
|
381
|
-
|
|
382
327
|
var greg = /*#__PURE__*/function () {
|
|
383
328
|
function greg() {
|
|
384
329
|
_classCallCheck(this, greg);
|
|
385
330
|
}
|
|
386
|
-
|
|
387
331
|
_createClass(greg, null, [{
|
|
388
332
|
key: "isLeapYear",
|
|
389
333
|
value:
|
|
@@ -401,68 +345,65 @@ var greg = /*#__PURE__*/function () {
|
|
|
401
345
|
function isLeapYear(year) {
|
|
402
346
|
return isLeapYear$1(year);
|
|
403
347
|
}
|
|
348
|
+
|
|
404
349
|
/**
|
|
405
350
|
* Number of days in the Gregorian month for given year
|
|
406
351
|
* @param {number} month Gregorian month (1=January, 12=December)
|
|
407
352
|
* @param {number} year Gregorian year
|
|
408
353
|
* @return {number}
|
|
409
354
|
*/
|
|
410
|
-
|
|
411
355
|
}, {
|
|
412
356
|
key: "daysInMonth",
|
|
413
357
|
value: function daysInMonth(month, year) {
|
|
414
358
|
return daysInMonth$1(month, year);
|
|
415
359
|
}
|
|
360
|
+
|
|
416
361
|
/**
|
|
417
362
|
* Returns true if the object is a Javascript Date
|
|
418
363
|
* @param {Object} obj
|
|
419
364
|
* @return {boolean}
|
|
420
365
|
*/
|
|
421
|
-
|
|
422
366
|
}, {
|
|
423
367
|
key: "isDate",
|
|
424
368
|
value: function isDate$1(obj) {
|
|
425
369
|
return isDate(obj);
|
|
426
370
|
}
|
|
371
|
+
|
|
427
372
|
/**
|
|
428
373
|
* Returns number of days since January 1 of that year
|
|
429
374
|
* @deprecated
|
|
430
375
|
* @param {Date} date Gregorian date
|
|
431
376
|
* @return {number}
|
|
432
377
|
*/
|
|
433
|
-
|
|
434
378
|
}, {
|
|
435
379
|
key: "dayOfYear",
|
|
436
380
|
value: function dayOfYear(date) {
|
|
437
381
|
if (!isDate(date)) {
|
|
438
382
|
throw new TypeError("Argument not a Date: ".concat(date));
|
|
439
383
|
}
|
|
440
|
-
|
|
441
384
|
var month = date.getMonth();
|
|
442
385
|
var doy = date.getDate() + 31 * month;
|
|
443
|
-
|
|
444
386
|
if (month > 1) {
|
|
445
387
|
// FEB
|
|
446
388
|
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
447
|
-
|
|
448
389
|
if (isLeapYear$1(date.getFullYear())) {
|
|
449
390
|
doy++;
|
|
450
391
|
}
|
|
451
392
|
}
|
|
452
|
-
|
|
453
393
|
return doy;
|
|
454
394
|
}
|
|
395
|
+
|
|
455
396
|
/**
|
|
456
397
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
457
398
|
* @param {Date} date Gregorian date
|
|
458
399
|
* @return {number}
|
|
459
400
|
*/
|
|
460
|
-
|
|
461
401
|
}, {
|
|
462
402
|
key: "greg2abs",
|
|
463
403
|
value: function greg2abs$1(date) {
|
|
464
404
|
return greg2abs(date);
|
|
465
405
|
}
|
|
406
|
+
|
|
466
407
|
/**
|
|
467
408
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
468
409
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
@@ -472,17 +413,14 @@ var greg = /*#__PURE__*/function () {
|
|
|
472
413
|
* @param {number} theDate - R.D. number of days
|
|
473
414
|
* @return {Date}
|
|
474
415
|
*/
|
|
475
|
-
|
|
476
416
|
}, {
|
|
477
417
|
key: "abs2greg",
|
|
478
418
|
value: function abs2greg$1(theDate) {
|
|
479
419
|
return abs2greg(theDate);
|
|
480
420
|
}
|
|
481
421
|
}]);
|
|
482
|
-
|
|
483
422
|
return greg;
|
|
484
423
|
}();
|
|
485
|
-
|
|
486
424
|
_defineProperty(greg, "monthNames", ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
|
|
487
425
|
|
|
488
426
|
var noopLocale = {
|
|
@@ -499,6 +437,7 @@ var alias = {
|
|
|
499
437
|
's': 'en',
|
|
500
438
|
'': 'en'
|
|
501
439
|
};
|
|
440
|
+
|
|
502
441
|
/**
|
|
503
442
|
* A locale in Hebcal is used for translations/transliterations of
|
|
504
443
|
* holidays. `@hebcal/core` supports four locales by default
|
|
@@ -507,16 +446,13 @@ var alias = {
|
|
|
507
446
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
508
447
|
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
509
448
|
*/
|
|
510
|
-
|
|
511
449
|
var Locale = /*#__PURE__*/function () {
|
|
512
450
|
function Locale() {
|
|
513
451
|
_classCallCheck(this, Locale);
|
|
514
452
|
}
|
|
515
|
-
|
|
516
453
|
_createClass(Locale, null, [{
|
|
517
454
|
key: "lookupTranslation",
|
|
518
|
-
value:
|
|
519
|
-
/** @private */
|
|
455
|
+
value: /** @private */
|
|
520
456
|
|
|
521
457
|
/** @private */
|
|
522
458
|
|
|
@@ -533,46 +469,42 @@ var Locale = /*#__PURE__*/function () {
|
|
|
533
469
|
var locale0 = locale && locale.toLowerCase();
|
|
534
470
|
var loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
|
|
535
471
|
var array = loc[id];
|
|
536
|
-
|
|
537
472
|
if (array && array.length && array[0].length) {
|
|
538
473
|
return array[0];
|
|
539
474
|
}
|
|
540
|
-
|
|
541
475
|
return undefined;
|
|
542
476
|
}
|
|
477
|
+
|
|
543
478
|
/**
|
|
544
479
|
* By default, if no translation was found, returns `id`.
|
|
545
480
|
* @param {string} id Message ID to translate
|
|
546
481
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
547
482
|
* @return {string}
|
|
548
483
|
*/
|
|
549
|
-
|
|
550
484
|
}, {
|
|
551
485
|
key: "gettext",
|
|
552
486
|
value: function gettext(id, locale) {
|
|
553
487
|
var text = this.lookupTranslation(id, locale);
|
|
554
|
-
|
|
555
488
|
if (typeof text == 'undefined') {
|
|
556
489
|
return id;
|
|
557
490
|
}
|
|
558
|
-
|
|
559
491
|
return text;
|
|
560
492
|
}
|
|
493
|
+
|
|
561
494
|
/**
|
|
562
495
|
* Register locale translations.
|
|
563
496
|
* @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
564
497
|
* @param {LocaleDate} data parsed data from a `.po` file.
|
|
565
498
|
*/
|
|
566
|
-
|
|
567
499
|
}, {
|
|
568
500
|
key: "addLocale",
|
|
569
501
|
value: function addLocale(locale, data) {
|
|
570
502
|
if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
|
|
571
503
|
throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
|
|
572
504
|
}
|
|
573
|
-
|
|
574
505
|
this.locales[locale.toLowerCase()] = data.contexts[''];
|
|
575
506
|
}
|
|
507
|
+
|
|
576
508
|
/**
|
|
577
509
|
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
578
510
|
* After setting the locale to be used, all strings marked for translations
|
|
@@ -580,57 +512,52 @@ var Locale = /*#__PURE__*/function () {
|
|
|
580
512
|
* @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
|
|
581
513
|
* @return {LocaleData}
|
|
582
514
|
*/
|
|
583
|
-
|
|
584
515
|
}, {
|
|
585
516
|
key: "useLocale",
|
|
586
517
|
value: function useLocale(locale) {
|
|
587
518
|
var locale0 = locale.toLowerCase();
|
|
588
519
|
var obj = this.locales[locale0];
|
|
589
|
-
|
|
590
520
|
if (!obj) {
|
|
591
521
|
throw new RangeError("Locale '".concat(locale, "' not found"));
|
|
592
522
|
}
|
|
593
|
-
|
|
594
523
|
this.activeName = alias[locale0] || locale0;
|
|
595
524
|
this.activeLocale = obj;
|
|
596
525
|
return this.activeLocale;
|
|
597
526
|
}
|
|
527
|
+
|
|
598
528
|
/**
|
|
599
529
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
600
530
|
* @return {string}
|
|
601
531
|
*/
|
|
602
|
-
|
|
603
532
|
}, {
|
|
604
533
|
key: "getLocaleName",
|
|
605
534
|
value: function getLocaleName() {
|
|
606
535
|
return this.activeName;
|
|
607
536
|
}
|
|
537
|
+
|
|
608
538
|
/**
|
|
609
539
|
* Returns the names of registered locales
|
|
610
540
|
* @return {string[]}
|
|
611
541
|
*/
|
|
612
|
-
|
|
613
542
|
}, {
|
|
614
543
|
key: "getLocaleNames",
|
|
615
544
|
value: function getLocaleNames() {
|
|
616
545
|
return Object.keys(this.locales).sort();
|
|
617
546
|
}
|
|
547
|
+
|
|
618
548
|
/**
|
|
619
549
|
* @param {number} n
|
|
620
550
|
* @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
621
551
|
* @return {string}
|
|
622
552
|
*/
|
|
623
|
-
|
|
624
553
|
}, {
|
|
625
554
|
key: "ordinal",
|
|
626
555
|
value: function ordinal(n, locale) {
|
|
627
556
|
var locale1 = locale && locale.toLowerCase();
|
|
628
557
|
var locale0 = locale1 || this.activeName;
|
|
629
|
-
|
|
630
558
|
if (!locale0) {
|
|
631
559
|
return this.getEnOrdinal(n);
|
|
632
560
|
}
|
|
633
|
-
|
|
634
561
|
switch (locale0) {
|
|
635
562
|
case 'en':
|
|
636
563
|
case 's':
|
|
@@ -640,25 +567,22 @@ var Locale = /*#__PURE__*/function () {
|
|
|
640
567
|
case 'ashkenazi_poylish':
|
|
641
568
|
case 'ashkenazi_standard':
|
|
642
569
|
return this.getEnOrdinal(n);
|
|
643
|
-
|
|
644
570
|
case 'es':
|
|
645
571
|
return n + 'º';
|
|
646
|
-
|
|
647
572
|
case 'h':
|
|
648
573
|
case 'he':
|
|
649
574
|
case 'he-x-nonikud':
|
|
650
575
|
return String(n);
|
|
651
|
-
|
|
652
576
|
default:
|
|
653
577
|
return n + '.';
|
|
654
578
|
}
|
|
655
579
|
}
|
|
580
|
+
|
|
656
581
|
/**
|
|
657
582
|
* @private
|
|
658
583
|
* @param {number} n
|
|
659
584
|
* @return {string}
|
|
660
585
|
*/
|
|
661
|
-
|
|
662
586
|
}, {
|
|
663
587
|
key: "getEnOrdinal",
|
|
664
588
|
value: function getEnOrdinal(n) {
|
|
@@ -666,28 +590,23 @@ var Locale = /*#__PURE__*/function () {
|
|
|
666
590
|
var v = n % 100;
|
|
667
591
|
return n + (s[(v - 20) % 10] || s[v] || s[0]);
|
|
668
592
|
}
|
|
593
|
+
|
|
669
594
|
/**
|
|
670
595
|
* Removes nekudot from Hebrew string
|
|
671
596
|
* @param {string} str
|
|
672
597
|
* @return {string}
|
|
673
598
|
*/
|
|
674
|
-
|
|
675
599
|
}, {
|
|
676
600
|
key: "hebrewStripNikkud",
|
|
677
601
|
value: function hebrewStripNikkud(str) {
|
|
678
602
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
679
603
|
}
|
|
680
604
|
}]);
|
|
681
|
-
|
|
682
605
|
return Locale;
|
|
683
606
|
}();
|
|
684
|
-
|
|
685
607
|
_defineProperty(Locale, "locales", Object.create(null));
|
|
686
|
-
|
|
687
608
|
_defineProperty(Locale, "activeLocale", null);
|
|
688
|
-
|
|
689
609
|
_defineProperty(Locale, "activeName", null);
|
|
690
|
-
|
|
691
610
|
Locale.addLocale('en', noopLocale);
|
|
692
611
|
Locale.addLocale('s', noopLocale);
|
|
693
612
|
Locale.addLocale('', noopLocale);
|
|
@@ -696,77 +615,67 @@ Locale.useLocale('en');
|
|
|
696
615
|
/*
|
|
697
616
|
* More minimal HDate
|
|
698
617
|
*/
|
|
699
|
-
var NISAN$1 = 1;
|
|
700
|
-
var IYYAR = 2; // const SIVAN = 3;
|
|
701
|
-
|
|
702
|
-
var TAMUZ = 4; // const AV = 5;
|
|
703
618
|
|
|
619
|
+
var NISAN$1 = 1;
|
|
620
|
+
var IYYAR = 2;
|
|
621
|
+
// const SIVAN = 3;
|
|
622
|
+
var TAMUZ = 4;
|
|
623
|
+
// const AV = 5;
|
|
704
624
|
var ELUL = 6;
|
|
705
625
|
var TISHREI = 7;
|
|
706
626
|
var CHESHVAN$1 = 8;
|
|
707
627
|
var KISLEV$1 = 9;
|
|
708
|
-
var TEVET$1 = 10;
|
|
709
|
-
|
|
628
|
+
var TEVET$1 = 10;
|
|
629
|
+
// const SHVAT = 11;
|
|
710
630
|
var ADAR_I$1 = 12;
|
|
711
631
|
var ADAR_II$1 = 13;
|
|
632
|
+
|
|
712
633
|
/**
|
|
713
634
|
* Hebrew months of the year (NISAN=1, TISHREI=7)
|
|
714
635
|
* @readonly
|
|
715
636
|
* @enum {number}
|
|
716
637
|
*/
|
|
717
|
-
|
|
718
638
|
var months = {
|
|
719
639
|
/** Nissan / ניסן */
|
|
720
640
|
NISAN: 1,
|
|
721
|
-
|
|
722
641
|
/** Iyyar / אייר */
|
|
723
642
|
IYYAR: 2,
|
|
724
|
-
|
|
725
643
|
/** Sivan / סיון */
|
|
726
644
|
SIVAN: 3,
|
|
727
|
-
|
|
728
645
|
/** Tamuz (sometimes Tammuz) / תמוז */
|
|
729
646
|
TAMUZ: 4,
|
|
730
|
-
|
|
731
647
|
/** Av / אב */
|
|
732
648
|
AV: 5,
|
|
733
|
-
|
|
734
649
|
/** Elul / אלול */
|
|
735
650
|
ELUL: 6,
|
|
736
|
-
|
|
737
651
|
/** Tishrei / תִשְׁרֵי */
|
|
738
652
|
TISHREI: 7,
|
|
739
|
-
|
|
740
653
|
/** Cheshvan / חשון */
|
|
741
654
|
CHESHVAN: 8,
|
|
742
|
-
|
|
743
655
|
/** Kislev / כסלו */
|
|
744
656
|
KISLEV: 9,
|
|
745
|
-
|
|
746
657
|
/** Tevet / טבת */
|
|
747
658
|
TEVET: 10,
|
|
748
|
-
|
|
749
659
|
/** Sh'vat / שבט */
|
|
750
660
|
SHVAT: 11,
|
|
751
|
-
|
|
752
661
|
/** Adar or Adar Rishon / אדר */
|
|
753
662
|
ADAR_I: 12,
|
|
754
|
-
|
|
755
663
|
/** Adar Sheini (only on leap years) / אדר ב׳ */
|
|
756
664
|
ADAR_II: 13
|
|
757
665
|
};
|
|
758
666
|
var monthNames0 = ['', 'Nisan', 'Iyyar', 'Sivan', 'Tamuz', 'Av', 'Elul', 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Sh\'vat'];
|
|
667
|
+
|
|
759
668
|
/**
|
|
760
669
|
* Transliterations of Hebrew month names.
|
|
761
670
|
* Regular years are index 0 and leap years are index 1.
|
|
762
671
|
* @private
|
|
763
672
|
*/
|
|
764
|
-
|
|
765
673
|
var monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
|
|
766
674
|
var edCache = Object.create(null);
|
|
767
|
-
var EPOCH = -1373428;
|
|
768
|
-
|
|
675
|
+
var EPOCH = -1373428;
|
|
676
|
+
// Avg year length in the cycle (19 solar years with 235 lunar months)
|
|
769
677
|
var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
678
|
+
|
|
770
679
|
/**
|
|
771
680
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
772
681
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
@@ -777,15 +686,12 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
|
|
|
777
686
|
* @param {number} day Hebrew date (1-30)
|
|
778
687
|
* @return {number}
|
|
779
688
|
*/
|
|
780
|
-
|
|
781
689
|
function hebrew2abs(year, month, day) {
|
|
782
690
|
var tempabs = day;
|
|
783
|
-
|
|
784
691
|
if (month < TISHREI) {
|
|
785
692
|
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
786
693
|
tempabs += daysInMonth(m, year);
|
|
787
694
|
}
|
|
788
|
-
|
|
789
695
|
for (var _m = NISAN$1; _m < month; _m++) {
|
|
790
696
|
tempabs += daysInMonth(_m, year);
|
|
791
697
|
}
|
|
@@ -794,46 +700,40 @@ function hebrew2abs(year, month, day) {
|
|
|
794
700
|
tempabs += daysInMonth(_m2, year);
|
|
795
701
|
}
|
|
796
702
|
}
|
|
797
|
-
|
|
798
703
|
return EPOCH + elapsedDays(year) + tempabs - 1;
|
|
799
704
|
}
|
|
705
|
+
|
|
800
706
|
/**
|
|
801
707
|
* @private
|
|
802
708
|
* @param {number} year
|
|
803
709
|
* @return {number}
|
|
804
710
|
*/
|
|
805
|
-
|
|
806
711
|
function newYear(year) {
|
|
807
712
|
return EPOCH + elapsedDays(year);
|
|
808
713
|
}
|
|
714
|
+
|
|
809
715
|
/**
|
|
810
716
|
* Converts absolute R.D. days to Hebrew date
|
|
811
717
|
* @private
|
|
812
718
|
* @param {number} abs absolute R.D. days
|
|
813
719
|
* @return {SimpleHebrewDate}
|
|
814
720
|
*/
|
|
815
|
-
|
|
816
|
-
|
|
817
721
|
function abs2hebrew(abs) {
|
|
818
722
|
if (typeof abs !== 'number' || isNaN(abs)) {
|
|
819
723
|
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
820
724
|
}
|
|
725
|
+
abs = Math.trunc(abs);
|
|
821
726
|
|
|
822
|
-
|
|
823
|
-
|
|
727
|
+
// first, quickly approximate year
|
|
824
728
|
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
825
|
-
|
|
826
729
|
while (newYear(year) <= abs) {
|
|
827
730
|
++year;
|
|
828
731
|
}
|
|
829
|
-
|
|
830
732
|
--year;
|
|
831
733
|
var month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
832
|
-
|
|
833
734
|
while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
|
|
834
735
|
++month;
|
|
835
736
|
}
|
|
836
|
-
|
|
837
737
|
var day = 1 + abs - hebrew2abs(year, month, 1);
|
|
838
738
|
return {
|
|
839
739
|
yy: year,
|
|
@@ -841,26 +741,27 @@ function abs2hebrew(abs) {
|
|
|
841
741
|
dd: day
|
|
842
742
|
};
|
|
843
743
|
}
|
|
744
|
+
|
|
844
745
|
/**
|
|
845
746
|
* Returns true if Hebrew year is a leap year
|
|
846
747
|
* @private
|
|
847
748
|
* @param {number} year Hebrew year
|
|
848
749
|
* @return {boolean}
|
|
849
750
|
*/
|
|
850
|
-
|
|
851
751
|
function isLeapYear(year) {
|
|
852
752
|
return (1 + year * 7) % 19 < 7;
|
|
853
753
|
}
|
|
754
|
+
|
|
854
755
|
/**
|
|
855
756
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
856
757
|
* @private
|
|
857
758
|
* @param {number} year Hebrew year
|
|
858
759
|
* @return {number}
|
|
859
760
|
*/
|
|
860
|
-
|
|
861
761
|
function monthsInYear(year) {
|
|
862
762
|
return 12 + isLeapYear(year); // boolean is cast to 1 or 0
|
|
863
763
|
}
|
|
764
|
+
|
|
864
765
|
/**
|
|
865
766
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
866
767
|
* @private
|
|
@@ -868,7 +769,6 @@ function monthsInYear(year) {
|
|
|
868
769
|
* @param {number} year Hebrew year
|
|
869
770
|
* @return {number}
|
|
870
771
|
*/
|
|
871
|
-
|
|
872
772
|
function daysInMonth(month, year) {
|
|
873
773
|
switch (month) {
|
|
874
774
|
case IYYAR:
|
|
@@ -878,13 +778,13 @@ function daysInMonth(month, year) {
|
|
|
878
778
|
case ADAR_II$1:
|
|
879
779
|
return 29;
|
|
880
780
|
}
|
|
881
|
-
|
|
882
781
|
if (month === ADAR_I$1 && !isLeapYear(year) || month === CHESHVAN$1 && !longCheshvan(year) || month === KISLEV$1 && shortKislev(year)) {
|
|
883
782
|
return 29;
|
|
884
783
|
} else {
|
|
885
784
|
return 30;
|
|
886
785
|
}
|
|
887
786
|
}
|
|
787
|
+
|
|
888
788
|
/**
|
|
889
789
|
* Returns a transliterated string name of Hebrew month in year,
|
|
890
790
|
* for example 'Elul' or 'Cheshvan'.
|
|
@@ -893,14 +793,13 @@ function daysInMonth(month, year) {
|
|
|
893
793
|
* @param {number} year Hebrew year
|
|
894
794
|
* @return {string}
|
|
895
795
|
*/
|
|
896
|
-
|
|
897
796
|
function getMonthName(month, year) {
|
|
898
797
|
if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
|
|
899
798
|
throw new TypeError("bad month argument ".concat(month));
|
|
900
799
|
}
|
|
901
|
-
|
|
902
800
|
return monthNames[+isLeapYear(year)][month];
|
|
903
801
|
}
|
|
802
|
+
|
|
904
803
|
/**
|
|
905
804
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
906
805
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -908,11 +807,11 @@ function getMonthName(month, year) {
|
|
|
908
807
|
* @param {number} year Hebrew year
|
|
909
808
|
* @return {number}
|
|
910
809
|
*/
|
|
911
|
-
|
|
912
810
|
function elapsedDays(year) {
|
|
913
811
|
var elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
|
|
914
812
|
return elapsed;
|
|
915
813
|
}
|
|
814
|
+
|
|
916
815
|
/**
|
|
917
816
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
918
817
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -920,11 +819,12 @@ function elapsedDays(year) {
|
|
|
920
819
|
* @param {number} year Hebrew year
|
|
921
820
|
* @return {number}
|
|
922
821
|
*/
|
|
923
|
-
|
|
924
822
|
function elapsedDays0(year) {
|
|
925
823
|
var prevYear = year - 1;
|
|
926
|
-
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
927
|
-
|
|
824
|
+
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
825
|
+
// Months in complete 19 year lunar (Metonic) cycles so far
|
|
826
|
+
12 * (prevYear % 19) +
|
|
827
|
+
// Regular months in this cycle
|
|
928
828
|
Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
|
|
929
829
|
|
|
930
830
|
var pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
@@ -934,6 +834,7 @@ function elapsedDays0(year) {
|
|
|
934
834
|
var altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
|
|
935
835
|
return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
|
|
936
836
|
}
|
|
837
|
+
|
|
937
838
|
/**
|
|
938
839
|
* Number of days in the hebrew YEAR.
|
|
939
840
|
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
@@ -942,36 +843,34 @@ function elapsedDays0(year) {
|
|
|
942
843
|
* @param {number} year Hebrew year
|
|
943
844
|
* @return {number}
|
|
944
845
|
*/
|
|
945
|
-
|
|
946
|
-
|
|
947
846
|
function daysInYear(year) {
|
|
948
847
|
return elapsedDays(year + 1) - elapsedDays(year);
|
|
949
848
|
}
|
|
849
|
+
|
|
950
850
|
/**
|
|
951
851
|
* true if Cheshvan is long in Hebrew year
|
|
952
852
|
* @private
|
|
953
853
|
* @param {number} year Hebrew year
|
|
954
854
|
* @return {boolean}
|
|
955
855
|
*/
|
|
956
|
-
|
|
957
856
|
function longCheshvan(year) {
|
|
958
857
|
return daysInYear(year) % 10 === 5;
|
|
959
858
|
}
|
|
859
|
+
|
|
960
860
|
/**
|
|
961
861
|
* true if Kislev is short in Hebrew year
|
|
962
862
|
* @private
|
|
963
863
|
* @param {number} year Hebrew year
|
|
964
864
|
* @return {boolean}
|
|
965
865
|
*/
|
|
966
|
-
|
|
967
866
|
function shortKislev(year) {
|
|
968
867
|
return daysInYear(year) % 10 === 3;
|
|
969
868
|
}
|
|
970
869
|
|
|
870
|
+
// eslint-disable-next-line require-jsdoc
|
|
971
871
|
function throwTypeError(msg) {
|
|
972
872
|
throw new TypeError(msg);
|
|
973
873
|
}
|
|
974
|
-
|
|
975
874
|
var UNITS_DAY = 'day';
|
|
976
875
|
var UNITS_WEEK = 'week';
|
|
977
876
|
var UNITS_MONTH = 'month';
|
|
@@ -988,6 +887,7 @@ var UNITS_VALID = {
|
|
|
988
887
|
month: UNITS_MONTH,
|
|
989
888
|
year: UNITS_YEAR
|
|
990
889
|
};
|
|
890
|
+
|
|
991
891
|
/**
|
|
992
892
|
* A simple Hebrew date object with numeric fields `yy`, `mm`, and `dd`
|
|
993
893
|
* @typedef {Object} SimpleHebrewDate
|
|
@@ -998,7 +898,6 @@ var UNITS_VALID = {
|
|
|
998
898
|
*/
|
|
999
899
|
|
|
1000
900
|
/** Represents a Hebrew date */
|
|
1001
|
-
|
|
1002
901
|
var HDate = /*#__PURE__*/function () {
|
|
1003
902
|
/**
|
|
1004
903
|
* Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
|
|
@@ -1032,14 +931,11 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1032
931
|
*/
|
|
1033
932
|
function HDate(day, month, year) {
|
|
1034
933
|
_classCallCheck(this, HDate);
|
|
1035
|
-
|
|
1036
934
|
if (arguments.length == 2 || arguments.length > 3) {
|
|
1037
935
|
throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');
|
|
1038
936
|
}
|
|
1039
|
-
|
|
1040
937
|
if (arguments.length == 3) {
|
|
1041
938
|
// Hebrew day, Hebrew month, Hebrew year
|
|
1042
|
-
|
|
1043
939
|
/**
|
|
1044
940
|
* @private
|
|
1045
941
|
* @type {number}
|
|
@@ -1049,30 +945,23 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1049
945
|
* @private
|
|
1050
946
|
* @type {number}
|
|
1051
947
|
*/
|
|
1052
|
-
|
|
1053
948
|
year = parseInt(year, 10);
|
|
1054
|
-
|
|
1055
949
|
if (isNaN(year)) {
|
|
1056
950
|
throw new TypeError("HDate called with bad year argument: ".concat(year));
|
|
1057
951
|
}
|
|
1058
|
-
|
|
1059
952
|
this.year = year;
|
|
1060
953
|
this.setMonth(month); // will throw if we can't parse
|
|
1061
|
-
|
|
1062
954
|
day = parseInt(day, 10);
|
|
1063
|
-
|
|
1064
955
|
if (isNaN(day)) {
|
|
1065
956
|
throw new TypeError("HDate called with bad day argument: ".concat(day));
|
|
1066
957
|
}
|
|
1067
|
-
|
|
1068
958
|
this.setDate(day);
|
|
1069
959
|
} else {
|
|
1070
960
|
// 0 arguments
|
|
1071
961
|
if (typeof day === 'undefined') {
|
|
1072
962
|
day = new Date();
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
|
|
963
|
+
}
|
|
964
|
+
// 1 argument
|
|
1076
965
|
var abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
|
|
1077
966
|
dd: day.day,
|
|
1078
967
|
mm: day.month,
|
|
@@ -1084,21 +973,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1084
973
|
* @private
|
|
1085
974
|
* @type {number}
|
|
1086
975
|
*/
|
|
1087
|
-
|
|
1088
976
|
this.day = d.dd;
|
|
1089
977
|
/**
|
|
1090
978
|
* @private
|
|
1091
979
|
* @type {number}
|
|
1092
980
|
*/
|
|
1093
|
-
|
|
1094
981
|
this.month = d.mm;
|
|
1095
982
|
/**
|
|
1096
983
|
* @private
|
|
1097
984
|
* @type {number}
|
|
1098
985
|
*/
|
|
1099
|
-
|
|
1100
986
|
this.year = d.yy;
|
|
1101
|
-
|
|
1102
987
|
if (isNumber) {
|
|
1103
988
|
/**
|
|
1104
989
|
* @private
|
|
@@ -1108,79 +993,78 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1108
993
|
}
|
|
1109
994
|
}
|
|
1110
995
|
}
|
|
996
|
+
|
|
1111
997
|
/**
|
|
1112
998
|
* Gets the Hebrew year of this Hebrew date
|
|
1113
999
|
* @return {number}
|
|
1114
1000
|
*/
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
1001
|
_createClass(HDate, [{
|
|
1118
1002
|
key: "getFullYear",
|
|
1119
1003
|
value: function getFullYear() {
|
|
1120
1004
|
return this.year;
|
|
1121
1005
|
}
|
|
1006
|
+
|
|
1122
1007
|
/**
|
|
1123
1008
|
* Tests if this date occurs during a leap year
|
|
1124
1009
|
* @return {boolean}
|
|
1125
1010
|
*/
|
|
1126
|
-
|
|
1127
1011
|
}, {
|
|
1128
1012
|
key: "isLeapYear",
|
|
1129
1013
|
value: function isLeapYear$1() {
|
|
1130
1014
|
return isLeapYear(this.year);
|
|
1131
1015
|
}
|
|
1016
|
+
|
|
1132
1017
|
/**
|
|
1133
1018
|
* Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
1134
1019
|
* @return {number}
|
|
1135
1020
|
*/
|
|
1136
|
-
|
|
1137
1021
|
}, {
|
|
1138
1022
|
key: "getMonth",
|
|
1139
1023
|
value: function getMonth() {
|
|
1140
1024
|
return this.month;
|
|
1141
1025
|
}
|
|
1026
|
+
|
|
1142
1027
|
/**
|
|
1143
1028
|
* The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
|
|
1144
1029
|
* @return {number}
|
|
1145
1030
|
*/
|
|
1146
|
-
|
|
1147
1031
|
}, {
|
|
1148
1032
|
key: "getTishreiMonth",
|
|
1149
1033
|
value: function getTishreiMonth() {
|
|
1150
1034
|
var nummonths = monthsInYear(this.getFullYear());
|
|
1151
|
-
|
|
1152
1035
|
return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
|
|
1153
1036
|
}
|
|
1037
|
+
|
|
1154
1038
|
/**
|
|
1155
1039
|
* Number of days in the month of this Hebrew date
|
|
1156
1040
|
* @return {number}
|
|
1157
1041
|
*/
|
|
1158
|
-
|
|
1159
1042
|
}, {
|
|
1160
1043
|
key: "daysInMonth",
|
|
1161
1044
|
value: function daysInMonth$1() {
|
|
1162
1045
|
return daysInMonth(this.getMonth(), this.getFullYear());
|
|
1163
1046
|
}
|
|
1047
|
+
|
|
1164
1048
|
/**
|
|
1165
1049
|
* Gets the day within the month (1-30)
|
|
1166
1050
|
* @return {number}
|
|
1167
1051
|
*/
|
|
1168
|
-
|
|
1169
1052
|
}, {
|
|
1170
1053
|
key: "getDate",
|
|
1171
1054
|
value: function getDate() {
|
|
1172
1055
|
return this.day;
|
|
1173
1056
|
}
|
|
1057
|
+
|
|
1174
1058
|
/**
|
|
1175
1059
|
* Gets the day of the week. 0=Sunday, 6=Saturday
|
|
1176
1060
|
* @return {number}
|
|
1177
1061
|
*/
|
|
1178
|
-
|
|
1179
1062
|
}, {
|
|
1180
1063
|
key: "getDay",
|
|
1181
1064
|
value: function getDay() {
|
|
1182
1065
|
return mod(this.abs(), 7);
|
|
1183
1066
|
}
|
|
1067
|
+
|
|
1184
1068
|
/**
|
|
1185
1069
|
* Sets the year of the date. Returns the object it was called upon.
|
|
1186
1070
|
* @private
|
|
@@ -1188,7 +1072,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1188
1072
|
* @param {number} year
|
|
1189
1073
|
* @return {HDate}
|
|
1190
1074
|
*/
|
|
1191
|
-
|
|
1192
1075
|
}, {
|
|
1193
1076
|
key: "setFullYear",
|
|
1194
1077
|
value: function setFullYear(year) {
|
|
@@ -1196,13 +1079,13 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1196
1079
|
fix(this);
|
|
1197
1080
|
return this;
|
|
1198
1081
|
}
|
|
1082
|
+
|
|
1199
1083
|
/**
|
|
1200
1084
|
* Sets the day of the month of the date. Returns the object it was called upon
|
|
1201
1085
|
* @private
|
|
1202
1086
|
* @param {number} month
|
|
1203
1087
|
* @return {HDate}
|
|
1204
1088
|
*/
|
|
1205
|
-
|
|
1206
1089
|
}, {
|
|
1207
1090
|
key: "setMonth",
|
|
1208
1091
|
value: function setMonth(month) {
|
|
@@ -1210,12 +1093,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1210
1093
|
fix(this);
|
|
1211
1094
|
return this;
|
|
1212
1095
|
}
|
|
1096
|
+
|
|
1213
1097
|
/**
|
|
1214
1098
|
* @private
|
|
1215
1099
|
* @param {number} date
|
|
1216
1100
|
* @return {HDate}
|
|
1217
1101
|
*/
|
|
1218
|
-
|
|
1219
1102
|
}, {
|
|
1220
1103
|
key: "setDate",
|
|
1221
1104
|
value: function setDate(date) {
|
|
@@ -1223,16 +1106,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1223
1106
|
fix(this);
|
|
1224
1107
|
return this;
|
|
1225
1108
|
}
|
|
1109
|
+
|
|
1226
1110
|
/**
|
|
1227
1111
|
* Converts to Gregorian date
|
|
1228
1112
|
* @return {Date}
|
|
1229
1113
|
*/
|
|
1230
|
-
|
|
1231
1114
|
}, {
|
|
1232
1115
|
key: "greg",
|
|
1233
1116
|
value: function greg() {
|
|
1234
1117
|
return abs2greg(this.abs());
|
|
1235
1118
|
}
|
|
1119
|
+
|
|
1236
1120
|
/**
|
|
1237
1121
|
* Returns R.D. (Rata Die) fixed days.
|
|
1238
1122
|
* R.D. 1 == Monday, January 1, 1 (Gregorian)
|
|
@@ -1240,16 +1124,15 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1240
1124
|
* https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
|
|
1241
1125
|
* @return {number}
|
|
1242
1126
|
*/
|
|
1243
|
-
|
|
1244
1127
|
}, {
|
|
1245
1128
|
key: "abs",
|
|
1246
1129
|
value: function abs() {
|
|
1247
1130
|
if (typeof this.abs0 !== 'number') {
|
|
1248
1131
|
this.abs0 = hebrew2abs(this.year, this.month, this.day);
|
|
1249
1132
|
}
|
|
1250
|
-
|
|
1251
1133
|
return this.abs0;
|
|
1252
1134
|
}
|
|
1135
|
+
|
|
1253
1136
|
/**
|
|
1254
1137
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
1255
1138
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
@@ -1259,7 +1142,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1259
1142
|
* @param {number} day Hebrew date (1-30)
|
|
1260
1143
|
* @return {number}
|
|
1261
1144
|
*/
|
|
1262
|
-
|
|
1263
1145
|
}, {
|
|
1264
1146
|
key: "getMonthName",
|
|
1265
1147
|
value:
|
|
@@ -1270,6 +1152,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1270
1152
|
function getMonthName$1() {
|
|
1271
1153
|
return getMonthName(this.getMonth(), this.getFullYear());
|
|
1272
1154
|
}
|
|
1155
|
+
|
|
1273
1156
|
/**
|
|
1274
1157
|
* Renders this Hebrew date as a translated or transliterated string,
|
|
1275
1158
|
* including ordinal e.g. `'15th of Cheshvan, 5769'`.
|
|
@@ -1283,7 +1166,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1283
1166
|
* @param {boolean} [showYear=true] Display year (defaults to true).
|
|
1284
1167
|
* @return {string}
|
|
1285
1168
|
*/
|
|
1286
|
-
|
|
1287
1169
|
}, {
|
|
1288
1170
|
key: "render",
|
|
1289
1171
|
value: function render() {
|
|
@@ -1295,7 +1177,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1295
1177
|
var nth = Locale.ordinal(day, locale0);
|
|
1296
1178
|
var dayOf = HDate.getDayOfTranslation(locale0);
|
|
1297
1179
|
var dateStr = "".concat(nth).concat(dayOf, " ").concat(monthName);
|
|
1298
|
-
|
|
1299
1180
|
if (showYear) {
|
|
1300
1181
|
var fullYear = this.getFullYear();
|
|
1301
1182
|
return "".concat(dateStr, ", ").concat(fullYear);
|
|
@@ -1303,12 +1184,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1303
1184
|
return dateStr;
|
|
1304
1185
|
}
|
|
1305
1186
|
}
|
|
1187
|
+
|
|
1306
1188
|
/**
|
|
1307
1189
|
* @private
|
|
1308
1190
|
* @param {string} locale
|
|
1309
1191
|
* @return {string}
|
|
1310
1192
|
*/
|
|
1311
|
-
|
|
1312
1193
|
}, {
|
|
1313
1194
|
key: "renderGematriya",
|
|
1314
1195
|
value:
|
|
@@ -1326,6 +1207,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1326
1207
|
var y = this.getFullYear();
|
|
1327
1208
|
return gematriya(d) + ' ' + m + ' ' + gematriya(y);
|
|
1328
1209
|
}
|
|
1210
|
+
|
|
1329
1211
|
/**
|
|
1330
1212
|
* Returns an `HDate` representing the a dayNumber before the current date.
|
|
1331
1213
|
* Sunday=0, Saturday=6
|
|
@@ -1334,12 +1216,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1334
1216
|
* @param {number} day day of week
|
|
1335
1217
|
* @return {HDate}
|
|
1336
1218
|
*/
|
|
1337
|
-
|
|
1338
1219
|
}, {
|
|
1339
1220
|
key: "before",
|
|
1340
1221
|
value: function before(day) {
|
|
1341
1222
|
return _onOrBefore(day, this, -1);
|
|
1342
1223
|
}
|
|
1224
|
+
|
|
1343
1225
|
/**
|
|
1344
1226
|
* Returns an `HDate` representing the a dayNumber on or before the current date.
|
|
1345
1227
|
* Sunday=0, Saturday=6
|
|
@@ -1350,12 +1232,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1350
1232
|
* @param {number} dow day of week
|
|
1351
1233
|
* @return {HDate}
|
|
1352
1234
|
*/
|
|
1353
|
-
|
|
1354
1235
|
}, {
|
|
1355
1236
|
key: "onOrBefore",
|
|
1356
1237
|
value: function onOrBefore(dow) {
|
|
1357
1238
|
return _onOrBefore(dow, this, 0);
|
|
1358
1239
|
}
|
|
1240
|
+
|
|
1359
1241
|
/**
|
|
1360
1242
|
* Returns an `HDate` representing the nearest dayNumber to the current date
|
|
1361
1243
|
* Sunday=0, Saturday=6
|
|
@@ -1365,12 +1247,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1365
1247
|
* @param {number} dow day of week
|
|
1366
1248
|
* @return {HDate}
|
|
1367
1249
|
*/
|
|
1368
|
-
|
|
1369
1250
|
}, {
|
|
1370
1251
|
key: "nearest",
|
|
1371
1252
|
value: function nearest(dow) {
|
|
1372
1253
|
return _onOrBefore(dow, this, 3);
|
|
1373
1254
|
}
|
|
1255
|
+
|
|
1374
1256
|
/**
|
|
1375
1257
|
* Returns an `HDate` representing the a dayNumber on or after the current date.
|
|
1376
1258
|
* Sunday=0, Saturday=6
|
|
@@ -1381,12 +1263,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1381
1263
|
* @param {number} dow day of week
|
|
1382
1264
|
* @return {HDate}
|
|
1383
1265
|
*/
|
|
1384
|
-
|
|
1385
1266
|
}, {
|
|
1386
1267
|
key: "onOrAfter",
|
|
1387
1268
|
value: function onOrAfter(dow) {
|
|
1388
1269
|
return _onOrBefore(dow, this, 6);
|
|
1389
1270
|
}
|
|
1271
|
+
|
|
1390
1272
|
/**
|
|
1391
1273
|
* Returns an `HDate` representing the a dayNumber after the current date.
|
|
1392
1274
|
* Sunday=0, Saturday=6
|
|
@@ -1397,32 +1279,32 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1397
1279
|
* @param {number} day day of week
|
|
1398
1280
|
* @return {HDate}
|
|
1399
1281
|
*/
|
|
1400
|
-
|
|
1401
1282
|
}, {
|
|
1402
1283
|
key: "after",
|
|
1403
1284
|
value: function after(day) {
|
|
1404
1285
|
return _onOrBefore(day, this, 7);
|
|
1405
1286
|
}
|
|
1287
|
+
|
|
1406
1288
|
/**
|
|
1407
1289
|
* Returns the next Hebrew date
|
|
1408
1290
|
* @return {HDate}
|
|
1409
1291
|
*/
|
|
1410
|
-
|
|
1411
1292
|
}, {
|
|
1412
1293
|
key: "next",
|
|
1413
1294
|
value: function next() {
|
|
1414
1295
|
return new HDate(this.abs() + 1);
|
|
1415
1296
|
}
|
|
1297
|
+
|
|
1416
1298
|
/**
|
|
1417
1299
|
* Returns the previous Hebrew date
|
|
1418
1300
|
* @return {HDate}
|
|
1419
1301
|
*/
|
|
1420
|
-
|
|
1421
1302
|
}, {
|
|
1422
1303
|
key: "prev",
|
|
1423
1304
|
value: function prev() {
|
|
1424
1305
|
return new HDate(this.abs() - 1);
|
|
1425
1306
|
}
|
|
1307
|
+
|
|
1426
1308
|
/**
|
|
1427
1309
|
* Returns a cloned `HDate` object with a specified amount of time added
|
|
1428
1310
|
*
|
|
@@ -1439,19 +1321,15 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1439
1321
|
* @param {string} [units]
|
|
1440
1322
|
* @return {HDate}
|
|
1441
1323
|
*/
|
|
1442
|
-
|
|
1443
1324
|
}, {
|
|
1444
1325
|
key: "add",
|
|
1445
1326
|
value: function add(number) {
|
|
1446
1327
|
var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
1447
1328
|
number = parseInt(number, 10);
|
|
1448
|
-
|
|
1449
1329
|
if (!number) {
|
|
1450
1330
|
return new HDate(this);
|
|
1451
1331
|
}
|
|
1452
|
-
|
|
1453
1332
|
units = HDate.standardizeUnits(units);
|
|
1454
|
-
|
|
1455
1333
|
if (units === UNITS_DAY) {
|
|
1456
1334
|
return new HDate(this.abs() + number);
|
|
1457
1335
|
} else if (units === UNITS_WEEK) {
|
|
@@ -1462,20 +1340,18 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1462
1340
|
var hd = new HDate(this);
|
|
1463
1341
|
var sign = number > 0 ? 1 : -1;
|
|
1464
1342
|
number = Math.abs(number);
|
|
1465
|
-
|
|
1466
1343
|
for (var i = 0; i < number; i++) {
|
|
1467
1344
|
hd = new HDate(hd.abs() + sign * hd.daysInMonth());
|
|
1468
1345
|
}
|
|
1469
|
-
|
|
1470
1346
|
return hd;
|
|
1471
1347
|
}
|
|
1472
1348
|
}
|
|
1349
|
+
|
|
1473
1350
|
/**
|
|
1474
1351
|
* @private
|
|
1475
1352
|
* @param {string} units
|
|
1476
1353
|
* @return {string}
|
|
1477
1354
|
*/
|
|
1478
|
-
|
|
1479
1355
|
}, {
|
|
1480
1356
|
key: "subtract",
|
|
1481
1357
|
value:
|
|
@@ -1505,6 +1381,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1505
1381
|
var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
1506
1382
|
return this.add(number * -1, units);
|
|
1507
1383
|
}
|
|
1384
|
+
|
|
1508
1385
|
/**
|
|
1509
1386
|
* Returns the difference in days between the two given HDates.
|
|
1510
1387
|
*
|
|
@@ -1522,33 +1399,30 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1522
1399
|
* @param {HDate} other Hebrew date to compare
|
|
1523
1400
|
* @return {number}
|
|
1524
1401
|
*/
|
|
1525
|
-
|
|
1526
1402
|
}, {
|
|
1527
1403
|
key: "deltaDays",
|
|
1528
1404
|
value: function deltaDays(other) {
|
|
1529
1405
|
if (!HDate.isHDate(other)) {
|
|
1530
1406
|
throw new TypeError("Bad argument: ".concat(other));
|
|
1531
1407
|
}
|
|
1532
|
-
|
|
1533
1408
|
return this.abs() - other.abs();
|
|
1534
1409
|
}
|
|
1410
|
+
|
|
1535
1411
|
/**
|
|
1536
1412
|
* Compares this date to another date, returning `true` if the dates match.
|
|
1537
1413
|
* @param {HDate} other Hebrew date to compare
|
|
1538
1414
|
* @return {boolean}
|
|
1539
1415
|
*/
|
|
1540
|
-
|
|
1541
1416
|
}, {
|
|
1542
1417
|
key: "isSameDate",
|
|
1543
1418
|
value: function isSameDate(other) {
|
|
1544
1419
|
if (HDate.isHDate(other)) {
|
|
1545
1420
|
return this.year == other.year && this.month == other.month && this.day == other.day;
|
|
1546
1421
|
}
|
|
1547
|
-
|
|
1548
1422
|
return false;
|
|
1549
1423
|
}
|
|
1550
|
-
/** @return {string} */
|
|
1551
1424
|
|
|
1425
|
+
/** @return {string} */
|
|
1552
1426
|
}, {
|
|
1553
1427
|
key: "toString",
|
|
1554
1428
|
value: function toString() {
|
|
@@ -1557,24 +1431,24 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1557
1431
|
var monthName = this.getMonthName();
|
|
1558
1432
|
return "".concat(day, " ").concat(monthName, " ").concat(fullYear);
|
|
1559
1433
|
}
|
|
1434
|
+
|
|
1560
1435
|
/**
|
|
1561
1436
|
* Returns true if Hebrew year is a leap year
|
|
1562
1437
|
* @param {number} year Hebrew year
|
|
1563
1438
|
* @return {boolean}
|
|
1564
1439
|
*/
|
|
1565
|
-
|
|
1566
1440
|
}], [{
|
|
1567
1441
|
key: "hebrew2abs",
|
|
1568
1442
|
value: function hebrew2abs$1(year, month, day) {
|
|
1569
1443
|
return hebrew2abs(year, month, day);
|
|
1570
1444
|
}
|
|
1445
|
+
|
|
1571
1446
|
/**
|
|
1572
1447
|
* Converts absolute R.D. days to Hebrew date
|
|
1573
1448
|
* @private
|
|
1574
1449
|
* @param {number} abs absolute R.D. days
|
|
1575
1450
|
* @return {SimpleHebrewDate}
|
|
1576
1451
|
*/
|
|
1577
|
-
|
|
1578
1452
|
}, {
|
|
1579
1453
|
key: "abs2hebrew",
|
|
1580
1454
|
value: function abs2hebrew$1(abs) {
|
|
@@ -1590,17 +1464,13 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1590
1464
|
case 'ashkenazi':
|
|
1591
1465
|
return ' of';
|
|
1592
1466
|
}
|
|
1593
|
-
|
|
1594
1467
|
var ofStr = Locale.lookupTranslation('of', locale);
|
|
1595
|
-
|
|
1596
1468
|
if (ofStr) {
|
|
1597
1469
|
return ' ' + ofStr;
|
|
1598
1470
|
}
|
|
1599
|
-
|
|
1600
1471
|
if ('ashkenazi' === locale.substring(0, 9)) {
|
|
1601
1472
|
return ' of';
|
|
1602
1473
|
}
|
|
1603
|
-
|
|
1604
1474
|
return '';
|
|
1605
1475
|
}
|
|
1606
1476
|
}, {
|
|
@@ -1614,29 +1484,30 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1614
1484
|
value: function isLeapYear$1(year) {
|
|
1615
1485
|
return isLeapYear(year);
|
|
1616
1486
|
}
|
|
1487
|
+
|
|
1617
1488
|
/**
|
|
1618
1489
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
1619
1490
|
* @param {number} year Hebrew year
|
|
1620
1491
|
* @return {number}
|
|
1621
1492
|
*/
|
|
1622
|
-
|
|
1623
1493
|
}, {
|
|
1624
1494
|
key: "monthsInYear",
|
|
1625
1495
|
value: function monthsInYear$1(year) {
|
|
1626
1496
|
return monthsInYear(year);
|
|
1627
1497
|
}
|
|
1498
|
+
|
|
1628
1499
|
/**
|
|
1629
1500
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
1630
1501
|
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
1631
1502
|
* @param {number} year Hebrew year
|
|
1632
1503
|
* @return {number}
|
|
1633
1504
|
*/
|
|
1634
|
-
|
|
1635
1505
|
}, {
|
|
1636
1506
|
key: "daysInMonth",
|
|
1637
1507
|
value: function daysInMonth$1(month, year) {
|
|
1638
1508
|
return daysInMonth(month, year);
|
|
1639
1509
|
}
|
|
1510
|
+
|
|
1640
1511
|
/**
|
|
1641
1512
|
* Returns a transliterated string name of Hebrew month in year,
|
|
1642
1513
|
* for example 'Elul' or 'Cheshvan'.
|
|
@@ -1644,18 +1515,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1644
1515
|
* @param {number} year Hebrew year
|
|
1645
1516
|
* @return {string}
|
|
1646
1517
|
*/
|
|
1647
|
-
|
|
1648
1518
|
}, {
|
|
1649
1519
|
key: "getMonthName",
|
|
1650
1520
|
value: function getMonthName$1(month, year) {
|
|
1651
1521
|
return getMonthName(month, year);
|
|
1652
1522
|
}
|
|
1523
|
+
|
|
1653
1524
|
/**
|
|
1654
1525
|
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
1655
1526
|
* @param {number|string} month A number, or Hebrew month name string
|
|
1656
1527
|
* @return {number}
|
|
1657
1528
|
*/
|
|
1658
|
-
|
|
1659
1529
|
}, {
|
|
1660
1530
|
key: "monthNum",
|
|
1661
1531
|
value: function monthNum(month) {
|
|
@@ -1663,53 +1533,50 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1663
1533
|
if (isNaN(month) || month > 14) {
|
|
1664
1534
|
throw new RangeError("Invalid month number: ".concat(month));
|
|
1665
1535
|
}
|
|
1666
|
-
|
|
1667
1536
|
return month;
|
|
1668
1537
|
}
|
|
1669
|
-
|
|
1670
|
-
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
|
|
1671
|
-
/* number */
|
|
1538
|
+
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
|
|
1672
1539
|
parseInt(month, 10) : HDate.monthFromName(month);
|
|
1673
1540
|
}
|
|
1541
|
+
|
|
1674
1542
|
/**
|
|
1675
1543
|
* Number of days in the hebrew YEAR
|
|
1676
1544
|
* @param {number} year Hebrew year
|
|
1677
1545
|
* @return {number}
|
|
1678
1546
|
*/
|
|
1679
|
-
|
|
1680
1547
|
}, {
|
|
1681
1548
|
key: "daysInYear",
|
|
1682
1549
|
value: function daysInYear$1(year) {
|
|
1683
1550
|
return daysInYear(year);
|
|
1684
1551
|
}
|
|
1552
|
+
|
|
1685
1553
|
/**
|
|
1686
1554
|
* true if Cheshvan is long in Hebrew year
|
|
1687
1555
|
* @param {number} year Hebrew year
|
|
1688
1556
|
* @return {boolean}
|
|
1689
1557
|
*/
|
|
1690
|
-
|
|
1691
1558
|
}, {
|
|
1692
1559
|
key: "longCheshvan",
|
|
1693
1560
|
value: function longCheshvan$1(year) {
|
|
1694
1561
|
return longCheshvan(year);
|
|
1695
1562
|
}
|
|
1563
|
+
|
|
1696
1564
|
/**
|
|
1697
1565
|
* true if Kislev is short in Hebrew year
|
|
1698
1566
|
* @param {number} year Hebrew year
|
|
1699
1567
|
* @return {boolean}
|
|
1700
1568
|
*/
|
|
1701
|
-
|
|
1702
1569
|
}, {
|
|
1703
1570
|
key: "shortKislev",
|
|
1704
1571
|
value: function shortKislev$1(year) {
|
|
1705
1572
|
return shortKislev(year);
|
|
1706
1573
|
}
|
|
1574
|
+
|
|
1707
1575
|
/**
|
|
1708
1576
|
* Converts Hebrew month string name to numeric
|
|
1709
1577
|
* @param {string} monthName monthName
|
|
1710
1578
|
* @return {number}
|
|
1711
1579
|
*/
|
|
1712
|
-
|
|
1713
1580
|
}, {
|
|
1714
1581
|
key: "monthFromName",
|
|
1715
1582
|
value: function monthFromName(monthName) {
|
|
@@ -1717,10 +1584,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1717
1584
|
if (isNaN(monthName) || monthName < 1 || monthName > 14) {
|
|
1718
1585
|
throw new RangeError("Invalid month name: ".concat(monthName));
|
|
1719
1586
|
}
|
|
1720
|
-
|
|
1721
1587
|
return monthName;
|
|
1722
1588
|
}
|
|
1723
|
-
|
|
1724
1589
|
var c = monthName.toLowerCase();
|
|
1725
1590
|
/*
|
|
1726
1591
|
the Hebrew months are unique to their second letter
|
|
@@ -1743,115 +1608,88 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1743
1608
|
ש שבט
|
|
1744
1609
|
תמ תש תמוז תשרי
|
|
1745
1610
|
*/
|
|
1746
|
-
|
|
1747
1611
|
switch (c[0]) {
|
|
1748
1612
|
case 'n':
|
|
1749
1613
|
case 'נ':
|
|
1750
1614
|
if (c[1] == 'o') {
|
|
1751
|
-
break;
|
|
1752
|
-
/* this catches "november" */
|
|
1615
|
+
break; /* this catches "november" */
|
|
1753
1616
|
}
|
|
1754
1617
|
|
|
1755
1618
|
return months.NISAN;
|
|
1756
|
-
|
|
1757
1619
|
case 'i':
|
|
1758
1620
|
return months.IYYAR;
|
|
1759
|
-
|
|
1760
1621
|
case 'e':
|
|
1761
1622
|
return months.ELUL;
|
|
1762
|
-
|
|
1763
1623
|
case 'c':
|
|
1764
1624
|
case 'ח':
|
|
1765
1625
|
return months.CHESHVAN;
|
|
1766
|
-
|
|
1767
1626
|
case 'k':
|
|
1768
1627
|
case 'כ':
|
|
1769
1628
|
return months.KISLEV;
|
|
1770
|
-
|
|
1771
1629
|
case 's':
|
|
1772
1630
|
switch (c[1]) {
|
|
1773
1631
|
case 'i':
|
|
1774
1632
|
return months.SIVAN;
|
|
1775
|
-
|
|
1776
1633
|
case 'h':
|
|
1777
1634
|
return months.SHVAT;
|
|
1778
1635
|
}
|
|
1779
|
-
|
|
1780
1636
|
case 't':
|
|
1781
1637
|
switch (c[1]) {
|
|
1782
1638
|
case 'a':
|
|
1783
1639
|
return months.TAMUZ;
|
|
1784
|
-
|
|
1785
1640
|
case 'i':
|
|
1786
1641
|
return months.TISHREI;
|
|
1787
|
-
|
|
1788
1642
|
case 'e':
|
|
1789
1643
|
return months.TEVET;
|
|
1790
1644
|
}
|
|
1791
|
-
|
|
1792
1645
|
break;
|
|
1793
|
-
|
|
1794
1646
|
case 'a':
|
|
1795
1647
|
switch (c[1]) {
|
|
1796
1648
|
case 'v':
|
|
1797
1649
|
return months.AV;
|
|
1798
|
-
|
|
1799
1650
|
case 'd':
|
|
1800
1651
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1801
1652
|
return months.ADAR_I;
|
|
1802
1653
|
}
|
|
1803
|
-
|
|
1804
1654
|
return months.ADAR_II;
|
|
1805
1655
|
// else assume sheini
|
|
1806
1656
|
}
|
|
1807
1657
|
|
|
1808
1658
|
break;
|
|
1809
|
-
|
|
1810
1659
|
case 'ס':
|
|
1811
1660
|
return months.SIVAN;
|
|
1812
|
-
|
|
1813
1661
|
case 'ט':
|
|
1814
1662
|
return months.TEVET;
|
|
1815
|
-
|
|
1816
1663
|
case 'ש':
|
|
1817
1664
|
return months.SHVAT;
|
|
1818
|
-
|
|
1819
1665
|
case 'א':
|
|
1820
1666
|
switch (c[1]) {
|
|
1821
1667
|
case 'ב':
|
|
1822
1668
|
return months.AV;
|
|
1823
|
-
|
|
1824
1669
|
case 'ד':
|
|
1825
1670
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1826
1671
|
return months.ADAR_I;
|
|
1827
1672
|
}
|
|
1828
|
-
|
|
1829
1673
|
return months.ADAR_II;
|
|
1830
1674
|
// else assume sheini
|
|
1831
|
-
|
|
1832
1675
|
case 'י':
|
|
1833
1676
|
return months.IYYAR;
|
|
1834
|
-
|
|
1835
1677
|
case 'ל':
|
|
1836
1678
|
return months.ELUL;
|
|
1837
1679
|
}
|
|
1838
|
-
|
|
1839
1680
|
break;
|
|
1840
|
-
|
|
1841
1681
|
case 'ת':
|
|
1842
1682
|
switch (c[1]) {
|
|
1843
1683
|
case 'מ':
|
|
1844
1684
|
return months.TAMUZ;
|
|
1845
|
-
|
|
1846
1685
|
case 'ש':
|
|
1847
1686
|
return months.TISHREI;
|
|
1848
1687
|
}
|
|
1849
|
-
|
|
1850
1688
|
break;
|
|
1851
1689
|
}
|
|
1852
|
-
|
|
1853
1690
|
throw new RangeError("Unable to parse month name: ".concat(monthName));
|
|
1854
1691
|
}
|
|
1692
|
+
|
|
1855
1693
|
/**
|
|
1856
1694
|
* Note: Applying this function to d+6 gives us the DAYNAME on or after an
|
|
1857
1695
|
* absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
|
|
@@ -1861,75 +1699,66 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1861
1699
|
* @param {number} absdate
|
|
1862
1700
|
* @return {number}
|
|
1863
1701
|
*/
|
|
1864
|
-
|
|
1865
1702
|
}, {
|
|
1866
1703
|
key: "dayOnOrBefore",
|
|
1867
1704
|
value: function dayOnOrBefore(dayOfWeek, absdate) {
|
|
1868
1705
|
return absdate - (absdate - dayOfWeek) % 7;
|
|
1869
1706
|
}
|
|
1707
|
+
|
|
1870
1708
|
/**
|
|
1871
1709
|
* Tests if the object is an instance of `HDate`
|
|
1872
1710
|
* @param {any} obj
|
|
1873
1711
|
* @return {boolean}
|
|
1874
1712
|
*/
|
|
1875
|
-
|
|
1876
1713
|
}, {
|
|
1877
1714
|
key: "isHDate",
|
|
1878
1715
|
value: function isHDate(obj) {
|
|
1879
1716
|
return obj !== null && _typeof(obj) === 'object' && typeof obj.year === 'number' && typeof obj.month === 'number' && typeof obj.day === 'number' && typeof obj.greg === 'function' && typeof obj.abs === 'function';
|
|
1880
1717
|
}
|
|
1881
1718
|
}]);
|
|
1882
|
-
|
|
1883
1719
|
return HDate;
|
|
1884
1720
|
}();
|
|
1721
|
+
|
|
1885
1722
|
/**
|
|
1886
1723
|
* @private
|
|
1887
1724
|
* @param {HDate} date
|
|
1888
1725
|
*/
|
|
1889
|
-
|
|
1890
1726
|
function fix(date) {
|
|
1891
1727
|
fixMonth(date);
|
|
1892
1728
|
fixDate(date);
|
|
1893
1729
|
}
|
|
1730
|
+
|
|
1894
1731
|
/**
|
|
1895
1732
|
* @private
|
|
1896
1733
|
* @param {HDate} date
|
|
1897
1734
|
*/
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
1735
|
function fixDate(date) {
|
|
1901
1736
|
if (date.day < 1) {
|
|
1902
1737
|
if (date.month == months.TISHREI) {
|
|
1903
1738
|
date.year -= 1;
|
|
1904
1739
|
}
|
|
1905
|
-
|
|
1906
1740
|
date.day += daysInMonth(date.month, date.year);
|
|
1907
1741
|
date.month -= 1;
|
|
1908
1742
|
fix(date);
|
|
1909
1743
|
}
|
|
1910
|
-
|
|
1911
1744
|
if (date.day > daysInMonth(date.month, date.year)) {
|
|
1912
1745
|
if (date.month === months.ELUL) {
|
|
1913
1746
|
date.year += 1;
|
|
1914
1747
|
}
|
|
1915
|
-
|
|
1916
1748
|
date.day -= daysInMonth(date.month, date.year);
|
|
1917
1749
|
date.month += 1;
|
|
1918
1750
|
fix(date);
|
|
1919
1751
|
}
|
|
1920
|
-
|
|
1921
1752
|
fixMonth(date);
|
|
1922
1753
|
}
|
|
1754
|
+
|
|
1923
1755
|
/**
|
|
1924
1756
|
* @private
|
|
1925
1757
|
* @param {HDate} date
|
|
1926
1758
|
*/
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
1759
|
function fixMonth(date) {
|
|
1930
1760
|
if (date.month === months.ADAR_II && !date.isLeapYear()) {
|
|
1931
1761
|
date.month -= 1; // to Adar I
|
|
1932
|
-
|
|
1933
1762
|
fix(date);
|
|
1934
1763
|
} else if (date.month < 1) {
|
|
1935
1764
|
date.month += monthsInYear(date.year);
|
|
@@ -1940,9 +1769,9 @@ function fixMonth(date) {
|
|
|
1940
1769
|
date.year += 1;
|
|
1941
1770
|
fix(date);
|
|
1942
1771
|
}
|
|
1943
|
-
|
|
1944
1772
|
delete date.abs0;
|
|
1945
1773
|
}
|
|
1774
|
+
|
|
1946
1775
|
/**
|
|
1947
1776
|
* @private
|
|
1948
1777
|
* @param {number} day
|
|
@@ -1950,8 +1779,6 @@ function fixMonth(date) {
|
|
|
1950
1779
|
* @param {number} offset
|
|
1951
1780
|
* @return {HDate}
|
|
1952
1781
|
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
1782
|
function _onOrBefore(day, t, offset) {
|
|
1956
1783
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1957
1784
|
}
|
|
@@ -1963,13 +1790,13 @@ var TEVET = months.TEVET;
|
|
|
1963
1790
|
var SHVAT = months.SHVAT;
|
|
1964
1791
|
var ADAR_I = months.ADAR_I;
|
|
1965
1792
|
var ADAR_II = months.ADAR_II;
|
|
1793
|
+
|
|
1966
1794
|
/**
|
|
1967
1795
|
* @private
|
|
1968
1796
|
* @param {number} hyear Hebrew year
|
|
1969
1797
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
1970
1798
|
* @return {HDate} anniversary occurring in hyear
|
|
1971
1799
|
*/
|
|
1972
|
-
|
|
1973
1800
|
function getYahrzeit_(hyear, gdate) {
|
|
1974
1801
|
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
1975
1802
|
var hDeath = {
|
|
@@ -1977,12 +1804,10 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1977
1804
|
mm: orig.getMonth(),
|
|
1978
1805
|
dd: orig.getDate()
|
|
1979
1806
|
};
|
|
1980
|
-
|
|
1981
1807
|
if (hyear <= hDeath.yy) {
|
|
1982
1808
|
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
1983
1809
|
return undefined;
|
|
1984
1810
|
}
|
|
1985
|
-
|
|
1986
1811
|
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hDeath.yy + 1)) {
|
|
1987
1812
|
// If it's Heshvan 30 it depends on the first anniversary;
|
|
1988
1813
|
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
@@ -1999,10 +1824,10 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1999
1824
|
// (so Adar has only 29 days), use the last day in Shevat.
|
|
2000
1825
|
hDeath.dd = 30;
|
|
2001
1826
|
hDeath.mm = SHVAT;
|
|
2002
|
-
}
|
|
2003
|
-
//
|
|
2004
|
-
|
|
1827
|
+
}
|
|
1828
|
+
// In all other cases, use the normal anniversary of the date of death.
|
|
2005
1829
|
|
|
1830
|
+
// advance day to rosh chodesh if needed
|
|
2006
1831
|
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hyear)) {
|
|
2007
1832
|
hDeath.mm = KISLEV;
|
|
2008
1833
|
hDeath.dd = 1;
|
|
@@ -2010,29 +1835,25 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
2010
1835
|
hDeath.mm = TEVET;
|
|
2011
1836
|
hDeath.dd = 1;
|
|
2012
1837
|
}
|
|
2013
|
-
|
|
2014
1838
|
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
2015
1839
|
}
|
|
1840
|
+
|
|
2016
1841
|
/**
|
|
2017
1842
|
* @private
|
|
2018
1843
|
* @param {number} hyear Hebrew year
|
|
2019
1844
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
2020
1845
|
* @return {HDate} anniversary occurring in `hyear`
|
|
2021
1846
|
*/
|
|
2022
|
-
|
|
2023
1847
|
function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
2024
1848
|
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
2025
1849
|
var origYear = orig.getFullYear();
|
|
2026
|
-
|
|
2027
1850
|
if (hyear <= origYear) {
|
|
2028
1851
|
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
2029
1852
|
return undefined;
|
|
2030
1853
|
}
|
|
2031
|
-
|
|
2032
1854
|
var isOrigLeap = isLeapYear(origYear);
|
|
2033
1855
|
var month = orig.getMonth();
|
|
2034
1856
|
var day = orig.getDate();
|
|
2035
|
-
|
|
2036
1857
|
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
2037
1858
|
month = monthsInYear(hyear);
|
|
2038
1859
|
} else if (month == CHESHVAN && day == 30 && !longCheshvan(hyear)) {
|
|
@@ -2045,11 +1866,10 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
2045
1866
|
month = NISAN;
|
|
2046
1867
|
day = 1;
|
|
2047
1868
|
}
|
|
2048
|
-
|
|
2049
1869
|
return new HDate(day, month, hyear);
|
|
2050
1870
|
}
|
|
2051
1871
|
|
|
2052
|
-
var version="3.45.
|
|
1872
|
+
var version="3.45.4";
|
|
2053
1873
|
|
|
2054
1874
|
var headers={"plural-forms":"nplurals=2; plural=(n > 1);"};var contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
|
|
2055
1875
|
|