@hebcal/core 3.45.3 → 3.45.5
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 +2 -2
- package/dist/bundle.js +408 -1149
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +118 -293
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +123 -338
- package/dist/hdate.mjs +9 -3
- package/dist/hdate0-bundle.js +44 -69
- package/dist/hdate0-bundle.min.js +2 -2
- package/dist/hdate0.mjs +8 -2
- package/dist/index.js +397 -1171
- package/dist/index.mjs +400 -1169
- package/package.json +9 -9
- package/po/he.po +3 -0
package/dist/hdate-bundle.js
CHANGED
|
@@ -1,119 +1,92 @@
|
|
|
1
|
-
/*! @hebcal/core v3.45.
|
|
1
|
+
/*! @hebcal/core v3.45.5 */
|
|
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,15 @@ 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) {
|
|
690
|
+
if (year < 1) {
|
|
691
|
+
throw new RangeError("hebrew2abs: invalid year ".concat(year));
|
|
692
|
+
}
|
|
782
693
|
var tempabs = day;
|
|
783
|
-
|
|
784
694
|
if (month < TISHREI) {
|
|
785
695
|
for (var m = TISHREI; m <= monthsInYear(year); m++) {
|
|
786
696
|
tempabs += daysInMonth(m, year);
|
|
787
697
|
}
|
|
788
|
-
|
|
789
698
|
for (var _m = NISAN$1; _m < month; _m++) {
|
|
790
699
|
tempabs += daysInMonth(_m, year);
|
|
791
700
|
}
|
|
@@ -794,46 +703,42 @@ function hebrew2abs(year, month, day) {
|
|
|
794
703
|
tempabs += daysInMonth(_m2, year);
|
|
795
704
|
}
|
|
796
705
|
}
|
|
797
|
-
|
|
798
706
|
return EPOCH + elapsedDays(year) + tempabs - 1;
|
|
799
707
|
}
|
|
708
|
+
|
|
800
709
|
/**
|
|
801
710
|
* @private
|
|
802
711
|
* @param {number} year
|
|
803
712
|
* @return {number}
|
|
804
713
|
*/
|
|
805
|
-
|
|
806
714
|
function newYear(year) {
|
|
807
715
|
return EPOCH + elapsedDays(year);
|
|
808
716
|
}
|
|
717
|
+
|
|
809
718
|
/**
|
|
810
719
|
* Converts absolute R.D. days to Hebrew date
|
|
811
720
|
* @private
|
|
812
721
|
* @param {number} abs absolute R.D. days
|
|
813
722
|
* @return {SimpleHebrewDate}
|
|
814
723
|
*/
|
|
815
|
-
|
|
816
|
-
|
|
817
724
|
function abs2hebrew(abs) {
|
|
818
725
|
if (typeof abs !== 'number' || isNaN(abs)) {
|
|
819
726
|
throw new TypeError("invalid parameter to abs2hebrew ".concat(abs));
|
|
820
727
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
728
|
+
abs = Math.trunc(abs);
|
|
729
|
+
if (abs <= EPOCH) {
|
|
730
|
+
throw new RangeError("abs2hebrew: ".concat(abs, " is before epoch"));
|
|
731
|
+
}
|
|
732
|
+
// first, quickly approximate year
|
|
824
733
|
var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
|
|
825
|
-
|
|
826
734
|
while (newYear(year) <= abs) {
|
|
827
735
|
++year;
|
|
828
736
|
}
|
|
829
|
-
|
|
830
737
|
--year;
|
|
831
738
|
var month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
|
|
832
|
-
|
|
833
739
|
while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
|
|
834
740
|
++month;
|
|
835
741
|
}
|
|
836
|
-
|
|
837
742
|
var day = 1 + abs - hebrew2abs(year, month, 1);
|
|
838
743
|
return {
|
|
839
744
|
yy: year,
|
|
@@ -841,26 +746,27 @@ function abs2hebrew(abs) {
|
|
|
841
746
|
dd: day
|
|
842
747
|
};
|
|
843
748
|
}
|
|
749
|
+
|
|
844
750
|
/**
|
|
845
751
|
* Returns true if Hebrew year is a leap year
|
|
846
752
|
* @private
|
|
847
753
|
* @param {number} year Hebrew year
|
|
848
754
|
* @return {boolean}
|
|
849
755
|
*/
|
|
850
|
-
|
|
851
756
|
function isLeapYear(year) {
|
|
852
757
|
return (1 + year * 7) % 19 < 7;
|
|
853
758
|
}
|
|
759
|
+
|
|
854
760
|
/**
|
|
855
761
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
856
762
|
* @private
|
|
857
763
|
* @param {number} year Hebrew year
|
|
858
764
|
* @return {number}
|
|
859
765
|
*/
|
|
860
|
-
|
|
861
766
|
function monthsInYear(year) {
|
|
862
767
|
return 12 + isLeapYear(year); // boolean is cast to 1 or 0
|
|
863
768
|
}
|
|
769
|
+
|
|
864
770
|
/**
|
|
865
771
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
866
772
|
* @private
|
|
@@ -868,7 +774,6 @@ function monthsInYear(year) {
|
|
|
868
774
|
* @param {number} year Hebrew year
|
|
869
775
|
* @return {number}
|
|
870
776
|
*/
|
|
871
|
-
|
|
872
777
|
function daysInMonth(month, year) {
|
|
873
778
|
switch (month) {
|
|
874
779
|
case IYYAR:
|
|
@@ -878,13 +783,13 @@ function daysInMonth(month, year) {
|
|
|
878
783
|
case ADAR_II$1:
|
|
879
784
|
return 29;
|
|
880
785
|
}
|
|
881
|
-
|
|
882
786
|
if (month === ADAR_I$1 && !isLeapYear(year) || month === CHESHVAN$1 && !longCheshvan(year) || month === KISLEV$1 && shortKislev(year)) {
|
|
883
787
|
return 29;
|
|
884
788
|
} else {
|
|
885
789
|
return 30;
|
|
886
790
|
}
|
|
887
791
|
}
|
|
792
|
+
|
|
888
793
|
/**
|
|
889
794
|
* Returns a transliterated string name of Hebrew month in year,
|
|
890
795
|
* for example 'Elul' or 'Cheshvan'.
|
|
@@ -893,14 +798,13 @@ function daysInMonth(month, year) {
|
|
|
893
798
|
* @param {number} year Hebrew year
|
|
894
799
|
* @return {string}
|
|
895
800
|
*/
|
|
896
|
-
|
|
897
801
|
function getMonthName(month, year) {
|
|
898
802
|
if (typeof month !== 'number' || isNaN(month) || month < 1 || month > 14) {
|
|
899
803
|
throw new TypeError("bad month argument ".concat(month));
|
|
900
804
|
}
|
|
901
|
-
|
|
902
805
|
return monthNames[+isLeapYear(year)][month];
|
|
903
806
|
}
|
|
807
|
+
|
|
904
808
|
/**
|
|
905
809
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
906
810
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -908,11 +812,11 @@ function getMonthName(month, year) {
|
|
|
908
812
|
* @param {number} year Hebrew year
|
|
909
813
|
* @return {number}
|
|
910
814
|
*/
|
|
911
|
-
|
|
912
815
|
function elapsedDays(year) {
|
|
913
816
|
var elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
|
|
914
817
|
return elapsed;
|
|
915
818
|
}
|
|
819
|
+
|
|
916
820
|
/**
|
|
917
821
|
* Days from sunday prior to start of Hebrew calendar to mean
|
|
918
822
|
* conjunction of Tishrei in Hebrew YEAR
|
|
@@ -920,11 +824,12 @@ function elapsedDays(year) {
|
|
|
920
824
|
* @param {number} year Hebrew year
|
|
921
825
|
* @return {number}
|
|
922
826
|
*/
|
|
923
|
-
|
|
924
827
|
function elapsedDays0(year) {
|
|
925
828
|
var prevYear = year - 1;
|
|
926
|
-
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
927
|
-
|
|
829
|
+
var mElapsed = 235 * Math.floor(prevYear / 19) +
|
|
830
|
+
// Months in complete 19 year lunar (Metonic) cycles so far
|
|
831
|
+
12 * (prevYear % 19) +
|
|
832
|
+
// Regular months in this cycle
|
|
928
833
|
Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
|
|
929
834
|
|
|
930
835
|
var pElapsed = 204 + 793 * (mElapsed % 1080);
|
|
@@ -934,6 +839,7 @@ function elapsedDays0(year) {
|
|
|
934
839
|
var altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
|
|
935
840
|
return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
|
|
936
841
|
}
|
|
842
|
+
|
|
937
843
|
/**
|
|
938
844
|
* Number of days in the hebrew YEAR.
|
|
939
845
|
* A common Hebrew calendar year can have a length of 353, 354 or 355 days
|
|
@@ -942,36 +848,34 @@ function elapsedDays0(year) {
|
|
|
942
848
|
* @param {number} year Hebrew year
|
|
943
849
|
* @return {number}
|
|
944
850
|
*/
|
|
945
|
-
|
|
946
|
-
|
|
947
851
|
function daysInYear(year) {
|
|
948
852
|
return elapsedDays(year + 1) - elapsedDays(year);
|
|
949
853
|
}
|
|
854
|
+
|
|
950
855
|
/**
|
|
951
856
|
* true if Cheshvan is long in Hebrew year
|
|
952
857
|
* @private
|
|
953
858
|
* @param {number} year Hebrew year
|
|
954
859
|
* @return {boolean}
|
|
955
860
|
*/
|
|
956
|
-
|
|
957
861
|
function longCheshvan(year) {
|
|
958
862
|
return daysInYear(year) % 10 === 5;
|
|
959
863
|
}
|
|
864
|
+
|
|
960
865
|
/**
|
|
961
866
|
* true if Kislev is short in Hebrew year
|
|
962
867
|
* @private
|
|
963
868
|
* @param {number} year Hebrew year
|
|
964
869
|
* @return {boolean}
|
|
965
870
|
*/
|
|
966
|
-
|
|
967
871
|
function shortKislev(year) {
|
|
968
872
|
return daysInYear(year) % 10 === 3;
|
|
969
873
|
}
|
|
970
874
|
|
|
875
|
+
// eslint-disable-next-line require-jsdoc
|
|
971
876
|
function throwTypeError(msg) {
|
|
972
877
|
throw new TypeError(msg);
|
|
973
878
|
}
|
|
974
|
-
|
|
975
879
|
var UNITS_DAY = 'day';
|
|
976
880
|
var UNITS_WEEK = 'week';
|
|
977
881
|
var UNITS_MONTH = 'month';
|
|
@@ -988,6 +892,7 @@ var UNITS_VALID = {
|
|
|
988
892
|
month: UNITS_MONTH,
|
|
989
893
|
year: UNITS_YEAR
|
|
990
894
|
};
|
|
895
|
+
|
|
991
896
|
/**
|
|
992
897
|
* A simple Hebrew date object with numeric fields `yy`, `mm`, and `dd`
|
|
993
898
|
* @typedef {Object} SimpleHebrewDate
|
|
@@ -998,7 +903,6 @@ var UNITS_VALID = {
|
|
|
998
903
|
*/
|
|
999
904
|
|
|
1000
905
|
/** Represents a Hebrew date */
|
|
1001
|
-
|
|
1002
906
|
var HDate = /*#__PURE__*/function () {
|
|
1003
907
|
/**
|
|
1004
908
|
* Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
|
|
@@ -1032,14 +936,11 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1032
936
|
*/
|
|
1033
937
|
function HDate(day, month, year) {
|
|
1034
938
|
_classCallCheck(this, HDate);
|
|
1035
|
-
|
|
1036
939
|
if (arguments.length == 2 || arguments.length > 3) {
|
|
1037
940
|
throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');
|
|
1038
941
|
}
|
|
1039
|
-
|
|
1040
942
|
if (arguments.length == 3) {
|
|
1041
943
|
// Hebrew day, Hebrew month, Hebrew year
|
|
1042
|
-
|
|
1043
944
|
/**
|
|
1044
945
|
* @private
|
|
1045
946
|
* @type {number}
|
|
@@ -1049,30 +950,23 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1049
950
|
* @private
|
|
1050
951
|
* @type {number}
|
|
1051
952
|
*/
|
|
1052
|
-
|
|
1053
953
|
year = parseInt(year, 10);
|
|
1054
|
-
|
|
1055
954
|
if (isNaN(year)) {
|
|
1056
955
|
throw new TypeError("HDate called with bad year argument: ".concat(year));
|
|
1057
956
|
}
|
|
1058
|
-
|
|
1059
957
|
this.year = year;
|
|
1060
958
|
this.setMonth(month); // will throw if we can't parse
|
|
1061
|
-
|
|
1062
959
|
day = parseInt(day, 10);
|
|
1063
|
-
|
|
1064
960
|
if (isNaN(day)) {
|
|
1065
961
|
throw new TypeError("HDate called with bad day argument: ".concat(day));
|
|
1066
962
|
}
|
|
1067
|
-
|
|
1068
963
|
this.setDate(day);
|
|
1069
964
|
} else {
|
|
1070
965
|
// 0 arguments
|
|
1071
966
|
if (typeof day === 'undefined') {
|
|
1072
967
|
day = new Date();
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
|
|
968
|
+
}
|
|
969
|
+
// 1 argument
|
|
1076
970
|
var abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
|
|
1077
971
|
dd: day.day,
|
|
1078
972
|
mm: day.month,
|
|
@@ -1084,21 +978,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1084
978
|
* @private
|
|
1085
979
|
* @type {number}
|
|
1086
980
|
*/
|
|
1087
|
-
|
|
1088
981
|
this.day = d.dd;
|
|
1089
982
|
/**
|
|
1090
983
|
* @private
|
|
1091
984
|
* @type {number}
|
|
1092
985
|
*/
|
|
1093
|
-
|
|
1094
986
|
this.month = d.mm;
|
|
1095
987
|
/**
|
|
1096
988
|
* @private
|
|
1097
989
|
* @type {number}
|
|
1098
990
|
*/
|
|
1099
|
-
|
|
1100
991
|
this.year = d.yy;
|
|
1101
|
-
|
|
1102
992
|
if (isNumber) {
|
|
1103
993
|
/**
|
|
1104
994
|
* @private
|
|
@@ -1108,79 +998,78 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1108
998
|
}
|
|
1109
999
|
}
|
|
1110
1000
|
}
|
|
1001
|
+
|
|
1111
1002
|
/**
|
|
1112
1003
|
* Gets the Hebrew year of this Hebrew date
|
|
1113
1004
|
* @return {number}
|
|
1114
1005
|
*/
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
1006
|
_createClass(HDate, [{
|
|
1118
1007
|
key: "getFullYear",
|
|
1119
1008
|
value: function getFullYear() {
|
|
1120
1009
|
return this.year;
|
|
1121
1010
|
}
|
|
1011
|
+
|
|
1122
1012
|
/**
|
|
1123
1013
|
* Tests if this date occurs during a leap year
|
|
1124
1014
|
* @return {boolean}
|
|
1125
1015
|
*/
|
|
1126
|
-
|
|
1127
1016
|
}, {
|
|
1128
1017
|
key: "isLeapYear",
|
|
1129
1018
|
value: function isLeapYear$1() {
|
|
1130
1019
|
return isLeapYear(this.year);
|
|
1131
1020
|
}
|
|
1021
|
+
|
|
1132
1022
|
/**
|
|
1133
1023
|
* Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
1134
1024
|
* @return {number}
|
|
1135
1025
|
*/
|
|
1136
|
-
|
|
1137
1026
|
}, {
|
|
1138
1027
|
key: "getMonth",
|
|
1139
1028
|
value: function getMonth() {
|
|
1140
1029
|
return this.month;
|
|
1141
1030
|
}
|
|
1031
|
+
|
|
1142
1032
|
/**
|
|
1143
1033
|
* The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
|
|
1144
1034
|
* @return {number}
|
|
1145
1035
|
*/
|
|
1146
|
-
|
|
1147
1036
|
}, {
|
|
1148
1037
|
key: "getTishreiMonth",
|
|
1149
1038
|
value: function getTishreiMonth() {
|
|
1150
1039
|
var nummonths = monthsInYear(this.getFullYear());
|
|
1151
|
-
|
|
1152
1040
|
return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
|
|
1153
1041
|
}
|
|
1042
|
+
|
|
1154
1043
|
/**
|
|
1155
1044
|
* Number of days in the month of this Hebrew date
|
|
1156
1045
|
* @return {number}
|
|
1157
1046
|
*/
|
|
1158
|
-
|
|
1159
1047
|
}, {
|
|
1160
1048
|
key: "daysInMonth",
|
|
1161
1049
|
value: function daysInMonth$1() {
|
|
1162
1050
|
return daysInMonth(this.getMonth(), this.getFullYear());
|
|
1163
1051
|
}
|
|
1052
|
+
|
|
1164
1053
|
/**
|
|
1165
1054
|
* Gets the day within the month (1-30)
|
|
1166
1055
|
* @return {number}
|
|
1167
1056
|
*/
|
|
1168
|
-
|
|
1169
1057
|
}, {
|
|
1170
1058
|
key: "getDate",
|
|
1171
1059
|
value: function getDate() {
|
|
1172
1060
|
return this.day;
|
|
1173
1061
|
}
|
|
1062
|
+
|
|
1174
1063
|
/**
|
|
1175
1064
|
* Gets the day of the week. 0=Sunday, 6=Saturday
|
|
1176
1065
|
* @return {number}
|
|
1177
1066
|
*/
|
|
1178
|
-
|
|
1179
1067
|
}, {
|
|
1180
1068
|
key: "getDay",
|
|
1181
1069
|
value: function getDay() {
|
|
1182
1070
|
return mod(this.abs(), 7);
|
|
1183
1071
|
}
|
|
1072
|
+
|
|
1184
1073
|
/**
|
|
1185
1074
|
* Sets the year of the date. Returns the object it was called upon.
|
|
1186
1075
|
* @private
|
|
@@ -1188,7 +1077,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1188
1077
|
* @param {number} year
|
|
1189
1078
|
* @return {HDate}
|
|
1190
1079
|
*/
|
|
1191
|
-
|
|
1192
1080
|
}, {
|
|
1193
1081
|
key: "setFullYear",
|
|
1194
1082
|
value: function setFullYear(year) {
|
|
@@ -1196,13 +1084,13 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1196
1084
|
fix(this);
|
|
1197
1085
|
return this;
|
|
1198
1086
|
}
|
|
1087
|
+
|
|
1199
1088
|
/**
|
|
1200
1089
|
* Sets the day of the month of the date. Returns the object it was called upon
|
|
1201
1090
|
* @private
|
|
1202
1091
|
* @param {number} month
|
|
1203
1092
|
* @return {HDate}
|
|
1204
1093
|
*/
|
|
1205
|
-
|
|
1206
1094
|
}, {
|
|
1207
1095
|
key: "setMonth",
|
|
1208
1096
|
value: function setMonth(month) {
|
|
@@ -1210,12 +1098,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1210
1098
|
fix(this);
|
|
1211
1099
|
return this;
|
|
1212
1100
|
}
|
|
1101
|
+
|
|
1213
1102
|
/**
|
|
1214
1103
|
* @private
|
|
1215
1104
|
* @param {number} date
|
|
1216
1105
|
* @return {HDate}
|
|
1217
1106
|
*/
|
|
1218
|
-
|
|
1219
1107
|
}, {
|
|
1220
1108
|
key: "setDate",
|
|
1221
1109
|
value: function setDate(date) {
|
|
@@ -1223,16 +1111,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1223
1111
|
fix(this);
|
|
1224
1112
|
return this;
|
|
1225
1113
|
}
|
|
1114
|
+
|
|
1226
1115
|
/**
|
|
1227
1116
|
* Converts to Gregorian date
|
|
1228
1117
|
* @return {Date}
|
|
1229
1118
|
*/
|
|
1230
|
-
|
|
1231
1119
|
}, {
|
|
1232
1120
|
key: "greg",
|
|
1233
1121
|
value: function greg() {
|
|
1234
1122
|
return abs2greg(this.abs());
|
|
1235
1123
|
}
|
|
1124
|
+
|
|
1236
1125
|
/**
|
|
1237
1126
|
* Returns R.D. (Rata Die) fixed days.
|
|
1238
1127
|
* R.D. 1 == Monday, January 1, 1 (Gregorian)
|
|
@@ -1240,16 +1129,15 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1240
1129
|
* https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
|
|
1241
1130
|
* @return {number}
|
|
1242
1131
|
*/
|
|
1243
|
-
|
|
1244
1132
|
}, {
|
|
1245
1133
|
key: "abs",
|
|
1246
1134
|
value: function abs() {
|
|
1247
1135
|
if (typeof this.abs0 !== 'number') {
|
|
1248
1136
|
this.abs0 = hebrew2abs(this.year, this.month, this.day);
|
|
1249
1137
|
}
|
|
1250
|
-
|
|
1251
1138
|
return this.abs0;
|
|
1252
1139
|
}
|
|
1140
|
+
|
|
1253
1141
|
/**
|
|
1254
1142
|
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
1255
1143
|
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
@@ -1259,7 +1147,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1259
1147
|
* @param {number} day Hebrew date (1-30)
|
|
1260
1148
|
* @return {number}
|
|
1261
1149
|
*/
|
|
1262
|
-
|
|
1263
1150
|
}, {
|
|
1264
1151
|
key: "getMonthName",
|
|
1265
1152
|
value:
|
|
@@ -1270,6 +1157,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1270
1157
|
function getMonthName$1() {
|
|
1271
1158
|
return getMonthName(this.getMonth(), this.getFullYear());
|
|
1272
1159
|
}
|
|
1160
|
+
|
|
1273
1161
|
/**
|
|
1274
1162
|
* Renders this Hebrew date as a translated or transliterated string,
|
|
1275
1163
|
* including ordinal e.g. `'15th of Cheshvan, 5769'`.
|
|
@@ -1283,7 +1171,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1283
1171
|
* @param {boolean} [showYear=true] Display year (defaults to true).
|
|
1284
1172
|
* @return {string}
|
|
1285
1173
|
*/
|
|
1286
|
-
|
|
1287
1174
|
}, {
|
|
1288
1175
|
key: "render",
|
|
1289
1176
|
value: function render() {
|
|
@@ -1295,7 +1182,6 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1295
1182
|
var nth = Locale.ordinal(day, locale0);
|
|
1296
1183
|
var dayOf = HDate.getDayOfTranslation(locale0);
|
|
1297
1184
|
var dateStr = "".concat(nth).concat(dayOf, " ").concat(monthName);
|
|
1298
|
-
|
|
1299
1185
|
if (showYear) {
|
|
1300
1186
|
var fullYear = this.getFullYear();
|
|
1301
1187
|
return "".concat(dateStr, ", ").concat(fullYear);
|
|
@@ -1303,12 +1189,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1303
1189
|
return dateStr;
|
|
1304
1190
|
}
|
|
1305
1191
|
}
|
|
1192
|
+
|
|
1306
1193
|
/**
|
|
1307
1194
|
* @private
|
|
1308
1195
|
* @param {string} locale
|
|
1309
1196
|
* @return {string}
|
|
1310
1197
|
*/
|
|
1311
|
-
|
|
1312
1198
|
}, {
|
|
1313
1199
|
key: "renderGematriya",
|
|
1314
1200
|
value:
|
|
@@ -1326,6 +1212,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1326
1212
|
var y = this.getFullYear();
|
|
1327
1213
|
return gematriya(d) + ' ' + m + ' ' + gematriya(y);
|
|
1328
1214
|
}
|
|
1215
|
+
|
|
1329
1216
|
/**
|
|
1330
1217
|
* Returns an `HDate` representing the a dayNumber before the current date.
|
|
1331
1218
|
* Sunday=0, Saturday=6
|
|
@@ -1334,12 +1221,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1334
1221
|
* @param {number} day day of week
|
|
1335
1222
|
* @return {HDate}
|
|
1336
1223
|
*/
|
|
1337
|
-
|
|
1338
1224
|
}, {
|
|
1339
1225
|
key: "before",
|
|
1340
1226
|
value: function before(day) {
|
|
1341
1227
|
return _onOrBefore(day, this, -1);
|
|
1342
1228
|
}
|
|
1229
|
+
|
|
1343
1230
|
/**
|
|
1344
1231
|
* Returns an `HDate` representing the a dayNumber on or before the current date.
|
|
1345
1232
|
* Sunday=0, Saturday=6
|
|
@@ -1350,12 +1237,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1350
1237
|
* @param {number} dow day of week
|
|
1351
1238
|
* @return {HDate}
|
|
1352
1239
|
*/
|
|
1353
|
-
|
|
1354
1240
|
}, {
|
|
1355
1241
|
key: "onOrBefore",
|
|
1356
1242
|
value: function onOrBefore(dow) {
|
|
1357
1243
|
return _onOrBefore(dow, this, 0);
|
|
1358
1244
|
}
|
|
1245
|
+
|
|
1359
1246
|
/**
|
|
1360
1247
|
* Returns an `HDate` representing the nearest dayNumber to the current date
|
|
1361
1248
|
* Sunday=0, Saturday=6
|
|
@@ -1365,12 +1252,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1365
1252
|
* @param {number} dow day of week
|
|
1366
1253
|
* @return {HDate}
|
|
1367
1254
|
*/
|
|
1368
|
-
|
|
1369
1255
|
}, {
|
|
1370
1256
|
key: "nearest",
|
|
1371
1257
|
value: function nearest(dow) {
|
|
1372
1258
|
return _onOrBefore(dow, this, 3);
|
|
1373
1259
|
}
|
|
1260
|
+
|
|
1374
1261
|
/**
|
|
1375
1262
|
* Returns an `HDate` representing the a dayNumber on or after the current date.
|
|
1376
1263
|
* Sunday=0, Saturday=6
|
|
@@ -1381,12 +1268,12 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1381
1268
|
* @param {number} dow day of week
|
|
1382
1269
|
* @return {HDate}
|
|
1383
1270
|
*/
|
|
1384
|
-
|
|
1385
1271
|
}, {
|
|
1386
1272
|
key: "onOrAfter",
|
|
1387
1273
|
value: function onOrAfter(dow) {
|
|
1388
1274
|
return _onOrBefore(dow, this, 6);
|
|
1389
1275
|
}
|
|
1276
|
+
|
|
1390
1277
|
/**
|
|
1391
1278
|
* Returns an `HDate` representing the a dayNumber after the current date.
|
|
1392
1279
|
* Sunday=0, Saturday=6
|
|
@@ -1397,32 +1284,32 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1397
1284
|
* @param {number} day day of week
|
|
1398
1285
|
* @return {HDate}
|
|
1399
1286
|
*/
|
|
1400
|
-
|
|
1401
1287
|
}, {
|
|
1402
1288
|
key: "after",
|
|
1403
1289
|
value: function after(day) {
|
|
1404
1290
|
return _onOrBefore(day, this, 7);
|
|
1405
1291
|
}
|
|
1292
|
+
|
|
1406
1293
|
/**
|
|
1407
1294
|
* Returns the next Hebrew date
|
|
1408
1295
|
* @return {HDate}
|
|
1409
1296
|
*/
|
|
1410
|
-
|
|
1411
1297
|
}, {
|
|
1412
1298
|
key: "next",
|
|
1413
1299
|
value: function next() {
|
|
1414
1300
|
return new HDate(this.abs() + 1);
|
|
1415
1301
|
}
|
|
1302
|
+
|
|
1416
1303
|
/**
|
|
1417
1304
|
* Returns the previous Hebrew date
|
|
1418
1305
|
* @return {HDate}
|
|
1419
1306
|
*/
|
|
1420
|
-
|
|
1421
1307
|
}, {
|
|
1422
1308
|
key: "prev",
|
|
1423
1309
|
value: function prev() {
|
|
1424
1310
|
return new HDate(this.abs() - 1);
|
|
1425
1311
|
}
|
|
1312
|
+
|
|
1426
1313
|
/**
|
|
1427
1314
|
* Returns a cloned `HDate` object with a specified amount of time added
|
|
1428
1315
|
*
|
|
@@ -1439,19 +1326,15 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1439
1326
|
* @param {string} [units]
|
|
1440
1327
|
* @return {HDate}
|
|
1441
1328
|
*/
|
|
1442
|
-
|
|
1443
1329
|
}, {
|
|
1444
1330
|
key: "add",
|
|
1445
1331
|
value: function add(number) {
|
|
1446
1332
|
var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
1447
1333
|
number = parseInt(number, 10);
|
|
1448
|
-
|
|
1449
1334
|
if (!number) {
|
|
1450
1335
|
return new HDate(this);
|
|
1451
1336
|
}
|
|
1452
|
-
|
|
1453
1337
|
units = HDate.standardizeUnits(units);
|
|
1454
|
-
|
|
1455
1338
|
if (units === UNITS_DAY) {
|
|
1456
1339
|
return new HDate(this.abs() + number);
|
|
1457
1340
|
} else if (units === UNITS_WEEK) {
|
|
@@ -1462,20 +1345,18 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1462
1345
|
var hd = new HDate(this);
|
|
1463
1346
|
var sign = number > 0 ? 1 : -1;
|
|
1464
1347
|
number = Math.abs(number);
|
|
1465
|
-
|
|
1466
1348
|
for (var i = 0; i < number; i++) {
|
|
1467
1349
|
hd = new HDate(hd.abs() + sign * hd.daysInMonth());
|
|
1468
1350
|
}
|
|
1469
|
-
|
|
1470
1351
|
return hd;
|
|
1471
1352
|
}
|
|
1472
1353
|
}
|
|
1354
|
+
|
|
1473
1355
|
/**
|
|
1474
1356
|
* @private
|
|
1475
1357
|
* @param {string} units
|
|
1476
1358
|
* @return {string}
|
|
1477
1359
|
*/
|
|
1478
|
-
|
|
1479
1360
|
}, {
|
|
1480
1361
|
key: "subtract",
|
|
1481
1362
|
value:
|
|
@@ -1505,6 +1386,7 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1505
1386
|
var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
|
|
1506
1387
|
return this.add(number * -1, units);
|
|
1507
1388
|
}
|
|
1389
|
+
|
|
1508
1390
|
/**
|
|
1509
1391
|
* Returns the difference in days between the two given HDates.
|
|
1510
1392
|
*
|
|
@@ -1522,33 +1404,30 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1522
1404
|
* @param {HDate} other Hebrew date to compare
|
|
1523
1405
|
* @return {number}
|
|
1524
1406
|
*/
|
|
1525
|
-
|
|
1526
1407
|
}, {
|
|
1527
1408
|
key: "deltaDays",
|
|
1528
1409
|
value: function deltaDays(other) {
|
|
1529
1410
|
if (!HDate.isHDate(other)) {
|
|
1530
1411
|
throw new TypeError("Bad argument: ".concat(other));
|
|
1531
1412
|
}
|
|
1532
|
-
|
|
1533
1413
|
return this.abs() - other.abs();
|
|
1534
1414
|
}
|
|
1415
|
+
|
|
1535
1416
|
/**
|
|
1536
1417
|
* Compares this date to another date, returning `true` if the dates match.
|
|
1537
1418
|
* @param {HDate} other Hebrew date to compare
|
|
1538
1419
|
* @return {boolean}
|
|
1539
1420
|
*/
|
|
1540
|
-
|
|
1541
1421
|
}, {
|
|
1542
1422
|
key: "isSameDate",
|
|
1543
1423
|
value: function isSameDate(other) {
|
|
1544
1424
|
if (HDate.isHDate(other)) {
|
|
1545
1425
|
return this.year == other.year && this.month == other.month && this.day == other.day;
|
|
1546
1426
|
}
|
|
1547
|
-
|
|
1548
1427
|
return false;
|
|
1549
1428
|
}
|
|
1550
|
-
/** @return {string} */
|
|
1551
1429
|
|
|
1430
|
+
/** @return {string} */
|
|
1552
1431
|
}, {
|
|
1553
1432
|
key: "toString",
|
|
1554
1433
|
value: function toString() {
|
|
@@ -1557,24 +1436,24 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1557
1436
|
var monthName = this.getMonthName();
|
|
1558
1437
|
return "".concat(day, " ").concat(monthName, " ").concat(fullYear);
|
|
1559
1438
|
}
|
|
1439
|
+
|
|
1560
1440
|
/**
|
|
1561
1441
|
* Returns true if Hebrew year is a leap year
|
|
1562
1442
|
* @param {number} year Hebrew year
|
|
1563
1443
|
* @return {boolean}
|
|
1564
1444
|
*/
|
|
1565
|
-
|
|
1566
1445
|
}], [{
|
|
1567
1446
|
key: "hebrew2abs",
|
|
1568
1447
|
value: function hebrew2abs$1(year, month, day) {
|
|
1569
1448
|
return hebrew2abs(year, month, day);
|
|
1570
1449
|
}
|
|
1450
|
+
|
|
1571
1451
|
/**
|
|
1572
1452
|
* Converts absolute R.D. days to Hebrew date
|
|
1573
1453
|
* @private
|
|
1574
1454
|
* @param {number} abs absolute R.D. days
|
|
1575
1455
|
* @return {SimpleHebrewDate}
|
|
1576
1456
|
*/
|
|
1577
|
-
|
|
1578
1457
|
}, {
|
|
1579
1458
|
key: "abs2hebrew",
|
|
1580
1459
|
value: function abs2hebrew$1(abs) {
|
|
@@ -1590,17 +1469,13 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1590
1469
|
case 'ashkenazi':
|
|
1591
1470
|
return ' of';
|
|
1592
1471
|
}
|
|
1593
|
-
|
|
1594
1472
|
var ofStr = Locale.lookupTranslation('of', locale);
|
|
1595
|
-
|
|
1596
1473
|
if (ofStr) {
|
|
1597
1474
|
return ' ' + ofStr;
|
|
1598
1475
|
}
|
|
1599
|
-
|
|
1600
1476
|
if ('ashkenazi' === locale.substring(0, 9)) {
|
|
1601
1477
|
return ' of';
|
|
1602
1478
|
}
|
|
1603
|
-
|
|
1604
1479
|
return '';
|
|
1605
1480
|
}
|
|
1606
1481
|
}, {
|
|
@@ -1614,29 +1489,30 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1614
1489
|
value: function isLeapYear$1(year) {
|
|
1615
1490
|
return isLeapYear(year);
|
|
1616
1491
|
}
|
|
1492
|
+
|
|
1617
1493
|
/**
|
|
1618
1494
|
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
1619
1495
|
* @param {number} year Hebrew year
|
|
1620
1496
|
* @return {number}
|
|
1621
1497
|
*/
|
|
1622
|
-
|
|
1623
1498
|
}, {
|
|
1624
1499
|
key: "monthsInYear",
|
|
1625
1500
|
value: function monthsInYear$1(year) {
|
|
1626
1501
|
return monthsInYear(year);
|
|
1627
1502
|
}
|
|
1503
|
+
|
|
1628
1504
|
/**
|
|
1629
1505
|
* Number of days in Hebrew month in a given year (29 or 30)
|
|
1630
1506
|
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
1631
1507
|
* @param {number} year Hebrew year
|
|
1632
1508
|
* @return {number}
|
|
1633
1509
|
*/
|
|
1634
|
-
|
|
1635
1510
|
}, {
|
|
1636
1511
|
key: "daysInMonth",
|
|
1637
1512
|
value: function daysInMonth$1(month, year) {
|
|
1638
1513
|
return daysInMonth(month, year);
|
|
1639
1514
|
}
|
|
1515
|
+
|
|
1640
1516
|
/**
|
|
1641
1517
|
* Returns a transliterated string name of Hebrew month in year,
|
|
1642
1518
|
* for example 'Elul' or 'Cheshvan'.
|
|
@@ -1644,18 +1520,17 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1644
1520
|
* @param {number} year Hebrew year
|
|
1645
1521
|
* @return {string}
|
|
1646
1522
|
*/
|
|
1647
|
-
|
|
1648
1523
|
}, {
|
|
1649
1524
|
key: "getMonthName",
|
|
1650
1525
|
value: function getMonthName$1(month, year) {
|
|
1651
1526
|
return getMonthName(month, year);
|
|
1652
1527
|
}
|
|
1528
|
+
|
|
1653
1529
|
/**
|
|
1654
1530
|
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
1655
1531
|
* @param {number|string} month A number, or Hebrew month name string
|
|
1656
1532
|
* @return {number}
|
|
1657
1533
|
*/
|
|
1658
|
-
|
|
1659
1534
|
}, {
|
|
1660
1535
|
key: "monthNum",
|
|
1661
1536
|
value: function monthNum(month) {
|
|
@@ -1663,53 +1538,50 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1663
1538
|
if (isNaN(month) || month > 14) {
|
|
1664
1539
|
throw new RangeError("Invalid month number: ".concat(month));
|
|
1665
1540
|
}
|
|
1666
|
-
|
|
1667
1541
|
return month;
|
|
1668
1542
|
}
|
|
1669
|
-
|
|
1670
|
-
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ?
|
|
1671
|
-
/* number */
|
|
1543
|
+
return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
|
|
1672
1544
|
parseInt(month, 10) : HDate.monthFromName(month);
|
|
1673
1545
|
}
|
|
1546
|
+
|
|
1674
1547
|
/**
|
|
1675
1548
|
* Number of days in the hebrew YEAR
|
|
1676
1549
|
* @param {number} year Hebrew year
|
|
1677
1550
|
* @return {number}
|
|
1678
1551
|
*/
|
|
1679
|
-
|
|
1680
1552
|
}, {
|
|
1681
1553
|
key: "daysInYear",
|
|
1682
1554
|
value: function daysInYear$1(year) {
|
|
1683
1555
|
return daysInYear(year);
|
|
1684
1556
|
}
|
|
1557
|
+
|
|
1685
1558
|
/**
|
|
1686
1559
|
* true if Cheshvan is long in Hebrew year
|
|
1687
1560
|
* @param {number} year Hebrew year
|
|
1688
1561
|
* @return {boolean}
|
|
1689
1562
|
*/
|
|
1690
|
-
|
|
1691
1563
|
}, {
|
|
1692
1564
|
key: "longCheshvan",
|
|
1693
1565
|
value: function longCheshvan$1(year) {
|
|
1694
1566
|
return longCheshvan(year);
|
|
1695
1567
|
}
|
|
1568
|
+
|
|
1696
1569
|
/**
|
|
1697
1570
|
* true if Kislev is short in Hebrew year
|
|
1698
1571
|
* @param {number} year Hebrew year
|
|
1699
1572
|
* @return {boolean}
|
|
1700
1573
|
*/
|
|
1701
|
-
|
|
1702
1574
|
}, {
|
|
1703
1575
|
key: "shortKislev",
|
|
1704
1576
|
value: function shortKislev$1(year) {
|
|
1705
1577
|
return shortKislev(year);
|
|
1706
1578
|
}
|
|
1579
|
+
|
|
1707
1580
|
/**
|
|
1708
1581
|
* Converts Hebrew month string name to numeric
|
|
1709
1582
|
* @param {string} monthName monthName
|
|
1710
1583
|
* @return {number}
|
|
1711
1584
|
*/
|
|
1712
|
-
|
|
1713
1585
|
}, {
|
|
1714
1586
|
key: "monthFromName",
|
|
1715
1587
|
value: function monthFromName(monthName) {
|
|
@@ -1717,10 +1589,8 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1717
1589
|
if (isNaN(monthName) || monthName < 1 || monthName > 14) {
|
|
1718
1590
|
throw new RangeError("Invalid month name: ".concat(monthName));
|
|
1719
1591
|
}
|
|
1720
|
-
|
|
1721
1592
|
return monthName;
|
|
1722
1593
|
}
|
|
1723
|
-
|
|
1724
1594
|
var c = monthName.toLowerCase();
|
|
1725
1595
|
/*
|
|
1726
1596
|
the Hebrew months are unique to their second letter
|
|
@@ -1743,115 +1613,88 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1743
1613
|
ש שבט
|
|
1744
1614
|
תמ תש תמוז תשרי
|
|
1745
1615
|
*/
|
|
1746
|
-
|
|
1747
1616
|
switch (c[0]) {
|
|
1748
1617
|
case 'n':
|
|
1749
1618
|
case 'נ':
|
|
1750
1619
|
if (c[1] == 'o') {
|
|
1751
|
-
break;
|
|
1752
|
-
/* this catches "november" */
|
|
1620
|
+
break; /* this catches "november" */
|
|
1753
1621
|
}
|
|
1754
1622
|
|
|
1755
1623
|
return months.NISAN;
|
|
1756
|
-
|
|
1757
1624
|
case 'i':
|
|
1758
1625
|
return months.IYYAR;
|
|
1759
|
-
|
|
1760
1626
|
case 'e':
|
|
1761
1627
|
return months.ELUL;
|
|
1762
|
-
|
|
1763
1628
|
case 'c':
|
|
1764
1629
|
case 'ח':
|
|
1765
1630
|
return months.CHESHVAN;
|
|
1766
|
-
|
|
1767
1631
|
case 'k':
|
|
1768
1632
|
case 'כ':
|
|
1769
1633
|
return months.KISLEV;
|
|
1770
|
-
|
|
1771
1634
|
case 's':
|
|
1772
1635
|
switch (c[1]) {
|
|
1773
1636
|
case 'i':
|
|
1774
1637
|
return months.SIVAN;
|
|
1775
|
-
|
|
1776
1638
|
case 'h':
|
|
1777
1639
|
return months.SHVAT;
|
|
1778
1640
|
}
|
|
1779
|
-
|
|
1780
1641
|
case 't':
|
|
1781
1642
|
switch (c[1]) {
|
|
1782
1643
|
case 'a':
|
|
1783
1644
|
return months.TAMUZ;
|
|
1784
|
-
|
|
1785
1645
|
case 'i':
|
|
1786
1646
|
return months.TISHREI;
|
|
1787
|
-
|
|
1788
1647
|
case 'e':
|
|
1789
1648
|
return months.TEVET;
|
|
1790
1649
|
}
|
|
1791
|
-
|
|
1792
1650
|
break;
|
|
1793
|
-
|
|
1794
1651
|
case 'a':
|
|
1795
1652
|
switch (c[1]) {
|
|
1796
1653
|
case 'v':
|
|
1797
1654
|
return months.AV;
|
|
1798
|
-
|
|
1799
1655
|
case 'd':
|
|
1800
1656
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1801
1657
|
return months.ADAR_I;
|
|
1802
1658
|
}
|
|
1803
|
-
|
|
1804
1659
|
return months.ADAR_II;
|
|
1805
1660
|
// else assume sheini
|
|
1806
1661
|
}
|
|
1807
1662
|
|
|
1808
1663
|
break;
|
|
1809
|
-
|
|
1810
1664
|
case 'ס':
|
|
1811
1665
|
return months.SIVAN;
|
|
1812
|
-
|
|
1813
1666
|
case 'ט':
|
|
1814
1667
|
return months.TEVET;
|
|
1815
|
-
|
|
1816
1668
|
case 'ש':
|
|
1817
1669
|
return months.SHVAT;
|
|
1818
|
-
|
|
1819
1670
|
case 'א':
|
|
1820
1671
|
switch (c[1]) {
|
|
1821
1672
|
case 'ב':
|
|
1822
1673
|
return months.AV;
|
|
1823
|
-
|
|
1824
1674
|
case 'ד':
|
|
1825
1675
|
if (/(1|[^i]i|a|א)$/i.test(monthName)) {
|
|
1826
1676
|
return months.ADAR_I;
|
|
1827
1677
|
}
|
|
1828
|
-
|
|
1829
1678
|
return months.ADAR_II;
|
|
1830
1679
|
// else assume sheini
|
|
1831
|
-
|
|
1832
1680
|
case 'י':
|
|
1833
1681
|
return months.IYYAR;
|
|
1834
|
-
|
|
1835
1682
|
case 'ל':
|
|
1836
1683
|
return months.ELUL;
|
|
1837
1684
|
}
|
|
1838
|
-
|
|
1839
1685
|
break;
|
|
1840
|
-
|
|
1841
1686
|
case 'ת':
|
|
1842
1687
|
switch (c[1]) {
|
|
1843
1688
|
case 'מ':
|
|
1844
1689
|
return months.TAMUZ;
|
|
1845
|
-
|
|
1846
1690
|
case 'ש':
|
|
1847
1691
|
return months.TISHREI;
|
|
1848
1692
|
}
|
|
1849
|
-
|
|
1850
1693
|
break;
|
|
1851
1694
|
}
|
|
1852
|
-
|
|
1853
1695
|
throw new RangeError("Unable to parse month name: ".concat(monthName));
|
|
1854
1696
|
}
|
|
1697
|
+
|
|
1855
1698
|
/**
|
|
1856
1699
|
* Note: Applying this function to d+6 gives us the DAYNAME on or after an
|
|
1857
1700
|
* absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
|
|
@@ -1861,75 +1704,66 @@ var HDate = /*#__PURE__*/function () {
|
|
|
1861
1704
|
* @param {number} absdate
|
|
1862
1705
|
* @return {number}
|
|
1863
1706
|
*/
|
|
1864
|
-
|
|
1865
1707
|
}, {
|
|
1866
1708
|
key: "dayOnOrBefore",
|
|
1867
1709
|
value: function dayOnOrBefore(dayOfWeek, absdate) {
|
|
1868
1710
|
return absdate - (absdate - dayOfWeek) % 7;
|
|
1869
1711
|
}
|
|
1712
|
+
|
|
1870
1713
|
/**
|
|
1871
1714
|
* Tests if the object is an instance of `HDate`
|
|
1872
1715
|
* @param {any} obj
|
|
1873
1716
|
* @return {boolean}
|
|
1874
1717
|
*/
|
|
1875
|
-
|
|
1876
1718
|
}, {
|
|
1877
1719
|
key: "isHDate",
|
|
1878
1720
|
value: function isHDate(obj) {
|
|
1879
1721
|
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
1722
|
}
|
|
1881
1723
|
}]);
|
|
1882
|
-
|
|
1883
1724
|
return HDate;
|
|
1884
1725
|
}();
|
|
1726
|
+
|
|
1885
1727
|
/**
|
|
1886
1728
|
* @private
|
|
1887
1729
|
* @param {HDate} date
|
|
1888
1730
|
*/
|
|
1889
|
-
|
|
1890
1731
|
function fix(date) {
|
|
1891
1732
|
fixMonth(date);
|
|
1892
1733
|
fixDate(date);
|
|
1893
1734
|
}
|
|
1735
|
+
|
|
1894
1736
|
/**
|
|
1895
1737
|
* @private
|
|
1896
1738
|
* @param {HDate} date
|
|
1897
1739
|
*/
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
1740
|
function fixDate(date) {
|
|
1901
1741
|
if (date.day < 1) {
|
|
1902
1742
|
if (date.month == months.TISHREI) {
|
|
1903
1743
|
date.year -= 1;
|
|
1904
1744
|
}
|
|
1905
|
-
|
|
1906
1745
|
date.day += daysInMonth(date.month, date.year);
|
|
1907
1746
|
date.month -= 1;
|
|
1908
1747
|
fix(date);
|
|
1909
1748
|
}
|
|
1910
|
-
|
|
1911
1749
|
if (date.day > daysInMonth(date.month, date.year)) {
|
|
1912
1750
|
if (date.month === months.ELUL) {
|
|
1913
1751
|
date.year += 1;
|
|
1914
1752
|
}
|
|
1915
|
-
|
|
1916
1753
|
date.day -= daysInMonth(date.month, date.year);
|
|
1917
1754
|
date.month += 1;
|
|
1918
1755
|
fix(date);
|
|
1919
1756
|
}
|
|
1920
|
-
|
|
1921
1757
|
fixMonth(date);
|
|
1922
1758
|
}
|
|
1759
|
+
|
|
1923
1760
|
/**
|
|
1924
1761
|
* @private
|
|
1925
1762
|
* @param {HDate} date
|
|
1926
1763
|
*/
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
1764
|
function fixMonth(date) {
|
|
1930
1765
|
if (date.month === months.ADAR_II && !date.isLeapYear()) {
|
|
1931
1766
|
date.month -= 1; // to Adar I
|
|
1932
|
-
|
|
1933
1767
|
fix(date);
|
|
1934
1768
|
} else if (date.month < 1) {
|
|
1935
1769
|
date.month += monthsInYear(date.year);
|
|
@@ -1940,9 +1774,9 @@ function fixMonth(date) {
|
|
|
1940
1774
|
date.year += 1;
|
|
1941
1775
|
fix(date);
|
|
1942
1776
|
}
|
|
1943
|
-
|
|
1944
1777
|
delete date.abs0;
|
|
1945
1778
|
}
|
|
1779
|
+
|
|
1946
1780
|
/**
|
|
1947
1781
|
* @private
|
|
1948
1782
|
* @param {number} day
|
|
@@ -1950,8 +1784,6 @@ function fixMonth(date) {
|
|
|
1950
1784
|
* @param {number} offset
|
|
1951
1785
|
* @return {HDate}
|
|
1952
1786
|
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
1787
|
function _onOrBefore(day, t, offset) {
|
|
1956
1788
|
return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
|
|
1957
1789
|
}
|
|
@@ -1963,13 +1795,13 @@ var TEVET = months.TEVET;
|
|
|
1963
1795
|
var SHVAT = months.SHVAT;
|
|
1964
1796
|
var ADAR_I = months.ADAR_I;
|
|
1965
1797
|
var ADAR_II = months.ADAR_II;
|
|
1798
|
+
|
|
1966
1799
|
/**
|
|
1967
1800
|
* @private
|
|
1968
1801
|
* @param {number} hyear Hebrew year
|
|
1969
1802
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of death
|
|
1970
1803
|
* @return {HDate} anniversary occurring in hyear
|
|
1971
1804
|
*/
|
|
1972
|
-
|
|
1973
1805
|
function getYahrzeit_(hyear, gdate) {
|
|
1974
1806
|
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
1975
1807
|
var hDeath = {
|
|
@@ -1977,12 +1809,10 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1977
1809
|
mm: orig.getMonth(),
|
|
1978
1810
|
dd: orig.getDate()
|
|
1979
1811
|
};
|
|
1980
|
-
|
|
1981
1812
|
if (hyear <= hDeath.yy) {
|
|
1982
1813
|
// `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
|
|
1983
1814
|
return undefined;
|
|
1984
1815
|
}
|
|
1985
|
-
|
|
1986
1816
|
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hDeath.yy + 1)) {
|
|
1987
1817
|
// If it's Heshvan 30 it depends on the first anniversary;
|
|
1988
1818
|
// if that was not Heshvan 30, use the day before Kislev 1.
|
|
@@ -1999,10 +1829,10 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
1999
1829
|
// (so Adar has only 29 days), use the last day in Shevat.
|
|
2000
1830
|
hDeath.dd = 30;
|
|
2001
1831
|
hDeath.mm = SHVAT;
|
|
2002
|
-
}
|
|
2003
|
-
//
|
|
2004
|
-
|
|
1832
|
+
}
|
|
1833
|
+
// In all other cases, use the normal anniversary of the date of death.
|
|
2005
1834
|
|
|
1835
|
+
// advance day to rosh chodesh if needed
|
|
2006
1836
|
if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !longCheshvan(hyear)) {
|
|
2007
1837
|
hDeath.mm = KISLEV;
|
|
2008
1838
|
hDeath.dd = 1;
|
|
@@ -2010,29 +1840,25 @@ function getYahrzeit_(hyear, gdate) {
|
|
|
2010
1840
|
hDeath.mm = TEVET;
|
|
2011
1841
|
hDeath.dd = 1;
|
|
2012
1842
|
}
|
|
2013
|
-
|
|
2014
1843
|
return new HDate(hDeath.dd, hDeath.mm, hyear);
|
|
2015
1844
|
}
|
|
1845
|
+
|
|
2016
1846
|
/**
|
|
2017
1847
|
* @private
|
|
2018
1848
|
* @param {number} hyear Hebrew year
|
|
2019
1849
|
* @param {Date|HDate} gdate Gregorian or Hebrew date of event
|
|
2020
1850
|
* @return {HDate} anniversary occurring in `hyear`
|
|
2021
1851
|
*/
|
|
2022
|
-
|
|
2023
1852
|
function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
2024
1853
|
var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
|
|
2025
1854
|
var origYear = orig.getFullYear();
|
|
2026
|
-
|
|
2027
1855
|
if (hyear <= origYear) {
|
|
2028
1856
|
// `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
|
|
2029
1857
|
return undefined;
|
|
2030
1858
|
}
|
|
2031
|
-
|
|
2032
1859
|
var isOrigLeap = isLeapYear(origYear);
|
|
2033
1860
|
var month = orig.getMonth();
|
|
2034
1861
|
var day = orig.getDate();
|
|
2035
|
-
|
|
2036
1862
|
if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
|
|
2037
1863
|
month = monthsInYear(hyear);
|
|
2038
1864
|
} else if (month == CHESHVAN && day == 30 && !longCheshvan(hyear)) {
|
|
@@ -2045,11 +1871,10 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
2045
1871
|
month = NISAN;
|
|
2046
1872
|
day = 1;
|
|
2047
1873
|
}
|
|
2048
|
-
|
|
2049
1874
|
return new HDate(day, month, hyear);
|
|
2050
1875
|
}
|
|
2051
1876
|
|
|
2052
|
-
var version="3.45.
|
|
1877
|
+
var version="3.45.5";
|
|
2053
1878
|
|
|
2054
1879
|
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
1880
|
|