@hebcal/core 4.3.3 → 4.3.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.
@@ -1,10 +1,10 @@
1
- /*! @hebcal/core v4.3.3 */
1
+ /*! @hebcal/core v4.3.5 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
5
- var GERESH = '׳';
6
- var GERSHAYIM = '״';
7
- var heb2num = {
5
+ const GERESH = '׳';
6
+ const GERSHAYIM = '״';
7
+ const heb2num = {
8
8
  'א': 1,
9
9
  'ב': 2,
10
10
  'ג': 3,
@@ -28,9 +28,9 @@ var heb2num = {
28
28
  'ש': 300,
29
29
  'ת': 400
30
30
  };
31
- var num2heb = {};
32
- Object.keys(heb2num).forEach(function (key) {
33
- var val = heb2num[key];
31
+ const num2heb = {};
32
+ Object.keys(heb2num).forEach(key => {
33
+ const val = heb2num[key];
34
34
  num2heb[val] = key;
35
35
  });
36
36
 
@@ -40,15 +40,15 @@ Object.keys(heb2num).forEach(function (key) {
40
40
  * @return {number[]}
41
41
  */
42
42
  function num2digits(num) {
43
- var digits = [];
43
+ const digits = [];
44
44
  while (num > 0) {
45
45
  if (num === 15 || num === 16) {
46
46
  digits.push(9);
47
47
  digits.push(num - 9);
48
48
  break;
49
49
  }
50
- var incr = 100;
51
- var i = void 0;
50
+ let incr = 100;
51
+ let i;
52
52
  for (i = 400; i > num; i -= incr) {
53
53
  if (i === incr) {
54
54
  incr = incr / 10;
@@ -75,28 +75,28 @@ function num2digits(num) {
75
75
  * @return {string}
76
76
  */
77
77
  function gematriya(number) {
78
- var num = parseInt(number, 10);
78
+ const num = parseInt(number, 10);
79
79
  if (!num) {
80
- throw new TypeError("invalid parameter to gematriya ".concat(number));
80
+ throw new TypeError(`invalid parameter to gematriya ${number}`);
81
81
  }
82
- var str = '';
83
- var thousands = Math.floor(num / 1000);
82
+ let str = '';
83
+ const thousands = Math.floor(num / 1000);
84
84
  if (thousands > 0 && thousands !== 5) {
85
- var tdigits = num2digits(thousands);
86
- for (var i = 0; i < tdigits.length; i++) {
85
+ const tdigits = num2digits(thousands);
86
+ for (let i = 0; i < tdigits.length; i++) {
87
87
  str += num2heb[tdigits[i]];
88
88
  }
89
89
  str += GERESH;
90
90
  }
91
- var digits = num2digits(num % 1000);
91
+ const digits = num2digits(num % 1000);
92
92
  if (digits.length == 1) {
93
93
  return str + num2heb[digits[0]] + GERESH;
94
94
  }
95
- for (var _i = 0; _i < digits.length; _i++) {
96
- if (_i + 1 === digits.length) {
95
+ for (let i = 0; i < digits.length; i++) {
96
+ if (i + 1 === digits.length) {
97
97
  str += GERSHAYIM;
98
98
  }
99
- str += num2heb[digits[_i]];
99
+ str += num2heb[digits[i]];
100
100
  }
101
101
  return str;
102
102
  }
@@ -112,15 +112,15 @@ function gematriya(number) {
112
112
  * @return {number}
113
113
  */
114
114
  function gematriyaStrToNum(str) {
115
- var num = 0;
116
- var gereshIdx = str.indexOf(GERESH);
115
+ let num = 0;
116
+ const gereshIdx = str.indexOf(GERESH);
117
117
  if (gereshIdx !== -1 && gereshIdx !== str.length - 1) {
118
- var thousands = str.substring(0, gereshIdx);
118
+ const thousands = str.substring(0, gereshIdx);
119
119
  num += gematriyaStrToNum(thousands) * 1000;
120
120
  str = str.substring(gereshIdx);
121
121
  }
122
- for (var i = 0; i < str.length; i++) {
123
- var n = heb2num[str[i]];
122
+ for (let i = 0; i < str.length; i++) {
123
+ const n = heb2num[str[i]];
124
124
  if (typeof n === 'number') {
125
125
  num += n;
126
126
  }
@@ -128,60 +128,14 @@ function gematriyaStrToNum(str) {
128
128
  return num;
129
129
  }
130
130
 
131
- function _typeof(o) {
132
- "@babel/helpers - typeof";
133
-
134
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
135
- return typeof o;
136
- } : function (o) {
137
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
138
- }, _typeof(o);
139
- }
140
- function _classCallCheck(instance, Constructor) {
141
- if (!(instance instanceof Constructor)) {
142
- throw new TypeError("Cannot call a class as a function");
143
- }
144
- }
145
- function _defineProperties(target, props) {
146
- for (var i = 0; i < props.length; i++) {
147
- var descriptor = props[i];
148
- descriptor.enumerable = descriptor.enumerable || false;
149
- descriptor.configurable = true;
150
- if ("value" in descriptor) descriptor.writable = true;
151
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
152
- }
153
- }
154
- function _createClass(Constructor, protoProps, staticProps) {
155
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
156
- if (staticProps) _defineProperties(Constructor, staticProps);
157
- Object.defineProperty(Constructor, "prototype", {
158
- writable: false
159
- });
160
- return Constructor;
161
- }
162
- function _toPrimitive(input, hint) {
163
- if (typeof input !== "object" || input === null) return input;
164
- var prim = input[Symbol.toPrimitive];
165
- if (prim !== undefined) {
166
- var res = prim.call(input, hint || "default");
167
- if (typeof res !== "object") return res;
168
- throw new TypeError("@@toPrimitive must return a primitive value.");
169
- }
170
- return (hint === "string" ? String : Number)(input);
171
- }
172
- function _toPropertyKey(arg) {
173
- var key = _toPrimitive(arg, "string");
174
- return typeof key === "symbol" ? key : String(key);
175
- }
176
-
177
131
  /*
178
132
  * More minimal greg routines
179
133
  */
180
134
 
181
135
  /** @private */
182
- var lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
136
+ const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
183
137
  /** @private */
184
- var monthLengths = [lengths, lengths.slice()];
138
+ const monthLengths = [lengths, lengths.slice()];
185
139
  monthLengths[1][2] = 29;
186
140
 
187
141
  /**
@@ -233,7 +187,7 @@ function daysInMonth$1(month, year) {
233
187
  * @return {boolean}
234
188
  */
235
189
  function isDate(obj) {
236
- return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
190
+ return typeof obj === 'object' && Date.prototype === obj.__proto__;
237
191
  }
238
192
 
239
193
  /*
@@ -249,9 +203,9 @@ const ABS_2SEP1752 = 639785;
249
203
  */
250
204
  function greg2abs(date) {
251
205
  if (!isDate(date)) {
252
- throw new TypeError("Argument not a Date: ".concat(date));
206
+ throw new TypeError(`Argument not a Date: ${date}`);
253
207
  }
254
- var abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
208
+ const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
255
209
  /*
256
210
  if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
257
211
  throw new RangeError(`Invalid Date: ${date}`);
@@ -266,15 +220,15 @@ function greg2abs(date) {
266
220
  * @return {number}
267
221
  */
268
222
  function yearFromFixed(abs) {
269
- var l0 = abs - 1;
270
- var n400 = quotient(l0, 146097);
271
- var d1 = mod(l0, 146097);
272
- var n100 = quotient(d1, 36524);
273
- var d2 = mod(d1, 36524);
274
- var n4 = quotient(d2, 1461);
275
- var d3 = mod(d2, 1461);
276
- var n1 = quotient(d3, 365);
277
- var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
223
+ const l0 = abs - 1;
224
+ const n400 = quotient(l0, 146097);
225
+ const d1 = mod(l0, 146097);
226
+ const n100 = quotient(d1, 36524);
227
+ const d2 = mod(d1, 36524);
228
+ const n4 = quotient(d2, 1461);
229
+ const d3 = mod(d2, 1461);
230
+ const n1 = quotient(d3, 365);
231
+ const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
278
232
  return n100 != 4 && n1 != 4 ? year + 1 : year;
279
233
  }
280
234
 
@@ -286,7 +240,7 @@ function yearFromFixed(abs) {
286
240
  * @return {number}
287
241
  */
288
242
  function toFixed(year, month, day) {
289
- var py = year - 1;
243
+ const py = year - 1;
290
244
  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;
291
245
  }
292
246
 
@@ -302,7 +256,7 @@ function toFixed(year, month, day) {
302
256
  */
303
257
  function abs2greg(abs) {
304
258
  if (typeof abs !== 'number') {
305
- throw new TypeError("Argument not a Number: ".concat(abs));
259
+ throw new TypeError(`Argument not a Number: ${abs}`);
306
260
  }
307
261
  abs = Math.trunc(abs);
308
262
  /*
@@ -310,12 +264,12 @@ function abs2greg(abs) {
310
264
  throw new RangeError(`Invalid Date: ${abs}`);
311
265
  }
312
266
  */
313
- var year = yearFromFixed(abs);
314
- var priorDays = abs - toFixed(year, 1, 1);
315
- var correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
316
- var month = quotient(12 * (priorDays + correction) + 373, 367);
317
- var day = abs - toFixed(year, month, 1) + 1;
318
- var dt = new Date(year, month - 1, day);
267
+ const year = yearFromFixed(abs);
268
+ const priorDays = abs - toFixed(year, 1, 1);
269
+ const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear$1(year) ? 1 : 2;
270
+ const month = quotient(12 * (priorDays + correction) + 373, 367);
271
+ const day = abs - toFixed(year, month, 1) + 1;
272
+ const dt = new Date(year, month - 1, day);
319
273
  if (year < 100 && year >= 0) {
320
274
  dt.setFullYear(year);
321
275
  }
@@ -347,7 +301,7 @@ function abs2greg(abs) {
347
301
  /**
348
302
  * Gregorian date helper functions.
349
303
  */
350
- var greg = {
304
+ const greg = {
351
305
  /**
352
306
  * Long names of the Gregorian months (1='January', 12='December')
353
307
  * @readonly
@@ -382,12 +336,12 @@ var greg = {
382
336
  * @param {Date} date Gregorian date
383
337
  * @return {number}
384
338
  */
385
- dayOfYear: function dayOfYear(date) {
339
+ dayOfYear: function (date) {
386
340
  if (!isDate(date)) {
387
- throw new TypeError("Argument not a Date: ".concat(date));
341
+ throw new TypeError(`Argument not a Date: ${date}`);
388
342
  }
389
- var month = date.getMonth();
390
- var doy = date.getDate() + 31 * month;
343
+ const month = date.getMonth();
344
+ let doy = date.getDate() + 31 * month;
391
345
  if (month > 1) {
392
346
  // FEB
393
347
  doy -= Math.floor((4 * (month + 1) + 23) / 10);
@@ -417,7 +371,7 @@ var greg = {
417
371
  abs2greg: abs2greg
418
372
  };
419
373
 
420
- var noopLocale = {
374
+ const noopLocale = {
421
375
  headers: {
422
376
  'plural-forms': 'nplurals=2; plural=(n!=1);'
423
377
  },
@@ -425,7 +379,7 @@ var noopLocale = {
425
379
  '': {}
426
380
  }
427
381
  };
428
- var alias = {
382
+ const alias = {
429
383
  'h': 'he',
430
384
  'a': 'ashkenazi',
431
385
  's': 'en',
@@ -433,11 +387,11 @@ var alias = {
433
387
  };
434
388
 
435
389
  /** @private */
436
- var locales = Object.create(null);
390
+ const locales = Object.create(null);
437
391
  /** @private */
438
- var activeLocale = null;
392
+ let activeLocale = null;
439
393
  /** @private */
440
- var activeName = null;
394
+ let activeName = null;
441
395
 
442
396
  /**
443
397
  * A locale in Hebcal is used for translations/transliterations of
@@ -447,217 +401,189 @@ var activeName = null;
447
401
  * * `he` - Hebrew (e.g. "שַׁבָּת")
448
402
  * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
449
403
  */
450
- var Locale = /*#__PURE__*/function () {
451
- function Locale() {
452
- _classCallCheck(this, Locale);
453
- }
454
- _createClass(Locale, null, [{
455
- key: "lookupTranslation",
456
- value:
457
- /**
458
- * Returns translation only if `locale` offers a non-empty translation for `id`.
459
- * Otherwise, returns `undefined`.
460
- * @param {string} id Message ID to translate
461
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
462
- * @return {string}
463
- */
464
- function lookupTranslation(id, locale) {
465
- var locale0 = locale && locale.toLowerCase();
466
- var loc = typeof locale == 'string' && locales[locale0] || activeLocale;
467
- var array = loc[id];
468
- if (array && array.length && array[0].length) {
469
- return array[0];
470
- }
471
- return undefined;
472
- }
473
-
474
- /**
475
- * By default, if no translation was found, returns `id`.
476
- * @param {string} id Message ID to translate
477
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
478
- * @return {string}
479
- */
480
- }, {
481
- key: "gettext",
482
- value: function gettext(id, locale) {
483
- var text = this.lookupTranslation(id, locale);
484
- if (typeof text == 'undefined') {
485
- return id;
486
- }
487
- return text;
404
+ class Locale {
405
+ /**
406
+ * Returns translation only if `locale` offers a non-empty translation for `id`.
407
+ * Otherwise, returns `undefined`.
408
+ * @param {string} id Message ID to translate
409
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
410
+ * @return {string}
411
+ */
412
+ static lookupTranslation(id, locale) {
413
+ const locale0 = locale && locale.toLowerCase();
414
+ const loc = typeof locale == 'string' && locales[locale0] || activeLocale;
415
+ const array = loc[id];
416
+ if (array && array.length && array[0].length) {
417
+ return array[0];
488
418
  }
419
+ return undefined;
420
+ }
489
421
 
490
- /**
491
- * Register locale translations.
492
- * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
493
- * @param {LocaleData} data parsed data from a `.po` file.
494
- */
495
- }, {
496
- key: "addLocale",
497
- value: function addLocale(locale, data) {
498
- if (typeof locale !== 'string') {
499
- throw new TypeError("Invalid locale name: ".concat(locale));
500
- }
501
- if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
502
- throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
503
- }
504
- locales[locale.toLowerCase()] = data.contexts[''];
422
+ /**
423
+ * By default, if no translation was found, returns `id`.
424
+ * @param {string} id Message ID to translate
425
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
426
+ * @return {string}
427
+ */
428
+ static gettext(id, locale) {
429
+ const text = this.lookupTranslation(id, locale);
430
+ if (typeof text == 'undefined') {
431
+ return id;
505
432
  }
433
+ return text;
434
+ }
506
435
 
507
- /**
508
- * Adds a translation to `locale`, replacing any previous translation.
509
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
510
- * @param {string} id Message ID to translate
511
- * @param {string} translation Translation text
512
- */
513
- }, {
514
- key: "addTranslation",
515
- value: function addTranslation(locale, id, translation) {
516
- if (typeof locale !== 'string') {
517
- throw new TypeError("Invalid locale name: ".concat(locale));
518
- }
519
- var locale0 = locale.toLowerCase();
520
- var loc = locales[locale0];
521
- if (!loc) {
522
- throw new TypeError("Unknown locale: ".concat(locale));
523
- }
524
- if (typeof id !== 'string' || id.length === 0) {
525
- throw new TypeError("Invalid id: ".concat(id));
526
- }
527
- var isArray = Array.isArray(translation);
528
- if (isArray) {
529
- var t0 = translation[0];
530
- if (typeof t0 !== 'string' || t0.length === 0) {
531
- throw new TypeError("Invalid translation array: ".concat(translation));
532
- }
533
- } else if (typeof translation !== 'string') {
534
- throw new TypeError("Invalid translation: ".concat(translation));
535
- }
536
- loc[id] = isArray ? translation : [translation];
436
+ /**
437
+ * Register locale translations.
438
+ * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
439
+ * @param {LocaleData} data parsed data from a `.po` file.
440
+ */
441
+ static addLocale(locale, data) {
442
+ if (typeof locale !== 'string') {
443
+ throw new TypeError(`Invalid locale name: ${locale}`);
537
444
  }
538
- /**
539
- * Adds multiple translations to `locale`, replacing any previous translations.
540
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
541
- * @param {LocaleData} data parsed data from a `.po` file.
542
- */
543
- }, {
544
- key: "addTranslations",
545
- value: function addTranslations(locale, data) {
546
- if (typeof locale !== 'string') {
547
- throw new TypeError("Invalid locale name: ".concat(locale));
548
- }
549
- var locale0 = locale.toLowerCase();
550
- var loc = locales[locale0];
551
- if (!loc) {
552
- throw new TypeError("Unknown locale: ".concat(locale));
553
- }
554
- if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
555
- throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
556
- }
557
- var ctx = data.contexts[''];
558
- Object.keys(ctx).forEach(function (id) {
559
- loc[id] = ctx[id];
560
- });
445
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
446
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
561
447
  }
562
- /**
563
- * Activates a locale. Throws an error if the locale has not been previously added.
564
- * After setting the locale to be used, all strings marked for translations
565
- * will be represented by the corresponding translation in the specified locale.
566
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
567
- * @return {LocaleData}
568
- */
569
- }, {
570
- key: "useLocale",
571
- value: function useLocale(locale) {
572
- var locale0 = locale.toLowerCase();
573
- var obj = locales[locale0];
574
- if (!obj) {
575
- throw new RangeError("Locale '".concat(locale, "' not found"));
448
+ locales[locale.toLowerCase()] = data.contexts[''];
449
+ }
450
+
451
+ /**
452
+ * Adds a translation to `locale`, replacing any previous translation.
453
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
454
+ * @param {string} id Message ID to translate
455
+ * @param {string} translation Translation text
456
+ */
457
+ static addTranslation(locale, id, translation) {
458
+ if (typeof locale !== 'string') {
459
+ throw new TypeError(`Invalid locale name: ${locale}`);
460
+ }
461
+ const locale0 = locale.toLowerCase();
462
+ const loc = locales[locale0];
463
+ if (!loc) {
464
+ throw new TypeError(`Unknown locale: ${locale}`);
465
+ }
466
+ if (typeof id !== 'string' || id.length === 0) {
467
+ throw new TypeError(`Invalid id: ${id}`);
468
+ }
469
+ const isArray = Array.isArray(translation);
470
+ if (isArray) {
471
+ const t0 = translation[0];
472
+ if (typeof t0 !== 'string' || t0.length === 0) {
473
+ throw new TypeError(`Invalid translation array: ${translation}`);
576
474
  }
577
- activeName = alias[locale0] || locale0;
578
- activeLocale = obj;
579
- return activeLocale;
475
+ } else if (typeof translation !== 'string') {
476
+ throw new TypeError(`Invalid translation: ${translation}`);
580
477
  }
478
+ loc[id] = isArray ? translation : [translation];
479
+ }
480
+ /**
481
+ * Adds multiple translations to `locale`, replacing any previous translations.
482
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
483
+ * @param {LocaleData} data parsed data from a `.po` file.
484
+ */
485
+ static addTranslations(locale, data) {
486
+ if (typeof locale !== 'string') {
487
+ throw new TypeError(`Invalid locale name: ${locale}`);
488
+ }
489
+ const locale0 = locale.toLowerCase();
490
+ const loc = locales[locale0];
491
+ if (!loc) {
492
+ throw new TypeError(`Unknown locale: ${locale}`);
493
+ }
494
+ if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
495
+ throw new TypeError(`Locale '${locale}' invalid compact format`);
496
+ }
497
+ const ctx = data.contexts[''];
498
+ Object.keys(ctx).forEach(id => {
499
+ loc[id] = ctx[id];
500
+ });
501
+ }
502
+ /**
503
+ * Activates a locale. Throws an error if the locale has not been previously added.
504
+ * After setting the locale to be used, all strings marked for translations
505
+ * will be represented by the corresponding translation in the specified locale.
506
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
507
+ * @return {LocaleData}
508
+ */
509
+ static useLocale(locale) {
510
+ const locale0 = locale.toLowerCase();
511
+ const obj = locales[locale0];
512
+ if (!obj) {
513
+ throw new RangeError(`Locale '${locale}' not found`);
514
+ }
515
+ activeName = alias[locale0] || locale0;
516
+ activeLocale = obj;
517
+ return activeLocale;
518
+ }
581
519
 
582
- /**
583
- * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
584
- * @return {string}
585
- */
586
- }, {
587
- key: "getLocaleName",
588
- value: function getLocaleName() {
589
- return activeName;
590
- }
520
+ /**
521
+ * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
522
+ * @return {string}
523
+ */
524
+ static getLocaleName() {
525
+ return activeName;
526
+ }
591
527
 
592
- /**
593
- * Returns the names of registered locales
594
- * @return {string[]}
595
- */
596
- }, {
597
- key: "getLocaleNames",
598
- value: function getLocaleNames() {
599
- return Object.keys(locales).sort();
600
- }
528
+ /**
529
+ * Returns the names of registered locales
530
+ * @return {string[]}
531
+ */
532
+ static getLocaleNames() {
533
+ return Object.keys(locales).sort();
534
+ }
601
535
 
602
- /**
603
- * @param {number} n
604
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
605
- * @return {string}
606
- */
607
- }, {
608
- key: "ordinal",
609
- value: function ordinal(n, locale) {
610
- var locale1 = locale && locale.toLowerCase();
611
- var locale0 = locale1 || activeName;
612
- if (!locale0) {
536
+ /**
537
+ * @param {number} n
538
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
539
+ * @return {string}
540
+ */
541
+ static ordinal(n, locale) {
542
+ const locale1 = locale && locale.toLowerCase();
543
+ const locale0 = locale1 || activeName;
544
+ if (!locale0) {
545
+ return this.getEnOrdinal(n);
546
+ }
547
+ switch (locale0) {
548
+ case 'en':
549
+ case 's':
550
+ case 'a':
551
+ case 'ashkenazi':
552
+ case 'ashkenazi_litvish':
553
+ case 'ashkenazi_poylish':
554
+ case 'ashkenazi_standard':
613
555
  return this.getEnOrdinal(n);
614
- }
615
- switch (locale0) {
616
- case 'en':
617
- case 's':
618
- case 'a':
619
- case 'ashkenazi':
620
- case 'ashkenazi_litvish':
621
- case 'ashkenazi_poylish':
622
- case 'ashkenazi_standard':
623
- return this.getEnOrdinal(n);
624
- case 'es':
625
- return n + 'º';
626
- case 'h':
627
- case 'he':
628
- case 'he-x-nonikud':
629
- return String(n);
630
- default:
631
- return n + '.';
632
- }
556
+ case 'es':
557
+ return n + 'º';
558
+ case 'h':
559
+ case 'he':
560
+ case 'he-x-nonikud':
561
+ return String(n);
562
+ default:
563
+ return n + '.';
633
564
  }
565
+ }
634
566
 
635
- /**
636
- * @private
637
- * @param {number} n
638
- * @return {string}
639
- */
640
- }, {
641
- key: "getEnOrdinal",
642
- value: function getEnOrdinal(n) {
643
- var s = ['th', 'st', 'nd', 'rd'];
644
- var v = n % 100;
645
- return n + (s[(v - 20) % 10] || s[v] || s[0]);
646
- }
567
+ /**
568
+ * @private
569
+ * @param {number} n
570
+ * @return {string}
571
+ */
572
+ static getEnOrdinal(n) {
573
+ const s = ['th', 'st', 'nd', 'rd'];
574
+ const v = n % 100;
575
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
576
+ }
647
577
 
648
- /**
649
- * Removes nekudot from Hebrew string
650
- * @param {string} str
651
- * @return {string}
652
- */
653
- }, {
654
- key: "hebrewStripNikkud",
655
- value: function hebrewStripNikkud(str) {
656
- return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
657
- }
658
- }]);
659
- return Locale;
660
- }();
578
+ /**
579
+ * Removes nekudot from Hebrew string
580
+ * @param {string} str
581
+ * @return {string}
582
+ */
583
+ static hebrewStripNikkud(str) {
584
+ return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
585
+ }
586
+ }
661
587
  Locale.addLocale('en', noopLocale);
662
588
  Locale.addLocale('s', noopLocale);
663
589
  Locale.addLocale('', noopLocale);
@@ -667,26 +593,26 @@ Locale.useLocale('en');
667
593
  * More minimal HDate
668
594
  */
669
595
 
670
- var NISAN$1 = 1;
671
- var IYYAR = 2;
596
+ const NISAN$1 = 1;
597
+ const IYYAR = 2;
672
598
  // const SIVAN = 3;
673
- var TAMUZ = 4;
599
+ const TAMUZ = 4;
674
600
  // const AV = 5;
675
- var ELUL = 6;
676
- var TISHREI = 7;
677
- var CHESHVAN$1 = 8;
678
- var KISLEV$1 = 9;
679
- var TEVET$1 = 10;
601
+ const ELUL = 6;
602
+ const TISHREI = 7;
603
+ const CHESHVAN$1 = 8;
604
+ const KISLEV$1 = 9;
605
+ const TEVET$1 = 10;
680
606
  // const SHVAT = 11;
681
- var ADAR_I$1 = 12;
682
- var ADAR_II$1 = 13;
607
+ const ADAR_I$1 = 12;
608
+ const ADAR_II$1 = 13;
683
609
 
684
610
  /**
685
611
  * Hebrew months of the year (NISAN=1, TISHREI=7)
686
612
  * @readonly
687
613
  * @enum {number}
688
614
  */
689
- var months = {
615
+ const months = {
690
616
  /** Nissan / ניסן */
691
617
  NISAN: 1,
692
618
  /** Iyyar / אייר */
@@ -699,7 +625,7 @@ var months = {
699
625
  AV: 5,
700
626
  /** Elul / אלול */
701
627
  ELUL: 6,
702
- /** Tishrei / תִשְׁרֵי */
628
+ /** Tishrei / תִּשְׁרֵי */
703
629
  TISHREI: 7,
704
630
  /** Cheshvan / חשון */
705
631
  CHESHVAN: 8,
@@ -714,18 +640,18 @@ var months = {
714
640
  /** Adar Sheini (only on leap years) / אדר ב׳ */
715
641
  ADAR_II: 13
716
642
  };
717
- var monthNames0 = ['', 'Nisan', 'Iyyar', 'Sivan', 'Tamuz', 'Av', 'Elul', 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Sh\'vat'];
643
+ const monthNames0 = ['', 'Nisan', 'Iyyar', 'Sivan', 'Tamuz', 'Av', 'Elul', 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Sh\'vat'];
718
644
 
719
645
  /**
720
646
  * Transliterations of Hebrew month names.
721
647
  * Regular years are index 0 and leap years are index 1.
722
648
  * @private
723
649
  */
724
- var monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
725
- var edCache = Object.create(null);
726
- var EPOCH = -1373428;
650
+ const monthNames = [monthNames0.concat(['Adar', 'Nisan']), monthNames0.concat(['Adar I', 'Adar II', 'Nisan'])];
651
+ const edCache = Object.create(null);
652
+ const EPOCH = -1373428;
727
653
  // Avg year length in the cycle (19 solar years with 235 lunar months)
728
- var AVG_HEBYEAR_DAYS = 365.24682220597794;
654
+ const AVG_HEBYEAR_DAYS = 365.24682220597794;
729
655
 
730
656
  /**
731
657
  * @private
@@ -734,7 +660,7 @@ var AVG_HEBYEAR_DAYS = 365.24682220597794;
734
660
  */
735
661
  function assertNumber(n, name) {
736
662
  if (typeof n !== 'number' || isNaN(n)) {
737
- throw new TypeError("invalid parameter '".concat(name, "' not a number: ").concat(n));
663
+ throw new TypeError(`invalid parameter '${name}' not a number: ${n}`);
738
664
  }
739
665
  }
740
666
 
@@ -753,19 +679,19 @@ function hebrew2abs(year, month, day) {
753
679
  assertNumber(month, 'month');
754
680
  assertNumber(day, 'day');
755
681
  if (year < 1) {
756
- throw new RangeError("hebrew2abs: invalid year ".concat(year));
682
+ throw new RangeError(`hebrew2abs: invalid year ${year}`);
757
683
  }
758
- var tempabs = day;
684
+ let tempabs = day;
759
685
  if (month < TISHREI) {
760
- for (var m = TISHREI; m <= monthsInYear(year); m++) {
686
+ for (let m = TISHREI; m <= monthsInYear(year); m++) {
761
687
  tempabs += daysInMonth(m, year);
762
688
  }
763
- for (var _m = NISAN$1; _m < month; _m++) {
764
- tempabs += daysInMonth(_m, year);
689
+ for (let m = NISAN$1; m < month; m++) {
690
+ tempabs += daysInMonth(m, year);
765
691
  }
766
692
  } else {
767
- for (var _m2 = TISHREI; _m2 < month; _m2++) {
768
- tempabs += daysInMonth(_m2, year);
693
+ for (let m = TISHREI; m < month; m++) {
694
+ tempabs += daysInMonth(m, year);
769
695
  }
770
696
  }
771
697
  return EPOCH + elapsedDays(year) + tempabs - 1;
@@ -790,19 +716,19 @@ function abs2hebrew(abs) {
790
716
  assertNumber(abs, 'abs');
791
717
  abs = Math.trunc(abs);
792
718
  if (abs <= EPOCH) {
793
- throw new RangeError("abs2hebrew: ".concat(abs, " is before epoch"));
719
+ throw new RangeError(`abs2hebrew: ${abs} is before epoch`);
794
720
  }
795
721
  // first, quickly approximate year
796
- var year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
722
+ let year = Math.floor((abs - EPOCH) / AVG_HEBYEAR_DAYS);
797
723
  while (newYear(year) <= abs) {
798
724
  ++year;
799
725
  }
800
726
  --year;
801
- var month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
727
+ let month = abs < hebrew2abs(year, 1, 1) ? 7 : 1;
802
728
  while (abs > hebrew2abs(year, month, daysInMonth(month, year))) {
803
729
  ++month;
804
730
  }
805
- var day = 1 + abs - hebrew2abs(year, month, 1);
731
+ const day = 1 + abs - hebrew2abs(year, month, 1);
806
732
  return {
807
733
  yy: year,
808
734
  mm: month,
@@ -865,7 +791,7 @@ function getMonthName(month, year) {
865
791
  assertNumber(month, 'month');
866
792
  assertNumber(year, 'year');
867
793
  if (month < 1 || month > 14) {
868
- throw new TypeError("bad month argument ".concat(month));
794
+ throw new TypeError(`bad month argument ${month}`);
869
795
  }
870
796
  return monthNames[+isLeapYear(year)][month];
871
797
  }
@@ -878,7 +804,7 @@ function getMonthName(month, year) {
878
804
  * @return {number}
879
805
  */
880
806
  function elapsedDays(year) {
881
- var elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
807
+ const elapsed = edCache[year] = edCache[year] || elapsedDays0(year);
882
808
  return elapsed;
883
809
  }
884
810
 
@@ -890,18 +816,18 @@ function elapsedDays(year) {
890
816
  * @return {number}
891
817
  */
892
818
  function elapsedDays0(year) {
893
- var prevYear = year - 1;
894
- var mElapsed = 235 * Math.floor(prevYear / 19) +
819
+ const prevYear = year - 1;
820
+ const mElapsed = 235 * Math.floor(prevYear / 19) +
895
821
  // Months in complete 19 year lunar (Metonic) cycles so far
896
822
  12 * (prevYear % 19) +
897
823
  // Regular months in this cycle
898
824
  Math.floor((prevYear % 19 * 7 + 1) / 19); // Leap months this cycle
899
825
 
900
- var pElapsed = 204 + 793 * (mElapsed % 1080);
901
- var hElapsed = 5 + 12 * mElapsed + 793 * Math.floor(mElapsed / 1080) + Math.floor(pElapsed / 1080);
902
- var parts = pElapsed % 1080 + 1080 * (hElapsed % 24);
903
- var day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);
904
- var altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
826
+ const pElapsed = 204 + 793 * (mElapsed % 1080);
827
+ const hElapsed = 5 + 12 * mElapsed + 793 * Math.floor(mElapsed / 1080) + Math.floor(pElapsed / 1080);
828
+ const parts = pElapsed % 1080 + 1080 * (hElapsed % 24);
829
+ const day = 1 + 29 * mElapsed + Math.floor(hElapsed / 24);
830
+ const altDay = day + (parts >= 19440 || 2 === day % 7 && parts >= 9924 && !isLeapYear(year) || 1 === day % 7 && parts >= 16789 && isLeapYear(prevYear));
905
831
  return altDay + (altDay % 7 === 0 || altDay % 7 === 3 || altDay % 7 === 5);
906
832
  }
907
833
 
@@ -945,17 +871,37 @@ function throwTypeError(msg) {
945
871
  throw new TypeError(msg);
946
872
  }
947
873
 
948
- var UNITS_DAY = 'day';
949
- var UNITS_WEEK = 'week';
950
- var UNITS_MONTH = 'month';
951
- var UNITS_YEAR = 'year';
952
- var UNITS_SINGLE = {
874
+ /*
875
+ Hebcal - A Jewish Calendar Generator
876
+ Copyright (c) 1994-2020 Danny Sadinoff
877
+ Portions copyright Eyal Schachter and Michael J. Radwin
878
+
879
+ https://github.com/hebcal/hebcal-es6
880
+
881
+ This program is free software; you can redistribute it and/or
882
+ modify it under the terms of the GNU General Public License
883
+ as published by the Free Software Foundation; either version 2
884
+ of the License, or (at your option) any later version.
885
+
886
+ This program is distributed in the hope that it will be useful,
887
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
888
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
889
+ GNU General Public License for more details.
890
+
891
+ You should have received a copy of the GNU General Public License
892
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
893
+ */
894
+ const UNITS_DAY = 'day';
895
+ const UNITS_WEEK = 'week';
896
+ const UNITS_MONTH = 'month';
897
+ const UNITS_YEAR = 'year';
898
+ const UNITS_SINGLE = {
953
899
  d: UNITS_DAY,
954
900
  w: UNITS_WEEK,
955
901
  M: UNITS_MONTH,
956
902
  y: UNITS_YEAR
957
903
  };
958
- var UNITS_VALID = {
904
+ const UNITS_VALID = {
959
905
  day: UNITS_DAY,
960
906
  week: UNITS_WEEK,
961
907
  month: UNITS_MONTH,
@@ -972,7 +918,7 @@ var UNITS_VALID = {
972
918
  */
973
919
 
974
920
  /** Represents a Hebrew date */
975
- var HDate = /*#__PURE__*/function () {
921
+ class HDate {
976
922
  /**
977
923
  * Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
978
924
  *
@@ -1003,8 +949,7 @@ var HDate = /*#__PURE__*/function () {
1003
949
  * @param {number|string} [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
1004
950
  * @param {number} [year] - Hebrew year
1005
951
  */
1006
- function HDate(day, month, year) {
1007
- _classCallCheck(this, HDate);
952
+ constructor(day, month, year) {
1008
953
  if (arguments.length == 2 || arguments.length > 3) {
1009
954
  throw new TypeError('HDate constructor requires 0, 1 or 3 arguments');
1010
955
  }
@@ -1021,13 +966,13 @@ var HDate = /*#__PURE__*/function () {
1021
966
  */
1022
967
  year = parseInt(year, 10);
1023
968
  if (isNaN(year)) {
1024
- throw new TypeError("HDate called with bad year argument: ".concat(year));
969
+ throw new TypeError(`HDate called with bad year argument: ${year}`);
1025
970
  }
1026
971
  this.year = year;
1027
972
  this.setMonth(month); // will throw if we can't parse
1028
973
  day = parseInt(day, 10);
1029
974
  if (isNaN(day)) {
1030
- throw new TypeError("HDate called with bad day argument: ".concat(day));
975
+ throw new TypeError(`HDate called with bad day argument: ${day}`);
1031
976
  }
1032
977
  this.setDate(day);
1033
978
  } else {
@@ -1036,13 +981,13 @@ var HDate = /*#__PURE__*/function () {
1036
981
  day = new Date();
1037
982
  }
1038
983
  // 1 argument
1039
- var abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
984
+ const abs0 = typeof day === 'number' && !isNaN(day) ? day : isDate(day) ? greg2abs(day) : HDate.isHDate(day) ? {
1040
985
  dd: day.day,
1041
986
  mm: day.month,
1042
987
  yy: day.year
1043
- } : throwTypeError("HDate called with bad argument: ".concat(day));
1044
- var isNumber = typeof abs0 === 'number';
1045
- var d = isNumber ? abs2hebrew(abs0) : abs0;
988
+ } : throwTypeError(`HDate called with bad argument: ${day}`);
989
+ const isNumber = typeof abs0 === 'number';
990
+ const d = isNumber ? abs2hebrew(abs0) : abs0;
1046
991
  /**
1047
992
  * @private
1048
993
  * @type {number}
@@ -1072,757 +1017,669 @@ var HDate = /*#__PURE__*/function () {
1072
1017
  * Gets the Hebrew year of this Hebrew date
1073
1018
  * @return {number}
1074
1019
  */
1075
- _createClass(HDate, [{
1076
- key: "getFullYear",
1077
- value: function getFullYear() {
1078
- return this.year;
1079
- }
1020
+ getFullYear() {
1021
+ return this.year;
1022
+ }
1080
1023
 
1081
- /**
1082
- * Tests if this date occurs during a leap year
1083
- * @return {boolean}
1084
- */
1085
- }, {
1086
- key: "isLeapYear",
1087
- value: function isLeapYear$1() {
1088
- return isLeapYear(this.year);
1089
- }
1024
+ /**
1025
+ * Tests if this date occurs during a leap year
1026
+ * @return {boolean}
1027
+ */
1028
+ isLeapYear() {
1029
+ return isLeapYear(this.year);
1030
+ }
1090
1031
 
1091
- /**
1092
- * Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
1093
- * @return {number}
1094
- */
1095
- }, {
1096
- key: "getMonth",
1097
- value: function getMonth() {
1098
- return this.month;
1099
- }
1032
+ /**
1033
+ * Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
1034
+ * @return {number}
1035
+ */
1036
+ getMonth() {
1037
+ return this.month;
1038
+ }
1100
1039
 
1101
- /**
1102
- * The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
1103
- * @return {number}
1104
- */
1105
- }, {
1106
- key: "getTishreiMonth",
1107
- value: function getTishreiMonth() {
1108
- var nummonths = monthsInYear(this.getFullYear());
1109
- return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
1110
- }
1040
+ /**
1041
+ * The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
1042
+ * @return {number}
1043
+ */
1044
+ getTishreiMonth() {
1045
+ const nummonths = monthsInYear(this.getFullYear());
1046
+ return (this.getMonth() + nummonths - 6) % nummonths || nummonths;
1047
+ }
1111
1048
 
1112
- /**
1113
- * Number of days in the month of this Hebrew date
1114
- * @return {number}
1115
- */
1116
- }, {
1117
- key: "daysInMonth",
1118
- value: function daysInMonth$1() {
1119
- return daysInMonth(this.getMonth(), this.getFullYear());
1120
- }
1049
+ /**
1050
+ * Number of days in the month of this Hebrew date
1051
+ * @return {number}
1052
+ */
1053
+ daysInMonth() {
1054
+ return daysInMonth(this.getMonth(), this.getFullYear());
1055
+ }
1121
1056
 
1122
- /**
1123
- * Gets the day within the month (1-30)
1124
- * @return {number}
1125
- */
1126
- }, {
1127
- key: "getDate",
1128
- value: function getDate() {
1129
- return this.day;
1130
- }
1057
+ /**
1058
+ * Gets the day within the month (1-30)
1059
+ * @return {number}
1060
+ */
1061
+ getDate() {
1062
+ return this.day;
1063
+ }
1131
1064
 
1132
- /**
1133
- * Gets the day of the week. 0=Sunday, 6=Saturday
1134
- * @return {number}
1135
- */
1136
- }, {
1137
- key: "getDay",
1138
- value: function getDay() {
1139
- return mod(this.abs(), 7);
1140
- }
1065
+ /**
1066
+ * Gets the day of the week. 0=Sunday, 6=Saturday
1067
+ * @return {number}
1068
+ */
1069
+ getDay() {
1070
+ return mod(this.abs(), 7);
1071
+ }
1141
1072
 
1142
- /**
1143
- * Sets the year of the date. Returns the object it was called upon.
1144
- * @private
1145
- * @deprecated
1146
- * @param {number} year
1147
- * @return {HDate}
1148
- */
1149
- }, {
1150
- key: "setFullYear",
1151
- value: function setFullYear(year) {
1152
- this.year = year;
1153
- fix(this);
1154
- return this;
1155
- }
1073
+ /**
1074
+ * Sets the year of the date. Returns the object it was called upon.
1075
+ * @private
1076
+ * @deprecated
1077
+ * @param {number} year
1078
+ * @return {HDate}
1079
+ */
1080
+ setFullYear(year) {
1081
+ this.year = year;
1082
+ fix(this);
1083
+ return this;
1084
+ }
1156
1085
 
1157
- /**
1158
- * Sets the day of the month of the date. Returns the object it was called upon
1159
- * @private
1160
- * @param {number|string} month A number, or Hebrew month name string
1161
- * @return {HDate}
1162
- */
1163
- }, {
1164
- key: "setMonth",
1165
- value: function setMonth(month) {
1166
- this.month = HDate.monthNum(month);
1167
- fix(this);
1168
- return this;
1169
- }
1086
+ /**
1087
+ * Sets the day of the month of the date. Returns the object it was called upon
1088
+ * @private
1089
+ * @param {number|string} month A number, or Hebrew month name string
1090
+ * @return {HDate}
1091
+ */
1092
+ setMonth(month) {
1093
+ this.month = HDate.monthNum(month);
1094
+ fix(this);
1095
+ return this;
1096
+ }
1170
1097
 
1171
- /**
1172
- * @private
1173
- * @param {number} date
1174
- * @return {HDate}
1175
- */
1176
- }, {
1177
- key: "setDate",
1178
- value: function setDate(date) {
1179
- this.day = date;
1180
- fix(this);
1181
- return this;
1182
- }
1098
+ /**
1099
+ * @private
1100
+ * @param {number} date
1101
+ * @return {HDate}
1102
+ */
1103
+ setDate(date) {
1104
+ this.day = date;
1105
+ fix(this);
1106
+ return this;
1107
+ }
1183
1108
 
1184
- /**
1185
- * Converts to Gregorian date
1186
- * @return {Date}
1187
- */
1188
- }, {
1189
- key: "greg",
1190
- value: function greg() {
1191
- return abs2greg(this.abs());
1192
- }
1109
+ /**
1110
+ * Converts to Gregorian date
1111
+ * @return {Date}
1112
+ */
1113
+ greg() {
1114
+ return abs2greg(this.abs());
1115
+ }
1193
1116
 
1194
- /**
1195
- * Returns R.D. (Rata Die) fixed days.
1196
- * R.D. 1 == Monday, January 1, 1 (Gregorian)
1197
- * Note also that R.D. = Julian Date − 1,721,424.5
1198
- * https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
1199
- * @return {number}
1200
- */
1201
- }, {
1202
- key: "abs",
1203
- value: function abs() {
1204
- if (typeof this.abs0 !== 'number') {
1205
- this.abs0 = hebrew2abs(this.year, this.month, this.day);
1206
- }
1207
- return this.abs0;
1117
+ /**
1118
+ * Returns R.D. (Rata Die) fixed days.
1119
+ * R.D. 1 == Monday, January 1, 1 (Gregorian)
1120
+ * Note also that R.D. = Julian Date − 1,721,424.5
1121
+ * https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
1122
+ * @return {number}
1123
+ */
1124
+ abs() {
1125
+ if (typeof this.abs0 !== 'number') {
1126
+ this.abs0 = hebrew2abs(this.year, this.month, this.day);
1208
1127
  }
1128
+ return this.abs0;
1129
+ }
1209
1130
 
1210
- /**
1211
- * Converts Hebrew date to R.D. (Rata Die) fixed days.
1212
- * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
1213
- * Calendar.
1214
- * @param {number} year Hebrew year
1215
- * @param {number} month Hebrew month
1216
- * @param {number} day Hebrew date (1-30)
1217
- * @return {number}
1218
- */
1219
- }, {
1220
- key: "getMonthName",
1221
- value:
1222
- /**
1223
- * Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
1224
- * @return {string}
1225
- */
1226
- function getMonthName$1() {
1227
- return getMonthName(this.getMonth(), this.getFullYear());
1228
- }
1131
+ /**
1132
+ * Converts Hebrew date to R.D. (Rata Die) fixed days.
1133
+ * R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
1134
+ * Calendar.
1135
+ * @param {number} year Hebrew year
1136
+ * @param {number} month Hebrew month
1137
+ * @param {number} day Hebrew date (1-30)
1138
+ * @return {number}
1139
+ */
1140
+ static hebrew2abs(year, month, day) {
1141
+ return hebrew2abs(year, month, day);
1142
+ }
1229
1143
 
1230
- /**
1231
- * Renders this Hebrew date as a translated or transliterated string,
1232
- * including ordinal e.g. `'15th of Cheshvan, 5769'`.
1233
- * @example
1234
- * import {HDate, months} from '@hebcal/core';
1235
- *
1236
- * const hd = new HDate(15, months.CHESHVAN, 5769);
1237
- * console.log(hd.render('en')); // '15th of Cheshvan, 5769'
1238
- * console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
1239
- * @param {string} [locale] Optional locale name (defaults to active locale).
1240
- * @param {boolean} [showYear=true] Display year (defaults to true).
1241
- * @return {string}
1242
- */
1243
- }, {
1244
- key: "render",
1245
- value: function render() {
1246
- var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1247
- var showYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1248
- var locale0 = locale || Locale.getLocaleName();
1249
- var day = this.getDate();
1250
- var monthName = Locale.gettext(this.getMonthName(), locale0);
1251
- var nth = Locale.ordinal(day, locale0);
1252
- var dayOf = HDate.getDayOfTranslation(locale0);
1253
- var dateStr = "".concat(nth).concat(dayOf, " ").concat(monthName);
1254
- if (showYear) {
1255
- var fullYear = this.getFullYear();
1256
- return "".concat(dateStr, ", ").concat(fullYear);
1257
- } else {
1258
- return dateStr;
1259
- }
1260
- }
1144
+ /**
1145
+ * Converts absolute R.D. days to Hebrew date
1146
+ * @private
1147
+ * @param {number} abs absolute R.D. days
1148
+ * @return {SimpleHebrewDate}
1149
+ */
1150
+ static abs2hebrew(abs) {
1151
+ return abs2hebrew(abs);
1152
+ }
1261
1153
 
1262
- /**
1263
- * @private
1264
- * @param {string} locale
1265
- * @return {string}
1266
- */
1267
- }, {
1268
- key: "renderGematriya",
1269
- value:
1270
- /**
1271
- * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
1272
- * @example
1273
- * import {HDate, months} from '@hebcal/core';
1274
- * const hd = new HDate(15, months.CHESHVAN, 5769);
1275
- * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1276
- * @param {boolean} [suppressNikud]
1277
- * @return {string}
1278
- */
1279
- function renderGematriya() {
1280
- var suppressNikud = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1281
- var d = this.getDate();
1282
- var locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1283
- var m = Locale.gettext(this.getMonthName(), locale);
1284
- var y = this.getFullYear();
1285
- return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1286
- }
1154
+ /**
1155
+ * Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
1156
+ * @return {string}
1157
+ */
1158
+ getMonthName() {
1159
+ return getMonthName(this.getMonth(), this.getFullYear());
1160
+ }
1287
1161
 
1288
- /**
1289
- * Returns an `HDate` representing the a dayNumber before the current date.
1290
- * Sunday=0, Saturday=6
1291
- * @example
1292
- * new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
1293
- * @param {number} day day of week
1294
- * @return {HDate}
1295
- */
1296
- }, {
1297
- key: "before",
1298
- value: function before(day) {
1299
- return _onOrBefore(day, this, -1);
1162
+ /**
1163
+ * Renders this Hebrew date as a translated or transliterated string,
1164
+ * including ordinal e.g. `'15th of Cheshvan, 5769'`.
1165
+ * @example
1166
+ * import {HDate, months} from '@hebcal/core';
1167
+ *
1168
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
1169
+ * console.log(hd.render('en')); // '15th of Cheshvan, 5769'
1170
+ * console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
1171
+ * @param {string} [locale] Optional locale name (defaults to active locale).
1172
+ * @param {boolean} [showYear=true] Display year (defaults to true).
1173
+ * @return {string}
1174
+ */
1175
+ render() {
1176
+ let locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1177
+ let showYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1178
+ const locale0 = locale || Locale.getLocaleName();
1179
+ const day = this.getDate();
1180
+ const monthName = Locale.gettext(this.getMonthName(), locale0);
1181
+ const nth = Locale.ordinal(day, locale0);
1182
+ const dayOf = HDate.getDayOfTranslation(locale0);
1183
+ const dateStr = `${nth}${dayOf} ${monthName}`;
1184
+ if (showYear) {
1185
+ const fullYear = this.getFullYear();
1186
+ return `${dateStr}, ${fullYear}`;
1187
+ } else {
1188
+ return dateStr;
1300
1189
  }
1190
+ }
1301
1191
 
1302
- /**
1303
- * Returns an `HDate` representing the a dayNumber on or before the current date.
1304
- * Sunday=0, Saturday=6
1305
- * @example
1306
- * new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
1307
- * new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1308
- * new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1309
- * @param {number} dow day of week
1310
- * @return {HDate}
1311
- */
1312
- }, {
1313
- key: "onOrBefore",
1314
- value: function onOrBefore(dow) {
1315
- return _onOrBefore(dow, this, 0);
1192
+ /**
1193
+ * @private
1194
+ * @param {string} locale
1195
+ * @return {string}
1196
+ */
1197
+ static getDayOfTranslation(locale) {
1198
+ switch (locale) {
1199
+ case 'en':
1200
+ case 's':
1201
+ case 'a':
1202
+ case 'ashkenazi':
1203
+ return ' of';
1316
1204
  }
1317
-
1318
- /**
1319
- * Returns an `HDate` representing the nearest dayNumber to the current date
1320
- * Sunday=0, Saturday=6
1321
- * @example
1322
- * new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
1323
- * new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
1324
- * @param {number} dow day of week
1325
- * @return {HDate}
1326
- */
1327
- }, {
1328
- key: "nearest",
1329
- value: function nearest(dow) {
1330
- return _onOrBefore(dow, this, 3);
1205
+ const ofStr = Locale.lookupTranslation('of', locale);
1206
+ if (ofStr) {
1207
+ return ' ' + ofStr;
1331
1208
  }
1332
-
1333
- /**
1334
- * Returns an `HDate` representing the a dayNumber on or after the current date.
1335
- * Sunday=0, Saturday=6
1336
- * @example
1337
- * new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1338
- * new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1339
- * new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
1340
- * @param {number} dow day of week
1341
- * @return {HDate}
1342
- */
1343
- }, {
1344
- key: "onOrAfter",
1345
- value: function onOrAfter(dow) {
1346
- return _onOrBefore(dow, this, 6);
1209
+ if ('ashkenazi' === locale.substring(0, 9)) {
1210
+ return ' of';
1347
1211
  }
1212
+ return '';
1213
+ }
1348
1214
 
1349
- /**
1350
- * Returns an `HDate` representing the a dayNumber after the current date.
1351
- * Sunday=0, Saturday=6
1352
- * @example
1353
- * new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
1354
- * new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
1355
- * new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
1356
- * @param {number} day day of week
1357
- * @return {HDate}
1358
- */
1359
- }, {
1360
- key: "after",
1361
- value: function after(day) {
1362
- return _onOrBefore(day, this, 7);
1363
- }
1215
+ /**
1216
+ * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
1217
+ * @example
1218
+ * import {HDate, months} from '@hebcal/core';
1219
+ * const hd = new HDate(15, months.CHESHVAN, 5769);
1220
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
1221
+ * @param {boolean} [suppressNikud]
1222
+ * @return {string}
1223
+ */
1224
+ renderGematriya() {
1225
+ let suppressNikud = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1226
+ const d = this.getDate();
1227
+ const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1228
+ const m = Locale.gettext(this.getMonthName(), locale);
1229
+ const y = this.getFullYear();
1230
+ return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1231
+ }
1364
1232
 
1365
- /**
1366
- * Returns the next Hebrew date
1367
- * @return {HDate}
1368
- */
1369
- }, {
1370
- key: "next",
1371
- value: function next() {
1372
- return new HDate(this.abs() + 1);
1373
- }
1233
+ /**
1234
+ * Returns an `HDate` representing the a dayNumber before the current date.
1235
+ * Sunday=0, Saturday=6
1236
+ * @example
1237
+ * new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
1238
+ * @param {number} day day of week
1239
+ * @return {HDate}
1240
+ */
1241
+ before(day) {
1242
+ return onOrBefore(day, this, -1);
1243
+ }
1374
1244
 
1375
- /**
1376
- * Returns the previous Hebrew date
1377
- * @return {HDate}
1378
- */
1379
- }, {
1380
- key: "prev",
1381
- value: function prev() {
1382
- return new HDate(this.abs() - 1);
1383
- }
1245
+ /**
1246
+ * Returns an `HDate` representing the a dayNumber on or before the current date.
1247
+ * Sunday=0, Saturday=6
1248
+ * @example
1249
+ * new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
1250
+ * new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1251
+ * new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
1252
+ * @param {number} dow day of week
1253
+ * @return {HDate}
1254
+ */
1255
+ onOrBefore(dow) {
1256
+ return onOrBefore(dow, this, 0);
1257
+ }
1384
1258
 
1385
- /**
1386
- * Returns a cloned `HDate` object with a specified amount of time added
1387
- *
1388
- * Units are case insensitive, and support plural and short forms.
1389
- * Note, short forms are case sensitive.
1390
- *
1391
- * | Unit | Shorthand | Description
1392
- * | --- | --- | --- |
1393
- * | `day` | `d` | days |
1394
- * | `week` | `w` | weeks |
1395
- * | `month` | `M` | months |
1396
- * | `year` | `y` | years |
1397
- * @param {number} number
1398
- * @param {string} [units]
1399
- * @return {HDate}
1400
- */
1401
- }, {
1402
- key: "add",
1403
- value: function add(number) {
1404
- var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
1405
- number = parseInt(number, 10);
1406
- if (!number) {
1407
- return new HDate(this);
1408
- }
1409
- units = HDate.standardizeUnits(units);
1410
- if (units === UNITS_DAY) {
1411
- return new HDate(this.abs() + number);
1412
- } else if (units === UNITS_WEEK) {
1413
- return new HDate(this.abs() + 7 * number);
1414
- } else if (units === UNITS_YEAR) {
1415
- return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + number);
1416
- } else if (units === UNITS_MONTH) {
1417
- var hd = new HDate(this);
1418
- var sign = number > 0 ? 1 : -1;
1419
- number = Math.abs(number);
1420
- for (var i = 0; i < number; i++) {
1421
- hd = new HDate(hd.abs() + sign * hd.daysInMonth());
1422
- }
1423
- return hd;
1424
- }
1425
- }
1259
+ /**
1260
+ * Returns an `HDate` representing the nearest dayNumber to the current date
1261
+ * Sunday=0, Saturday=6
1262
+ * @example
1263
+ * new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
1264
+ * new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
1265
+ * @param {number} dow day of week
1266
+ * @return {HDate}
1267
+ */
1268
+ nearest(dow) {
1269
+ return onOrBefore(dow, this, 3);
1270
+ }
1426
1271
 
1427
- /**
1428
- * @private
1429
- * @param {string} units
1430
- * @return {string}
1431
- */
1432
- }, {
1433
- key: "subtract",
1434
- value:
1435
- /**
1436
- * Returns a cloned `HDate` object with a specified amount of time subracted
1437
- *
1438
- * Units are case insensitive, and support plural and short forms.
1439
- * Note, short forms are case sensitive.
1440
- *
1441
- * | Unit | Shorthand | Description
1442
- * | --- | --- | --- |
1443
- * | `day` | `d` | days |
1444
- * | `week` | `w` | weeks |
1445
- * | `month` | `M` | months |
1446
- * | `year` | `y` | years |
1447
- * @example
1448
- * import {HDate, months} from '@hebcal/core';
1449
- *
1450
- * const hd1 = new HDate(15, months.CHESHVAN, 5769);
1451
- * const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
1452
- * const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
1453
- * @param {number} number
1454
- * @param {string} [units]
1455
- * @return {HDate}
1456
- */
1457
- function subtract(number) {
1458
- var units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
1459
- return this.add(number * -1, units);
1460
- }
1272
+ /**
1273
+ * Returns an `HDate` representing the a dayNumber on or after the current date.
1274
+ * Sunday=0, Saturday=6
1275
+ * @example
1276
+ * new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1277
+ * new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
1278
+ * new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
1279
+ * @param {number} dow day of week
1280
+ * @return {HDate}
1281
+ */
1282
+ onOrAfter(dow) {
1283
+ return onOrBefore(dow, this, 6);
1284
+ }
1461
1285
 
1462
- /**
1463
- * Returns the difference in days between the two given HDates.
1464
- *
1465
- * The result is positive if `this` date is comes chronologically
1466
- * after the `other` date, and negative
1467
- * if the order of the two dates is reversed.
1468
- *
1469
- * The result is zero if the two dates are identical.
1470
- * @example
1471
- * import {HDate, months} from '@hebcal/core';
1472
- *
1473
- * const hd1 = new HDate(25, months.KISLEV, 5770);
1474
- * const hd2 = new HDate(15, months.CHESHVAN, 5769);
1475
- * const days = hd1.deltaDays(hd2); // 394
1476
- * @param {HDate} other Hebrew date to compare
1477
- * @return {number}
1478
- */
1479
- }, {
1480
- key: "deltaDays",
1481
- value: function deltaDays(other) {
1482
- if (!HDate.isHDate(other)) {
1483
- throw new TypeError("Bad argument: ".concat(other));
1484
- }
1485
- return this.abs() - other.abs();
1486
- }
1286
+ /**
1287
+ * Returns an `HDate` representing the a dayNumber after the current date.
1288
+ * Sunday=0, Saturday=6
1289
+ * @example
1290
+ * new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
1291
+ * new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
1292
+ * new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
1293
+ * @param {number} day day of week
1294
+ * @return {HDate}
1295
+ */
1296
+ after(day) {
1297
+ return onOrBefore(day, this, 7);
1298
+ }
1299
+
1300
+ /**
1301
+ * Returns the next Hebrew date
1302
+ * @return {HDate}
1303
+ */
1304
+ next() {
1305
+ return new HDate(this.abs() + 1);
1306
+ }
1307
+
1308
+ /**
1309
+ * Returns the previous Hebrew date
1310
+ * @return {HDate}
1311
+ */
1312
+ prev() {
1313
+ return new HDate(this.abs() - 1);
1314
+ }
1487
1315
 
1488
- /**
1489
- * Compares this date to another date, returning `true` if the dates match.
1490
- * @param {HDate} other Hebrew date to compare
1491
- * @return {boolean}
1492
- */
1493
- }, {
1494
- key: "isSameDate",
1495
- value: function isSameDate(other) {
1496
- if (HDate.isHDate(other)) {
1497
- return this.year == other.year && this.month == other.month && this.day == other.day;
1316
+ /**
1317
+ * Returns a cloned `HDate` object with a specified amount of time added
1318
+ *
1319
+ * Units are case insensitive, and support plural and short forms.
1320
+ * Note, short forms are case sensitive.
1321
+ *
1322
+ * | Unit | Shorthand | Description
1323
+ * | --- | --- | --- |
1324
+ * | `day` | `d` | days |
1325
+ * | `week` | `w` | weeks |
1326
+ * | `month` | `M` | months |
1327
+ * | `year` | `y` | years |
1328
+ * @param {number} number
1329
+ * @param {string} [units]
1330
+ * @return {HDate}
1331
+ */
1332
+ add(number) {
1333
+ let units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
1334
+ number = parseInt(number, 10);
1335
+ if (!number) {
1336
+ return new HDate(this);
1337
+ }
1338
+ units = HDate.standardizeUnits(units);
1339
+ if (units === UNITS_DAY) {
1340
+ return new HDate(this.abs() + number);
1341
+ } else if (units === UNITS_WEEK) {
1342
+ return new HDate(this.abs() + 7 * number);
1343
+ } else if (units === UNITS_YEAR) {
1344
+ return new HDate(this.getDate(), this.getMonth(), this.getFullYear() + number);
1345
+ } else if (units === UNITS_MONTH) {
1346
+ let hd = new HDate(this);
1347
+ const sign = number > 0 ? 1 : -1;
1348
+ number = Math.abs(number);
1349
+ for (let i = 0; i < number; i++) {
1350
+ hd = new HDate(hd.abs() + sign * hd.daysInMonth());
1498
1351
  }
1499
- return false;
1352
+ return hd;
1500
1353
  }
1354
+ }
1501
1355
 
1502
- /** @return {string} */
1503
- }, {
1504
- key: "toString",
1505
- value: function toString() {
1506
- var day = this.getDate();
1507
- var fullYear = this.getFullYear();
1508
- var monthName = this.getMonthName();
1509
- return "".concat(day, " ").concat(monthName, " ").concat(fullYear);
1510
- }
1356
+ /**
1357
+ * @private
1358
+ * @param {string} units
1359
+ * @return {string}
1360
+ */
1361
+ static standardizeUnits(units) {
1362
+ const full = UNITS_SINGLE[units] || String(units || '').toLowerCase().replace(/s$/, '');
1363
+ return UNITS_VALID[full] || throwTypeError(`Invalid units '${units}'`);
1364
+ }
1511
1365
 
1512
- /**
1513
- * Returns true if Hebrew year is a leap year
1514
- * @param {number} year Hebrew year
1515
- * @return {boolean}
1516
- */
1517
- }], [{
1518
- key: "hebrew2abs",
1519
- value: function hebrew2abs$1(year, month, day) {
1520
- return hebrew2abs(year, month, day);
1521
- }
1366
+ /**
1367
+ * Returns a cloned `HDate` object with a specified amount of time subracted
1368
+ *
1369
+ * Units are case insensitive, and support plural and short forms.
1370
+ * Note, short forms are case sensitive.
1371
+ *
1372
+ * | Unit | Shorthand | Description
1373
+ * | --- | --- | --- |
1374
+ * | `day` | `d` | days |
1375
+ * | `week` | `w` | weeks |
1376
+ * | `month` | `M` | months |
1377
+ * | `year` | `y` | years |
1378
+ * @example
1379
+ * import {HDate, months} from '@hebcal/core';
1380
+ *
1381
+ * const hd1 = new HDate(15, months.CHESHVAN, 5769);
1382
+ * const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
1383
+ * const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
1384
+ * @param {number} number
1385
+ * @param {string} [units]
1386
+ * @return {HDate}
1387
+ */
1388
+ subtract(number) {
1389
+ let units = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'd';
1390
+ return this.add(number * -1, units);
1391
+ }
1522
1392
 
1523
- /**
1524
- * Converts absolute R.D. days to Hebrew date
1525
- * @private
1526
- * @param {number} abs absolute R.D. days
1527
- * @return {SimpleHebrewDate}
1528
- */
1529
- }, {
1530
- key: "abs2hebrew",
1531
- value: function abs2hebrew$1(abs) {
1532
- return abs2hebrew(abs);
1533
- }
1534
- }, {
1535
- key: "getDayOfTranslation",
1536
- value: function getDayOfTranslation(locale) {
1537
- switch (locale) {
1538
- case 'en':
1539
- case 's':
1540
- case 'a':
1541
- case 'ashkenazi':
1542
- return ' of';
1543
- }
1544
- var ofStr = Locale.lookupTranslation('of', locale);
1545
- if (ofStr) {
1546
- return ' ' + ofStr;
1547
- }
1548
- if ('ashkenazi' === locale.substring(0, 9)) {
1549
- return ' of';
1550
- }
1551
- return '';
1552
- }
1553
- }, {
1554
- key: "standardizeUnits",
1555
- value: function standardizeUnits(units) {
1556
- var full = UNITS_SINGLE[units] || String(units || '').toLowerCase().replace(/s$/, '');
1557
- return UNITS_VALID[full] || throwTypeError("Invalid units '".concat(units, "'"));
1558
- }
1559
- }, {
1560
- key: "isLeapYear",
1561
- value: function isLeapYear$1(year) {
1562
- return isLeapYear(year);
1393
+ /**
1394
+ * Returns the difference in days between the two given HDates.
1395
+ *
1396
+ * The result is positive if `this` date is comes chronologically
1397
+ * after the `other` date, and negative
1398
+ * if the order of the two dates is reversed.
1399
+ *
1400
+ * The result is zero if the two dates are identical.
1401
+ * @example
1402
+ * import {HDate, months} from '@hebcal/core';
1403
+ *
1404
+ * const hd1 = new HDate(25, months.KISLEV, 5770);
1405
+ * const hd2 = new HDate(15, months.CHESHVAN, 5769);
1406
+ * const days = hd1.deltaDays(hd2); // 394
1407
+ * @param {HDate} other Hebrew date to compare
1408
+ * @return {number}
1409
+ */
1410
+ deltaDays(other) {
1411
+ if (!HDate.isHDate(other)) {
1412
+ throw new TypeError(`Bad argument: ${other}`);
1563
1413
  }
1414
+ return this.abs() - other.abs();
1415
+ }
1564
1416
 
1565
- /**
1566
- * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
1567
- * @param {number} year Hebrew year
1568
- * @return {number}
1569
- */
1570
- }, {
1571
- key: "monthsInYear",
1572
- value: function monthsInYear$1(year) {
1573
- return monthsInYear(year);
1417
+ /**
1418
+ * Compares this date to another date, returning `true` if the dates match.
1419
+ * @param {HDate} other Hebrew date to compare
1420
+ * @return {boolean}
1421
+ */
1422
+ isSameDate(other) {
1423
+ if (HDate.isHDate(other)) {
1424
+ return this.year == other.year && this.month == other.month && this.day == other.day;
1574
1425
  }
1426
+ return false;
1427
+ }
1575
1428
 
1576
- /**
1577
- * Number of days in Hebrew month in a given year (29 or 30)
1578
- * @param {number} month Hebrew month (e.g. months.TISHREI)
1579
- * @param {number} year Hebrew year
1580
- * @return {number}
1581
- */
1582
- }, {
1583
- key: "daysInMonth",
1584
- value: function daysInMonth$1(month, year) {
1585
- return daysInMonth(month, year);
1586
- }
1429
+ /** @return {string} */
1430
+ toString() {
1431
+ const day = this.getDate();
1432
+ const fullYear = this.getFullYear();
1433
+ const monthName = this.getMonthName();
1434
+ return `${day} ${monthName} ${fullYear}`;
1435
+ }
1587
1436
 
1588
- /**
1589
- * Returns a transliterated string name of Hebrew month in year,
1590
- * for example 'Elul' or 'Cheshvan'.
1591
- * @param {number} month Hebrew month (e.g. months.TISHREI)
1592
- * @param {number} year Hebrew year
1593
- * @return {string}
1594
- */
1595
- }, {
1596
- key: "getMonthName",
1597
- value: function getMonthName$1(month, year) {
1598
- return getMonthName(month, year);
1599
- }
1437
+ /**
1438
+ * Returns true if Hebrew year is a leap year
1439
+ * @param {number} year Hebrew year
1440
+ * @return {boolean}
1441
+ */
1442
+ static isLeapYear(year) {
1443
+ return isLeapYear(year);
1444
+ }
1600
1445
 
1601
- /**
1602
- * Returns the Hebrew month number (NISAN=1, TISHREI=7)
1603
- * @param {number|string} month A number, or Hebrew month name string
1604
- * @return {number}
1605
- */
1606
- }, {
1607
- key: "monthNum",
1608
- value: function monthNum(month) {
1609
- if (typeof month === 'number') {
1610
- if (isNaN(month) || month > 14) {
1611
- throw new RangeError("Invalid month number: ".concat(month));
1612
- }
1613
- return month;
1446
+ /**
1447
+ * Number of months in this Hebrew year (either 12 or 13 depending on leap year)
1448
+ * @param {number} year Hebrew year
1449
+ * @return {number}
1450
+ */
1451
+ static monthsInYear(year) {
1452
+ return monthsInYear(year);
1453
+ }
1454
+
1455
+ /**
1456
+ * Number of days in Hebrew month in a given year (29 or 30)
1457
+ * @param {number} month Hebrew month (e.g. months.TISHREI)
1458
+ * @param {number} year Hebrew year
1459
+ * @return {number}
1460
+ */
1461
+ static daysInMonth(month, year) {
1462
+ return daysInMonth(month, year);
1463
+ }
1464
+
1465
+ /**
1466
+ * Returns a transliterated string name of Hebrew month in year,
1467
+ * for example 'Elul' or 'Cheshvan'.
1468
+ * @param {number} month Hebrew month (e.g. months.TISHREI)
1469
+ * @param {number} year Hebrew year
1470
+ * @return {string}
1471
+ */
1472
+ static getMonthName(month, year) {
1473
+ return getMonthName(month, year);
1474
+ }
1475
+
1476
+ /**
1477
+ * Returns the Hebrew month number (NISAN=1, TISHREI=7)
1478
+ * @param {number|string} month A number, or Hebrew month name string
1479
+ * @return {number}
1480
+ */
1481
+ static monthNum(month) {
1482
+ if (typeof month === 'number') {
1483
+ if (isNaN(month) || month > 14) {
1484
+ throw new RangeError(`Invalid month number: ${month}`);
1614
1485
  }
1615
- return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
1616
- parseInt(month, 10) : HDate.monthFromName(month);
1486
+ return month;
1617
1487
  }
1488
+ return month.charCodeAt(0) >= 48 && month.charCodeAt(0) <= 57 ? /* number */
1489
+ parseInt(month, 10) : HDate.monthFromName(month);
1490
+ }
1618
1491
 
1619
- /**
1620
- * Number of days in the hebrew YEAR
1621
- * @param {number} year Hebrew year
1622
- * @return {number}
1623
- */
1624
- }, {
1625
- key: "daysInYear",
1626
- value: function daysInYear$1(year) {
1627
- return daysInYear(year);
1628
- }
1492
+ /**
1493
+ * Number of days in the hebrew YEAR
1494
+ * @param {number} year Hebrew year
1495
+ * @return {number}
1496
+ */
1497
+ static daysInYear(year) {
1498
+ return daysInYear(year);
1499
+ }
1629
1500
 
1630
- /**
1631
- * true if Cheshvan is long in Hebrew year
1632
- * @param {number} year Hebrew year
1633
- * @return {boolean}
1634
- */
1635
- }, {
1636
- key: "longCheshvan",
1637
- value: function longCheshvan$1(year) {
1638
- return longCheshvan(year);
1639
- }
1501
+ /**
1502
+ * true if Cheshvan is long in Hebrew year
1503
+ * @param {number} year Hebrew year
1504
+ * @return {boolean}
1505
+ */
1506
+ static longCheshvan(year) {
1507
+ return longCheshvan(year);
1508
+ }
1640
1509
 
1641
- /**
1642
- * true if Kislev is short in Hebrew year
1643
- * @param {number} year Hebrew year
1644
- * @return {boolean}
1645
- */
1646
- }, {
1647
- key: "shortKislev",
1648
- value: function shortKislev$1(year) {
1649
- return shortKislev(year);
1650
- }
1510
+ /**
1511
+ * true if Kislev is short in Hebrew year
1512
+ * @param {number} year Hebrew year
1513
+ * @return {boolean}
1514
+ */
1515
+ static shortKislev(year) {
1516
+ return shortKislev(year);
1517
+ }
1651
1518
 
1652
- /**
1653
- * Converts Hebrew month string name to numeric
1654
- * @param {string} monthName monthName
1655
- * @return {number}
1656
- */
1657
- }, {
1658
- key: "monthFromName",
1659
- value: function monthFromName(monthName) {
1660
- if (typeof monthName === 'number') {
1661
- if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1662
- throw new RangeError("Invalid month name: ".concat(monthName));
1663
- }
1664
- return monthName;
1665
- }
1666
- var c = Locale.hebrewStripNikkud(monthName).trim().toLowerCase();
1667
- // If Hebrew month starts with a bet (for example `בתמוז`) then ignore it
1668
- if (c[0] === 'ב') {
1669
- c = c.substring(1);
1670
- }
1671
- /*
1672
- the Hebrew months are unique to their second letter
1673
- N Nisan (November?)
1674
- I Iyyar
1675
- E Elul
1676
- C Cheshvan
1677
- K Kislev
1678
- 1 1Adar
1679
- 2 2Adar
1680
- Si Sh Sivan, Shvat
1681
- Ta Ti Te Tamuz, Tishrei, Tevet
1682
- Av Ad Av, Adar
1683
- אב אד אי אל אב אדר אייר אלול
1684
- ח חשון
1685
- ט טבת
1686
- כ כסלו
1687
- נ ניסן
1688
- ס סיון
1689
- ש שבט
1690
- תמ תש תמוז תשרי
1691
- */
1692
- switch (c[0]) {
1693
- case 'n':
1694
- case 'נ':
1695
- if (c[1] == 'o') {
1696
- break; /* this catches "november" */
1697
- }
1698
-
1699
- return months.NISAN;
1700
- case 'i':
1701
- return months.IYYAR;
1702
- case 'e':
1703
- return months.ELUL;
1704
- case 'c':
1705
- case 'ח':
1706
- return months.CHESHVAN;
1707
- case 'k':
1708
- case 'כ':
1709
- return months.KISLEV;
1710
- case 's':
1711
- switch (c[1]) {
1712
- case 'i':
1713
- return months.SIVAN;
1714
- case 'h':
1715
- return months.SHVAT;
1716
- }
1717
- case 't':
1718
- switch (c[1]) {
1719
- case 'a':
1720
- return months.TAMUZ;
1721
- case 'i':
1722
- return months.TISHREI;
1723
- case 'e':
1724
- return months.TEVET;
1725
- }
1726
- break;
1727
- case 'a':
1728
- switch (c[1]) {
1729
- case 'v':
1730
- return months.AV;
1731
- case 'd':
1732
- if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1733
- return months.ADAR_I;
1734
- }
1735
- return months.ADAR_II;
1736
- // else assume sheini
1737
- }
1738
-
1739
- break;
1740
- case 'ס':
1741
- return months.SIVAN;
1742
- case 'ט':
1743
- return months.TEVET;
1744
- case 'ש':
1745
- return months.SHVAT;
1746
- case 'א':
1747
- switch (c[1]) {
1748
- case 'ב':
1749
- return months.AV;
1750
- case 'ד':
1751
- if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1752
- return months.ADAR_I;
1753
- }
1754
- return months.ADAR_II;
1755
- // else assume sheini
1756
- case 'י':
1757
- return months.IYYAR;
1758
- case 'ל':
1759
- return months.ELUL;
1760
- }
1761
- break;
1762
- case 'ת':
1763
- switch (c[1]) {
1764
- case 'מ':
1765
- return months.TAMUZ;
1766
- case 'ש':
1767
- return months.TISHREI;
1768
- }
1769
- break;
1519
+ /**
1520
+ * Converts Hebrew month string name to numeric
1521
+ * @param {string} monthName monthName
1522
+ * @return {number}
1523
+ */
1524
+ static monthFromName(monthName) {
1525
+ if (typeof monthName === 'number') {
1526
+ if (isNaN(monthName) || monthName < 1 || monthName > 14) {
1527
+ throw new RangeError(`Invalid month name: ${monthName}`);
1770
1528
  }
1771
- throw new RangeError("Unable to parse month name: ".concat(monthName));
1772
- }
1529
+ return monthName;
1530
+ }
1531
+ let c = Locale.hebrewStripNikkud(monthName).trim().toLowerCase();
1532
+ // If Hebrew month starts with a bet (for example `בתמוז`) then ignore it
1533
+ if (c[0] === 'ב') {
1534
+ c = c.substring(1);
1535
+ }
1536
+ /*
1537
+ the Hebrew months are unique to their second letter
1538
+ N Nisan (November?)
1539
+ I Iyyar
1540
+ E Elul
1541
+ C Cheshvan
1542
+ K Kislev
1543
+ 1 1Adar
1544
+ 2 2Adar
1545
+ Si Sh Sivan, Shvat
1546
+ Ta Ti Te Tamuz, Tishrei, Tevet
1547
+ Av Ad Av, Adar
1548
+ אב אד אי אל אב אדר אייר אלול
1549
+ ח חשון
1550
+ ט טבת
1551
+ כ כסלו
1552
+ נ ניסן
1553
+ ס סיון
1554
+ ש שבט
1555
+ תמ תש תמוז תשרי
1556
+ */
1557
+ switch (c[0]) {
1558
+ case 'n':
1559
+ case 'נ':
1560
+ if (c[1] == 'o') {
1561
+ break; /* this catches "november" */
1562
+ }
1773
1563
 
1774
- /**
1775
- * Note: Applying this function to d+6 gives us the DAYNAME on or after an
1776
- * absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
1777
- * absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
1778
- * date d, and applying it to d+7 gives the DAYNAME following absolute date d.
1779
- * @param {number} dayOfWeek
1780
- * @param {number} absdate
1781
- * @return {number}
1782
- */
1783
- }, {
1784
- key: "dayOnOrBefore",
1785
- value: function dayOnOrBefore(dayOfWeek, absdate) {
1786
- return absdate - (absdate - dayOfWeek) % 7;
1787
- }
1564
+ return months.NISAN;
1565
+ case 'i':
1566
+ return months.IYYAR;
1567
+ case 'e':
1568
+ return months.ELUL;
1569
+ case 'c':
1570
+ case 'ח':
1571
+ return months.CHESHVAN;
1572
+ case 'k':
1573
+ case 'כ':
1574
+ return months.KISLEV;
1575
+ case 's':
1576
+ switch (c[1]) {
1577
+ case 'i':
1578
+ return months.SIVAN;
1579
+ case 'h':
1580
+ return months.SHVAT;
1581
+ }
1582
+ case 't':
1583
+ switch (c[1]) {
1584
+ case 'a':
1585
+ return months.TAMUZ;
1586
+ case 'i':
1587
+ return months.TISHREI;
1588
+ case 'e':
1589
+ return months.TEVET;
1590
+ }
1591
+ break;
1592
+ case 'a':
1593
+ switch (c[1]) {
1594
+ case 'v':
1595
+ return months.AV;
1596
+ case 'd':
1597
+ if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1598
+ return months.ADAR_I;
1599
+ }
1600
+ return months.ADAR_II;
1601
+ // else assume sheini
1602
+ }
1788
1603
 
1789
- /**
1790
- * Tests if the object is an instance of `HDate`
1791
- * @param {any} obj
1792
- * @return {boolean}
1793
- */
1794
- }, {
1795
- key: "isHDate",
1796
- value: function isHDate(obj) {
1797
- 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';
1604
+ break;
1605
+ case 'ס':
1606
+ return months.SIVAN;
1607
+ case 'ט':
1608
+ return months.TEVET;
1609
+ case 'ש':
1610
+ return months.SHVAT;
1611
+ case 'א':
1612
+ switch (c[1]) {
1613
+ case 'ב':
1614
+ return months.AV;
1615
+ case 'ד':
1616
+ if (/(1|[^i]i|a|א)$/i.test(monthName)) {
1617
+ return months.ADAR_I;
1618
+ }
1619
+ return months.ADAR_II;
1620
+ // else assume sheini
1621
+ case 'י':
1622
+ return months.IYYAR;
1623
+ case 'ל':
1624
+ return months.ELUL;
1625
+ }
1626
+ break;
1627
+ case 'ת':
1628
+ switch (c[1]) {
1629
+ case 'מ':
1630
+ return months.TAMUZ;
1631
+ case 'ש':
1632
+ return months.TISHREI;
1633
+ }
1634
+ break;
1798
1635
  }
1636
+ throw new RangeError(`Unable to parse month name: ${monthName}`);
1637
+ }
1799
1638
 
1800
- /**
1801
- * Construct a new instance of `HDate` from a Gematriya-formatted string
1802
- * @example
1803
- * HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
1804
- * HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
1805
- * HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
1806
- * @param {string} str
1807
- * @param {number} currentThousands
1808
- * @return {HDate}
1809
- */
1810
- }, {
1811
- key: "fromGematriyaString",
1812
- value: function fromGematriyaString(str) {
1813
- var currentThousands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
1814
- var parts = str.split(' ');
1815
- var day = gematriyaStrToNum(parts[0]);
1816
- var month = HDate.monthFromName(parts[1]);
1817
- var year = gematriyaStrToNum(parts[2]);
1818
- if (year < 1000) {
1819
- year += currentThousands;
1820
- }
1821
- return new HDate(day, month, year);
1822
- }
1823
- }]);
1824
- return HDate;
1825
- }();
1639
+ /**
1640
+ * Note: Applying this function to d+6 gives us the DAYNAME on or after an
1641
+ * absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
1642
+ * absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
1643
+ * date d, and applying it to d+7 gives the DAYNAME following absolute date d.
1644
+ * @param {number} dayOfWeek
1645
+ * @param {number} absdate
1646
+ * @return {number}
1647
+ */
1648
+ static dayOnOrBefore(dayOfWeek, absdate) {
1649
+ return absdate - (absdate - dayOfWeek) % 7;
1650
+ }
1651
+
1652
+ /**
1653
+ * Tests if the object is an instance of `HDate`
1654
+ * @param {any} obj
1655
+ * @return {boolean}
1656
+ */
1657
+ static isHDate(obj) {
1658
+ 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';
1659
+ }
1660
+
1661
+ /**
1662
+ * Construct a new instance of `HDate` from a Gematriya-formatted string
1663
+ * @example
1664
+ * HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
1665
+ * HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
1666
+ * HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
1667
+ * @param {string} str
1668
+ * @param {number} currentThousands
1669
+ * @return {HDate}
1670
+ */
1671
+ static fromGematriyaString(str) {
1672
+ let currentThousands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
1673
+ const parts = str.split(' ');
1674
+ const day = gematriyaStrToNum(parts[0]);
1675
+ const month = HDate.monthFromName(parts[1]);
1676
+ let year = gematriyaStrToNum(parts[2]);
1677
+ if (year < 1000) {
1678
+ year += currentThousands;
1679
+ }
1680
+ return new HDate(day, month, year);
1681
+ }
1682
+ }
1826
1683
 
1827
1684
  /**
1828
1685
  * @private
@@ -1884,17 +1741,17 @@ function fixMonth(date) {
1884
1741
  * @param {number} offset
1885
1742
  * @return {HDate}
1886
1743
  */
1887
- function _onOrBefore(day, t, offset) {
1744
+ function onOrBefore(day, t, offset) {
1888
1745
  return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1889
1746
  }
1890
1747
 
1891
- var NISAN = months.NISAN;
1892
- var CHESHVAN = months.CHESHVAN;
1893
- var KISLEV = months.KISLEV;
1894
- var TEVET = months.TEVET;
1895
- var SHVAT = months.SHVAT;
1896
- var ADAR_I = months.ADAR_I;
1897
- var ADAR_II = months.ADAR_II;
1748
+ const NISAN = months.NISAN;
1749
+ const CHESHVAN = months.CHESHVAN;
1750
+ const KISLEV = months.KISLEV;
1751
+ const TEVET = months.TEVET;
1752
+ const SHVAT = months.SHVAT;
1753
+ const ADAR_I = months.ADAR_I;
1754
+ const ADAR_II = months.ADAR_II;
1898
1755
 
1899
1756
  /**
1900
1757
  * @private
@@ -1903,8 +1760,8 @@ var ADAR_II = months.ADAR_II;
1903
1760
  * @return {HDate} anniversary occurring in hyear
1904
1761
  */
1905
1762
  function getYahrzeit_(hyear, gdate) {
1906
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1907
- var hDeath = {
1763
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1764
+ let hDeath = {
1908
1765
  yy: orig.getFullYear(),
1909
1766
  mm: orig.getMonth(),
1910
1767
  dd: orig.getDate()
@@ -1950,17 +1807,17 @@ function getYahrzeit_(hyear, gdate) {
1950
1807
  * @return {HDate} anniversary occurring in `hyear`
1951
1808
  */
1952
1809
  function getBirthdayOrAnniversary_(hyear, gdate) {
1953
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1954
- var origYear = orig.getFullYear();
1810
+ const orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
1811
+ const origYear = orig.getFullYear();
1955
1812
  if (hyear === origYear) {
1956
1813
  return orig;
1957
1814
  } else if (hyear < origYear) {
1958
1815
  // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
1959
1816
  return undefined;
1960
1817
  }
1961
- var isOrigLeap = isLeapYear(origYear);
1962
- var month = orig.getMonth();
1963
- var day = orig.getDate();
1818
+ const isOrigLeap = isLeapYear(origYear);
1819
+ let month = orig.getMonth();
1820
+ let day = orig.getDate();
1964
1821
  if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
1965
1822
  month = monthsInYear(hyear);
1966
1823
  } else if (month == CHESHVAN && day == 30 && !longCheshvan(hyear)) {
@@ -1976,15 +1833,15 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
1976
1833
  return new HDate(day, month, hyear);
1977
1834
  }
1978
1835
 
1979
- var version="4.3.3";
1836
+ const version="4.3.5";
1980
1837
 
1981
- 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};
1838
+ const headers={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִּשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
1982
1839
 
1983
1840
  Locale.addLocale('he', poHeMin);
1984
1841
  Locale.addLocale('h', poHeMin);
1985
- var heStrs = poHeMin.contexts[''];
1986
- var heNoNikud = {};
1987
- Object.keys(heStrs).forEach(function (key) {
1842
+ const heStrs = poHeMin.contexts[''];
1843
+ const heNoNikud = {};
1844
+ Object.keys(heStrs).forEach(key => {
1988
1845
  heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
1989
1846
  });
1990
1847
  Locale.addLocale('he-x-NoNikud', {