@hebcal/core 3.33.3 → 3.33.6

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/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v3.33.3 */
1
+ /*! @hebcal/core v3.33.6 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -37,6 +37,21 @@ function _createClass(Constructor, protoProps, staticProps) {
37
37
  return Constructor;
38
38
  }
39
39
 
40
+ function _defineProperty(obj, key, value) {
41
+ if (key in obj) {
42
+ Object.defineProperty(obj, key, {
43
+ value: value,
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true
47
+ });
48
+ } else {
49
+ obj[key] = value;
50
+ }
51
+
52
+ return obj;
53
+ }
54
+
40
55
  function _inherits(subClass, superClass) {
41
56
  if (typeof superClass !== "function" && superClass !== null) {
42
57
  throw new TypeError("Super expression must either be null or a function");
@@ -238,148 +253,172 @@ function quotient(x, y) {
238
253
  }
239
254
  /**
240
255
  * Gregorian date helper functions.
241
- * @namespace
242
256
  */
243
257
 
244
258
 
245
- var greg = {
246
- /**
247
- * Long names of the Gregorian months (1='January', 12='December')
248
- * @readonly
249
- * @type {string[]}
250
- */
251
- monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
259
+ var greg = /*#__PURE__*/function () {
260
+ function greg() {
261
+ _classCallCheck(this, greg);
262
+ }
252
263
 
253
- /**
254
- * Returns true if the Gregorian year is a leap year
255
- * @param {number} year Gregorian year
256
- * @return {boolean}
257
- */
258
- isLeapYear: function isLeapYear(year) {
259
- return !(year % 4) && (!!(year % 100) || !(year % 400));
260
- },
264
+ _createClass(greg, null, [{
265
+ key: "isLeapYear",
266
+ value:
267
+ /**
268
+ * Long names of the Gregorian months (1='January', 12='December')
269
+ * @readonly
270
+ * @type {string[]}
271
+ */
261
272
 
262
- /**
263
- * Number of days in the Gregorian month for given year
264
- * @param {number} month Gregorian month (1=January, 12=December)
265
- * @param {number} year Gregorian year
266
- * @return {number}
267
- */
268
- daysInMonth: function daysInMonth(month, year) {
269
- // 1 based months
270
- return monthLengths[+this.isLeapYear(year)][month];
271
- },
273
+ /**
274
+ * Returns true if the Gregorian year is a leap year
275
+ * @param {number} year Gregorian year
276
+ * @return {boolean}
277
+ */
278
+ function isLeapYear(year) {
279
+ return !(year % 4) && (!!(year % 100) || !(year % 400));
280
+ }
281
+ /**
282
+ * Number of days in the Gregorian month for given year
283
+ * @param {number} month Gregorian month (1=January, 12=December)
284
+ * @param {number} year Gregorian year
285
+ * @return {number}
286
+ */
272
287
 
273
- /**
274
- * Returns true if the object is a Javascript Date
275
- * @param {Object} obj
276
- * @return {boolean}
277
- */
278
- isDate: function isDate(obj) {
279
- return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
280
- },
288
+ }, {
289
+ key: "daysInMonth",
290
+ value: function daysInMonth(month, year) {
291
+ // 1 based months
292
+ return monthLengths[+this.isLeapYear(year)][month];
293
+ }
294
+ /**
295
+ * Returns true if the object is a Javascript Date
296
+ * @param {Object} obj
297
+ * @return {boolean}
298
+ */
281
299
 
282
- /**
283
- * Returns number of days since January 1 of that year
284
- * @param {Date} date Gregorian date
285
- * @return {number}
286
- */
287
- dayOfYear: function dayOfYear(date) {
288
- if (!this.isDate(date)) {
289
- throw new TypeError('Argument to greg.dayOfYear not a Date');
300
+ }, {
301
+ key: "isDate",
302
+ value: function isDate(obj) {
303
+ return _typeof(obj) === 'object' && Date.prototype === obj.__proto__;
290
304
  }
305
+ /**
306
+ * Returns number of days since January 1 of that year
307
+ * @param {Date} date Gregorian date
308
+ * @return {number}
309
+ */
310
+
311
+ }, {
312
+ key: "dayOfYear",
313
+ value: function dayOfYear(date) {
314
+ if (!this.isDate(date)) {
315
+ throw new TypeError('Argument to greg.dayOfYear not a Date');
316
+ }
291
317
 
292
- var doy = date.getDate() + 31 * date.getMonth();
318
+ var doy = date.getDate() + 31 * date.getMonth();
293
319
 
294
- if (date.getMonth() > 1) {
295
- // FEB
296
- doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
320
+ if (date.getMonth() > 1) {
321
+ // FEB
322
+ doy -= Math.floor((4 * (date.getMonth() + 1) + 23) / 10);
297
323
 
298
- if (this.isLeapYear(date.getFullYear())) {
299
- doy++;
324
+ if (this.isLeapYear(date.getFullYear())) {
325
+ doy++;
326
+ }
300
327
  }
328
+
329
+ return doy;
301
330
  }
331
+ /**
332
+ * Converts Gregorian date to absolute R.D. (Rata Die) days
333
+ * @param {Date} date Gregorian date
334
+ * @return {number}
335
+ */
302
336
 
303
- return doy;
304
- },
337
+ }, {
338
+ key: "greg2abs",
339
+ value: function greg2abs(date) {
340
+ if (!this.isDate(date)) {
341
+ throw new TypeError('Argument to greg.greg2abs not a Date');
342
+ }
305
343
 
306
- /**
307
- * Converts Gregorian date to absolute R.D. (Rata Die) days
308
- * @param {Date} date Gregorian date
309
- * @return {number}
310
- */
311
- greg2abs: function greg2abs(date) {
312
- if (!this.isDate(date)) {
313
- throw new TypeError('Argument to greg.greg2abs not a Date');
344
+ var year = date.getFullYear() - 1;
345
+ return this.dayOfYear(date) + // days this year
346
+ 365 * year + ( // + days in prior years
347
+ Math.floor(year / 4) - // + Julian Leap years
348
+ Math.floor(year / 100) + // - century years
349
+ Math.floor(year / 400)); // + Gregorian leap years
314
350
  }
351
+ /**
352
+ * @private
353
+ * @param {number} theDate - R.D. number of days
354
+ * @return {number}
355
+ */
315
356
 
316
- var year = date.getFullYear() - 1;
317
- return this.dayOfYear(date) + // days this year
318
- 365 * year + ( // + days in prior years
319
- Math.floor(year / 4) - // + Julian Leap years
320
- Math.floor(year / 100) + // - century years
321
- Math.floor(year / 400)); // + Gregorian leap years
322
- },
357
+ }, {
358
+ key: "yearFromFixed",
359
+ value: function yearFromFixed(theDate) {
360
+ var l0 = theDate - 1;
361
+ var n400 = quotient(l0, 146097);
362
+ var d1 = mod(l0, 146097);
363
+ var n100 = quotient(d1, 36524);
364
+ var d2 = mod(d1, 36524);
365
+ var n4 = quotient(d2, 1461);
366
+ var d3 = mod(d2, 1461);
367
+ var n1 = quotient(d3, 365);
368
+ var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
369
+ return n100 != 4 && n1 != 4 ? year + 1 : year;
370
+ }
371
+ /**
372
+ * @private
373
+ * @param {number} year
374
+ * @param {number} month
375
+ * @param {number} day
376
+ * @return {number}
377
+ */
323
378
 
324
- /**
325
- * @private
326
- * @param {number} theDate - R.D. number of days
327
- * @return {number}
328
- */
329
- yearFromFixed: function yearFromFixed(theDate) {
330
- var l0 = theDate - 1;
331
- var n400 = quotient(l0, 146097);
332
- var d1 = mod(l0, 146097);
333
- var n100 = quotient(d1, 36524);
334
- var d2 = mod(d1, 36524);
335
- var n4 = quotient(d2, 1461);
336
- var d3 = mod(d2, 1461);
337
- var n1 = quotient(d3, 365);
338
- var year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
339
- return n100 != 4 && n1 != 4 ? year + 1 : year;
340
- },
379
+ }, {
380
+ key: "toFixed",
381
+ value: function toFixed(year, month, day) {
382
+ var py = year - 1;
383
+ return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
384
+ }
385
+ /**
386
+ * Converts from Rata Die (R.D. number) to Gregorian date.
387
+ * See the footnote on page 384 of ``Calendrical Calculations, Part II:
388
+ * Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
389
+ * Clamen, Software--Practice and Experience, Volume 23, Number 4
390
+ * (April, 1993), pages 383-404 for an explanation.
391
+ * @param {number} theDate - R.D. number of days
392
+ * @return {Date}
393
+ */
341
394
 
342
- /**
343
- * @private
344
- * @param {number} year
345
- * @param {number} month
346
- * @param {number} day
347
- * @return {number}
348
- */
349
- toFixed: function toFixed(year, month, day) {
350
- var py = year - 1;
351
- return 0 + 365 * py + quotient(py, 4) - quotient(py, 100) + quotient(py, 400) + quotient(367 * month - 362, 12) + Math.floor(month <= 2 ? 0 : this.isLeapYear(year) ? -1 : -2) + day;
352
- },
395
+ }, {
396
+ key: "abs2greg",
397
+ value: function abs2greg(theDate) {
398
+ if (typeof theDate !== 'number') {
399
+ throw new TypeError('Argument to greg.abs2greg not a Number');
400
+ }
353
401
 
354
- /**
355
- * Converts from Rata Die (R.D. number) to Gregorian date.
356
- * See the footnote on page 384 of ``Calendrical Calculations, Part II:
357
- * Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
358
- * Clamen, Software--Practice and Experience, Volume 23, Number 4
359
- * (April, 1993), pages 383-404 for an explanation.
360
- * @param {number} theDate - R.D. number of days
361
- * @return {Date}
362
- */
363
- abs2greg: function abs2greg(theDate) {
364
- if (typeof theDate !== 'number') {
365
- throw new TypeError('Argument to greg.abs2greg not a Number');
366
- }
402
+ theDate = Math.trunc(theDate);
403
+ var year = this.yearFromFixed(theDate);
404
+ var priorDays = theDate - this.toFixed(year, 1, 1);
405
+ var correction = theDate < this.toFixed(year, 3, 1) ? 0 : this.isLeapYear(year) ? 1 : 2;
406
+ var month = quotient(12 * (priorDays + correction) + 373, 367);
407
+ var day = theDate - this.toFixed(year, month, 1) + 1;
408
+ var dt = new Date(year, month - 1, day);
367
409
 
368
- theDate = Math.trunc(theDate);
369
- var year = this.yearFromFixed(theDate);
370
- var priorDays = theDate - this.toFixed(year, 1, 1);
371
- var correction = theDate < this.toFixed(year, 3, 1) ? 0 : this.isLeapYear(year) ? 1 : 2;
372
- var month = quotient(12 * (priorDays + correction) + 373, 367);
373
- var day = theDate - this.toFixed(year, month, 1) + 1;
374
- var dt = new Date(year, month - 1, day);
410
+ if (year < 100 && year >= 0) {
411
+ dt.setFullYear(year);
412
+ }
375
413
 
376
- if (year < 100 && year >= 0) {
377
- dt.setFullYear(year);
414
+ return dt;
378
415
  }
416
+ }]);
379
417
 
380
- return dt;
381
- }
382
- };
418
+ return greg;
419
+ }();
420
+
421
+ _defineProperty(greg, "monthNames", ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
383
422
 
384
423
  var GERESH = '׳';
385
424
  var GERSHAYIM = '״';
@@ -1770,165 +1809,194 @@ var alias = {
1770
1809
  * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
1771
1810
  * * `he` - Hebrew (e.g. "שַׁבָּת")
1772
1811
  * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
1773
- * @namespace
1774
1812
  */
1775
1813
 
1776
- var Locale = {
1777
- /** @private */
1778
- locales: Object.create(null),
1814
+ var Locale = /*#__PURE__*/function () {
1815
+ function Locale() {
1816
+ _classCallCheck(this, Locale);
1817
+ }
1779
1818
 
1780
- /** @private */
1781
- activeLocale: null,
1819
+ _createClass(Locale, null, [{
1820
+ key: "lookupTranslation",
1821
+ value:
1822
+ /** @private */
1782
1823
 
1783
- /** @private */
1784
- activeName: null,
1824
+ /** @private */
1785
1825
 
1786
- /**
1787
- * Returns translation only if `locale` offers a non-empty translation for `id`.
1788
- * Otherwise, returns `undefined`.
1789
- * @param {string} id Message ID to translate
1790
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1791
- * @return {string}
1792
- */
1793
- lookupTranslation: function lookupTranslation(id, locale) {
1794
- var locale0 = locale && locale.toLowerCase();
1795
- var loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
1796
- var array = loc[id];
1826
+ /** @private */
1797
1827
 
1798
- if (array && array.length && array[0].length) {
1799
- return array[0];
1828
+ /**
1829
+ * Returns translation only if `locale` offers a non-empty translation for `id`.
1830
+ * Otherwise, returns `undefined`.
1831
+ * @param {string} id Message ID to translate
1832
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1833
+ * @return {string}
1834
+ */
1835
+ function lookupTranslation(id, locale) {
1836
+ var locale0 = locale && locale.toLowerCase();
1837
+ var loc = typeof locale == 'string' && this.locales[locale0] || this.activeLocale;
1838
+ var array = loc[id];
1839
+
1840
+ if (array && array.length && array[0].length) {
1841
+ return array[0];
1842
+ }
1843
+
1844
+ return undefined;
1800
1845
  }
1846
+ /**
1847
+ * By default, if no translation was found, returns `id`.
1848
+ * @param {string} id Message ID to translate
1849
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1850
+ * @return {string}
1851
+ */
1801
1852
 
1802
- return undefined;
1803
- },
1853
+ }, {
1854
+ key: "gettext",
1855
+ value: function gettext(id, locale) {
1856
+ var text = this.lookupTranslation(id, locale);
1804
1857
 
1805
- /**
1806
- * By default, if no translation was found, returns `id`.
1807
- * @param {string} id Message ID to translate
1808
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1809
- * @return {string}
1810
- */
1811
- gettext: function gettext(id, locale) {
1812
- var text = this.lookupTranslation(id, locale);
1858
+ if (typeof text == 'undefined') {
1859
+ return id;
1860
+ }
1813
1861
 
1814
- if (typeof text == 'undefined') {
1815
- return id;
1862
+ return text;
1816
1863
  }
1864
+ /**
1865
+ * Register locale translations.
1866
+ * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
1867
+ * @param {LocaleDate} data parsed data from a `.po` file.
1868
+ */
1817
1869
 
1818
- return text;
1819
- },
1870
+ }, {
1871
+ key: "addLocale",
1872
+ value: function addLocale(locale, data) {
1873
+ if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
1874
+ throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
1875
+ }
1820
1876
 
1821
- /**
1822
- * Register locale translations.
1823
- * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
1824
- * @param {LocaleDate} data parsed data from a `.po` file.
1825
- */
1826
- addLocale: function addLocale(locale, data) {
1827
- if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
1828
- throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
1877
+ this.locales[locale.toLowerCase()] = data.contexts[''];
1829
1878
  }
1879
+ /**
1880
+ * Activates a locale. Throws an error if the locale has not been previously added.
1881
+ * After setting the locale to be used, all strings marked for translations
1882
+ * will be represented by the corresponding translation in the specified locale.
1883
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
1884
+ * @return {LocaleData}
1885
+ */
1830
1886
 
1831
- this.locales[locale.toLowerCase()] = data.contexts[''];
1832
- },
1887
+ }, {
1888
+ key: "useLocale",
1889
+ value: function useLocale(locale) {
1890
+ var locale0 = locale.toLowerCase();
1891
+ var obj = this.locales[locale0];
1833
1892
 
1834
- /**
1835
- * Activates a locale. Throws an error if the locale has not been previously added.
1836
- * After setting the locale to be used, all strings marked for translations
1837
- * will be represented by the corresponding translation in the specified locale.
1838
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
1839
- * @return {LocaleData}
1840
- */
1841
- useLocale: function useLocale(locale) {
1842
- var locale0 = locale.toLowerCase();
1843
- var obj = this.locales[locale0];
1893
+ if (!obj) {
1894
+ throw new RangeError("Locale '".concat(locale, "' not found"));
1895
+ }
1844
1896
 
1845
- if (!obj) {
1846
- throw new RangeError("Locale '".concat(locale, "' not found"));
1897
+ this.activeName = alias[locale0] || locale0;
1898
+ this.activeLocale = obj;
1899
+ return this.activeLocale;
1847
1900
  }
1901
+ /**
1902
+ * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
1903
+ * @return {string}
1904
+ */
1848
1905
 
1849
- this.activeName = alias[locale0] || locale0;
1850
- this.activeLocale = obj;
1851
- return this.activeLocale;
1852
- },
1906
+ }, {
1907
+ key: "getLocaleName",
1908
+ value: function getLocaleName() {
1909
+ return this.activeName;
1910
+ }
1911
+ /**
1912
+ * Returns the names of registered locales
1913
+ * @return {string[]}
1914
+ */
1853
1915
 
1854
- /**
1855
- * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
1856
- * @return {string}
1857
- */
1858
- getLocaleName: function getLocaleName() {
1859
- return this.activeName;
1860
- },
1916
+ }, {
1917
+ key: "getLocaleNames",
1918
+ value: function getLocaleNames() {
1919
+ return Object.keys(this.locales).sort();
1920
+ }
1921
+ /**
1922
+ * @param {number} n
1923
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1924
+ * @return {string}
1925
+ */
1861
1926
 
1862
- /**
1863
- * Returns the names of registered locales
1864
- * @return {string[]}
1865
- */
1866
- getLocaleNames: function getLocaleNames() {
1867
- return Object.keys(this.locales).sort();
1868
- },
1927
+ }, {
1928
+ key: "ordinal",
1929
+ value: function ordinal(n, locale) {
1930
+ var locale1 = locale && locale.toLowerCase();
1931
+ var locale0 = locale1 || this.activeName;
1869
1932
 
1870
- /**
1871
- * @param {number} n
1872
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
1873
- * @return {string}
1874
- */
1875
- ordinal: function ordinal(n, locale) {
1876
- var locale1 = locale && locale.toLowerCase();
1877
- var locale0 = locale1 || this.activeName;
1878
-
1879
- if (!locale0) {
1880
- return this.getEnOrdinal(n);
1881
- }
1882
-
1883
- switch (locale0) {
1884
- case 'en':
1885
- case 's':
1886
- case 'a':
1887
- case 'ashkenazi':
1888
- case 'ashkenazi_litvish':
1889
- case 'ashkenazi_poylish':
1890
- case 'ashkenazi_standard':
1933
+ if (!locale0) {
1891
1934
  return this.getEnOrdinal(n);
1935
+ }
1892
1936
 
1893
- case 'es':
1894
- return n + 'º';
1937
+ switch (locale0) {
1938
+ case 'en':
1939
+ case 's':
1940
+ case 'a':
1941
+ case 'ashkenazi':
1942
+ case 'ashkenazi_litvish':
1943
+ case 'ashkenazi_poylish':
1944
+ case 'ashkenazi_standard':
1945
+ return this.getEnOrdinal(n);
1895
1946
 
1896
- case 'h':
1897
- case 'he':
1898
- case 'he-x-nonikud':
1899
- return String(n);
1947
+ case 'es':
1948
+ return n + 'º';
1900
1949
 
1901
- default:
1902
- return n + '.';
1950
+ case 'h':
1951
+ case 'he':
1952
+ case 'he-x-nonikud':
1953
+ return String(n);
1954
+
1955
+ default:
1956
+ return n + '.';
1957
+ }
1903
1958
  }
1904
- },
1959
+ /**
1960
+ * @private
1961
+ * @param {number} n
1962
+ * @return {string}
1963
+ */
1905
1964
 
1906
- /**
1907
- * @private
1908
- * @param {number} n
1909
- * @return {string}
1910
- */
1911
- getEnOrdinal: function getEnOrdinal(n) {
1912
- var s = ['th', 'st', 'nd', 'rd'];
1913
- var v = n % 100;
1914
- return n + (s[(v - 20) % 10] || s[v] || s[0]);
1915
- },
1965
+ }, {
1966
+ key: "getEnOrdinal",
1967
+ value: function getEnOrdinal(n) {
1968
+ var s = ['th', 'st', 'nd', 'rd'];
1969
+ var v = n % 100;
1970
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
1971
+ }
1972
+ /**
1973
+ * Removes nekudot from Hebrew string
1974
+ * @param {string} str
1975
+ * @return {string}
1976
+ */
1977
+
1978
+ }, {
1979
+ key: "hebrewStripNikkud",
1980
+ value: function hebrewStripNikkud(str) {
1981
+ return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
1982
+ }
1983
+ }]);
1984
+
1985
+ return Locale;
1986
+ }();
1987
+
1988
+ _defineProperty(Locale, "locales", Object.create(null));
1989
+
1990
+ _defineProperty(Locale, "activeLocale", null);
1991
+
1992
+ _defineProperty(Locale, "activeName", null);
1916
1993
 
1917
- /**
1918
- * Removes nekudot from Hebrew string
1919
- * @param {string} str
1920
- * @return {string}
1921
- */
1922
- hebrewStripNikkud: function hebrewStripNikkud(str) {
1923
- return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
1924
- }
1925
- };
1926
1994
  Locale.addLocale('en', noopLocale);
1927
1995
  Locale.addLocale('s', noopLocale);
1928
1996
  Locale.addLocale('', noopLocale);
1929
1997
  Locale.useLocale('en');
1930
1998
 
1931
- var NISAN$2 = 1;
1999
+ var NISAN$3 = 1;
1932
2000
  var IYYAR$1 = 2;
1933
2001
  var SIVAN$2 = 3;
1934
2002
  var TAMUZ$1 = 4;
@@ -2345,7 +2413,7 @@ var HDate = /*#__PURE__*/function () {
2345
2413
  * @example
2346
2414
  * import {HDate, months} from '@hebcal/core';
2347
2415
  * const hd = new HDate(15, months.CHESHVAN, 5769);
2348
- * console.log(ev.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
2416
+ * console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
2349
2417
  * @return {string}
2350
2418
  */
2351
2419
  function renderGematriya() {
@@ -2601,7 +2669,7 @@ var HDate = /*#__PURE__*/function () {
2601
2669
  tempabs += HDate.daysInMonth(m, year);
2602
2670
  }
2603
2671
 
2604
- for (var _m = NISAN$2; _m < month; _m++) {
2672
+ for (var _m = NISAN$3; _m < month; _m++) {
2605
2673
  tempabs += HDate.daysInMonth(_m, year);
2606
2674
  }
2607
2675
  } else {
@@ -2879,7 +2947,7 @@ var HDate = /*#__PURE__*/function () {
2879
2947
  /* this catches "november" */
2880
2948
  }
2881
2949
 
2882
- return NISAN$2;
2950
+ return NISAN$3;
2883
2951
 
2884
2952
  case 'i':
2885
2953
  return IYYAR$1;
@@ -4267,18 +4335,20 @@ var Location = /*#__PURE__*/function () {
4267
4335
  function Location(latitude, longitude, il, tzid, cityName, countryCode, geoid) {
4268
4336
  _classCallCheck(this, Location);
4269
4337
 
4270
- this.latitude = +latitude;
4338
+ var lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
4271
4339
 
4272
- if (this.latitude < -90 || this.latitude > 90) {
4273
- throw new RangeError("Latitude ".concat(this.latitude, " out of range [-90,90]"));
4340
+ if (isNaN(lat) || lat < -90 || lat > 90) {
4341
+ throw new RangeError("Latitude ".concat(latitude, " out of range [-90,90]"));
4274
4342
  }
4275
4343
 
4276
- this.longitude = +longitude;
4344
+ var long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
4277
4345
 
4278
- if (this.longitude < -180 || this.longitude > 180) {
4279
- throw new RangeError("Longitude ".concat(this.longitude, " out of range [-180,180]"));
4346
+ if (isNaN(long) || long < -180 || long > 180) {
4347
+ throw new RangeError("Longitude ".concat(longitude, " out of range [-180,180]"));
4280
4348
  }
4281
4349
 
4350
+ this.latitude = lat;
4351
+ this.longitude = long;
4282
4352
  this.il = Boolean(il);
4283
4353
  this.tzid = tzid;
4284
4354
  this.name = cityName;
@@ -4564,7 +4634,7 @@ var TZEIT_3MEDIUM_STARS = 7.083;
4564
4634
  * @param {HDate} hd
4565
4635
  * @param {number} dow
4566
4636
  * @param {Location} location
4567
- * @param {HebrewCalendar.Options} options
4637
+ * @param {CalOptions} options
4568
4638
  * @return {Event}
4569
4639
  */
4570
4640
 
@@ -5053,7 +5123,7 @@ var OmerEvent = /*#__PURE__*/function (_Event) {
5053
5123
  }, {
5054
5124
  key: "getEmoji",
5055
5125
  value: function getEmoji() {
5056
- if (this.emoji) return this.emoji;
5126
+ if (typeof this.emoji === 'string') return this.emoji;
5057
5127
  var number = this.omer;
5058
5128
  var ones = number % 10;
5059
5129
  var tens = Math.floor(number / 10);
@@ -5064,7 +5134,8 @@ var OmerEvent = /*#__PURE__*/function (_Event) {
5064
5134
  }, {
5065
5135
  key: "getWeeks",
5066
5136
  value: function getWeeks() {
5067
- return this.weekNumber;
5137
+ var day7 = this.daysWithinWeeks === 7;
5138
+ return day7 ? this.weekNumber : this.weekNumber - 1;
5068
5139
  }
5069
5140
  /** @return {number} */
5070
5141
 
@@ -6316,7 +6387,7 @@ var TUE = 2; // const WED = 3;
6316
6387
  var THU = 4;
6317
6388
  var FRI$1 = 5;
6318
6389
  var SAT$1 = 6;
6319
- var NISAN$1 = months.NISAN;
6390
+ var NISAN$2 = months.NISAN;
6320
6391
  var IYYAR = months.IYYAR;
6321
6392
  var SIVAN$1 = months.SIVAN;
6322
6393
  var TAMUZ = months.TAMUZ;
@@ -6405,7 +6476,7 @@ var sedraCache = new SimpleMap();
6405
6476
  * @return {Sedra}
6406
6477
  */
6407
6478
 
6408
- function getSedra(hyear, il) {
6479
+ function getSedra_(hyear, il) {
6409
6480
  var cacheKey = "".concat(hyear, "-").concat(il ? 1 : 0);
6410
6481
  var sedra = sedraCache.get(cacheKey);
6411
6482
 
@@ -6420,6 +6491,11 @@ var emojiIsraelFlag = {
6420
6491
  emoji: '🇮🇱'
6421
6492
  };
6422
6493
  var chanukahEmoji = '🕎';
6494
+ var emojiPesach = '🫓';
6495
+ var emojiShavuot = {
6496
+ emoji: '⛰️🌸'
6497
+ };
6498
+ var emojiSukkot = '🌿🍋';
6423
6499
  var yearCache = Object.create(null);
6424
6500
  /**
6425
6501
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
@@ -6430,7 +6506,7 @@ var yearCache = Object.create(null);
6430
6506
  * @return {Map<string,Event[]>}
6431
6507
  */
6432
6508
 
6433
- function getHolidaysForYear(year) {
6509
+ function getHolidaysForYear_(year) {
6434
6510
  if (typeof year !== 'number') {
6435
6511
  throw new TypeError("bad Hebrew year: ".concat(year));
6436
6512
  } else if (year < 1 || year > 32658) {
@@ -6444,7 +6520,7 @@ function getHolidaysForYear(year) {
6444
6520
  }
6445
6521
 
6446
6522
  var RH = new HDate(1, TISHREI$1, year);
6447
- var pesach = new HDate(15, NISAN$1, year);
6523
+ var pesach = new HDate(15, NISAN$2, year);
6448
6524
  var h = new SimpleMap(); // eslint-disable-next-line require-jsdoc
6449
6525
 
6450
6526
  function add() {
@@ -6487,27 +6563,45 @@ function getHolidaysForYear(year) {
6487
6563
  add(new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), 'Shabbat Shuva', SPECIAL_SHABBAT$1));
6488
6564
  addEvents(year, [[10, TISHREI$1, 'Yom Kippur', CHAG | YOM_TOV_ENDS$1 | MAJOR_FAST$1, {
6489
6565
  emoji: '📖✍️'
6490
- }], [14, TISHREI$1, 'Erev Sukkot', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
6491
- [15, TISHREI$1, 'Sukkot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, TISHREI$1, 'Sukkot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6492
- cholHaMoedDay: 1
6566
+ }], [14, TISHREI$1, 'Erev Sukkot', EREV$1 | LIGHT_CANDLES$1, {
6567
+ emoji: emojiSukkot
6568
+ }], // Attributes for Israel and Diaspora are different
6569
+ [15, TISHREI$1, 'Sukkot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
6570
+ emoji: emojiSukkot
6571
+ }], [16, TISHREI$1, 'Sukkot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
6572
+ emoji: emojiSukkot
6573
+ }], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6574
+ cholHaMoedDay: 1,
6575
+ emoji: emojiSukkot
6493
6576
  }], [18, TISHREI$1, 'Sukkot IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6494
- cholHaMoedDay: 2
6577
+ cholHaMoedDay: 2,
6578
+ emoji: emojiSukkot
6495
6579
  }], [19, TISHREI$1, 'Sukkot V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6496
- cholHaMoedDay: 3
6580
+ cholHaMoedDay: 3,
6581
+ emoji: emojiSukkot
6497
6582
  }], [20, TISHREI$1, 'Sukkot VI (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6498
- cholHaMoedDay: 4
6499
- }], [15, TISHREI$1, 'Sukkot I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, TISHREI$1, 'Sukkot II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6500
- cholHaMoedDay: 1
6583
+ cholHaMoedDay: 4,
6584
+ emoji: emojiSukkot
6585
+ }], [15, TISHREI$1, 'Sukkot I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
6586
+ emoji: emojiSukkot
6587
+ }], [16, TISHREI$1, 'Sukkot II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6588
+ cholHaMoedDay: 1,
6589
+ emoji: emojiSukkot
6501
6590
  }], [17, TISHREI$1, 'Sukkot III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6502
- cholHaMoedDay: 2
6591
+ cholHaMoedDay: 2,
6592
+ emoji: emojiSukkot
6503
6593
  }], [18, TISHREI$1, 'Sukkot IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6504
- cholHaMoedDay: 3
6594
+ cholHaMoedDay: 3,
6595
+ emoji: emojiSukkot
6505
6596
  }], [19, TISHREI$1, 'Sukkot V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6506
- cholHaMoedDay: 4
6597
+ cholHaMoedDay: 4,
6598
+ emoji: emojiSukkot
6507
6599
  }], [20, TISHREI$1, 'Sukkot VI (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6508
- cholHaMoedDay: 5
6600
+ cholHaMoedDay: 5,
6601
+ emoji: emojiSukkot
6509
6602
  }], [21, TISHREI$1, 'Sukkot VII (Hoshana Raba)', LIGHT_CANDLES$1 | CHOL_HAMOED$1, {
6510
- cholHaMoedDay: -1
6603
+ cholHaMoedDay: -1,
6604
+ emoji: emojiSukkot
6511
6605
  }], [22, TISHREI$1, 'Shmini Atzeret', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], // [22, TISHREI, "Shmini Atzeret / Simchat Torah", YOM_TOV_ENDS | IL_ONLY],
6512
6606
  [22, TISHREI$1, 'Shmini Atzeret', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [23, TISHREI$1, 'Simchat Torah', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1]]);
6513
6607
  add(new HolidayEvent(new HDate(24, KISLEV$1, year), 'Chanukah: 1 Candle', EREV$1 | MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, {
@@ -6540,37 +6634,52 @@ function getHolidaysForYear(year) {
6540
6634
  add(new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() == SUN ? 28 : 29)), 'Shushan Purim', MINOR_HOLIDAY$1, {
6541
6635
  emoji: '🎭️📜'
6542
6636
  }), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14) - 7), 'Shabbat Parah', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 14)), 'Shabbat HaChodesh', SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 1)), 'Shabbat HaGadol', SPECIAL_SHABBAT$1), new HolidayEvent( // if the fast falls on Shabbat, move to Thursday
6543
- pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$1, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
6544
- addEvents(year, [[14, NISAN$1, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1], // Attributes for Israel and Diaspora are different
6545
- [15, NISAN$1, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [16, NISAN$1, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6546
- cholHaMoedDay: 1
6547
- }], [17, NISAN$1, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6548
- cholHaMoedDay: 2
6549
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6550
- cholHaMoedDay: 3
6551
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6552
- cholHaMoedDay: 4
6553
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
6554
- cholHaMoedDay: 5
6555
- }], [21, NISAN$1, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1], [15, NISAN$1, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [16, NISAN$1, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [17, NISAN$1, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6556
- cholHaMoedDay: 1
6557
- }], [18, NISAN$1, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6558
- cholHaMoedDay: 2
6559
- }], [19, NISAN$1, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6560
- cholHaMoedDay: 3
6561
- }], [20, NISAN$1, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
6562
- cholHaMoedDay: 4
6563
- }], [21, NISAN$1, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1], [22, NISAN$1, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
6637
+ pesach.prev().getDay() == SAT$1 ? pesach.onOrBefore(THU) : new HDate(14, NISAN$2, year), 'Ta\'anit Bechorot', MINOR_FAST$1));
6638
+ addEvents(year, [[14, NISAN$2, 'Erev Pesach', EREV$1 | LIGHT_CANDLES$1, {
6639
+ emoji: '🫓🍷'
6640
+ }], // Attributes for Israel and Diaspora are different
6641
+ [15, NISAN$2, 'Pesach I', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
6642
+ emoji: emojiPesach
6643
+ }], [16, NISAN$2, 'Pesach II (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6644
+ cholHaMoedDay: 1,
6645
+ emoji: emojiPesach
6646
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6647
+ cholHaMoedDay: 2,
6648
+ emoji: emojiPesach
6649
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6650
+ cholHaMoedDay: 3,
6651
+ emoji: emojiPesach
6652
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', IL_ONLY$1 | CHOL_HAMOED$1, {
6653
+ cholHaMoedDay: 4,
6654
+ emoji: emojiPesach
6655
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | IL_ONLY$1 | CHOL_HAMOED$1, {
6656
+ cholHaMoedDay: 5,
6657
+ emoji: emojiPesach
6658
+ }], [21, NISAN$2, 'Pesach VII', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
6659
+ emoji: emojiPesach
6660
+ }], [15, NISAN$2, 'Pesach I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
6661
+ emoji: '🫓🍷'
6662
+ }], [16, NISAN$2, 'Pesach II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
6663
+ emoji: emojiPesach
6664
+ }], [17, NISAN$2, 'Pesach III (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6665
+ cholHaMoedDay: 1,
6666
+ emoji: emojiPesach
6667
+ }], [18, NISAN$2, 'Pesach IV (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6668
+ cholHaMoedDay: 2,
6669
+ emoji: emojiPesach
6670
+ }], [19, NISAN$2, 'Pesach V (CH\'\'M)', CHUL_ONLY$1 | CHOL_HAMOED$1, {
6671
+ cholHaMoedDay: 3,
6672
+ emoji: emojiPesach
6673
+ }], [20, NISAN$2, 'Pesach VI (CH\'\'M)', LIGHT_CANDLES$1 | CHUL_ONLY$1 | CHOL_HAMOED$1, {
6674
+ cholHaMoedDay: 4,
6675
+ emoji: emojiPesach
6676
+ }], [21, NISAN$2, 'Pesach VII', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
6677
+ emoji: emojiPesach
6678
+ }], [22, NISAN$2, 'Pesach VIII', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
6679
+ emoji: emojiPesach
6680
+ }], [14, IYYAR, 'Pesach Sheni', MINOR_HOLIDAY$1], [18, IYYAR, 'Lag BaOmer', MINOR_HOLIDAY$1, {
6564
6681
  emoji: '🔥'
6565
- }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, {
6566
- emoji: '⛰️🌸'
6567
- }], [6, SIVAN$1, 'Shavuot', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, {
6568
- emoji: '⛰️🌸'
6569
- }], [6, SIVAN$1, 'Shavuot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, {
6570
- emoji: '⛰️🌸'
6571
- }], [7, SIVAN$1, 'Shavuot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, {
6572
- emoji: '⛰️🌸'
6573
- }], [15, AV, 'Tu B\'Av', MINOR_HOLIDAY$1, {
6682
+ }], [5, SIVAN$1, 'Erev Shavuot', EREV$1 | LIGHT_CANDLES$1, emojiShavuot], [6, SIVAN$1, 'Shavuot', CHAG | YOM_TOV_ENDS$1 | IL_ONLY$1, emojiShavuot], [6, SIVAN$1, 'Shavuot I', CHAG | LIGHT_CANDLES_TZEIS$1 | CHUL_ONLY$1, emojiShavuot], [7, SIVAN$1, 'Shavuot II', CHAG | YOM_TOV_ENDS$1 | CHUL_ONLY$1, emojiShavuot], [15, AV, 'Tu B\'Av', MINOR_HOLIDAY$1, {
6574
6683
  emoji: '❤️'
6575
6684
  }], [1, ELUL$1, 'Rosh Hashana LaBehemot', MINOR_HOLIDAY$1, {
6576
6685
  emoji: '🐑'
@@ -6590,7 +6699,7 @@ function getHolidaysForYear(year) {
6590
6699
 
6591
6700
  if (year >= 5711) {
6592
6701
  // Yom HaShoah first observed in 1951
6593
- var nisan27dt = new HDate(27, NISAN$1, year);
6702
+ var nisan27dt = new HDate(27, NISAN$2, year);
6594
6703
  /* When the actual date of Yom Hashoah falls on a Friday, the
6595
6704
  * state of Israel observes Yom Hashoah on the preceding
6596
6705
  * Thursday. When it falls on a Sunday, Yom Hashoah is observed
@@ -6599,9 +6708,9 @@ function getHolidaysForYear(year) {
6599
6708
  */
6600
6709
 
6601
6710
  if (nisan27dt.getDay() == FRI$1) {
6602
- nisan27dt = new HDate(26, NISAN$1, year);
6711
+ nisan27dt = new HDate(26, NISAN$2, year);
6603
6712
  } else if (nisan27dt.getDay() == SUN) {
6604
- nisan27dt = new HDate(28, NISAN$1, year);
6713
+ nisan27dt = new HDate(28, NISAN$2, year);
6605
6714
  }
6606
6715
 
6607
6716
  add(new HolidayEvent(nisan27dt, 'Yom HaShoah', MODERN_HOLIDAY$1));
@@ -6636,7 +6745,7 @@ function getHolidaysForYear(year) {
6636
6745
  }
6637
6746
 
6638
6747
  if (year >= 5777) {
6639
- add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$1, year), 'Yom HaAliyah', MODERN_HOLIDAY$1, emojiIsraelFlag));
6748
+ add(new HolidayEvent(new HDate(7, CHESHVAN$1, year), 'Yom HaAliyah School Observance', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(new HDate(10, NISAN$2, year), 'Yom HaAliyah', MODERN_HOLIDAY$1, emojiIsraelFlag));
6640
6749
  }
6641
6750
 
6642
6751
  var tamuz17 = new HDate(17, TAMUZ, year);
@@ -6669,7 +6778,7 @@ function getHolidaysForYear(year) {
6669
6778
  for (var month = 1; month <= monthsInYear; month++) {
6670
6779
  var monthName = HDate.getMonthName(month, year);
6671
6780
 
6672
- if ((month == NISAN$1 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
6781
+ if ((month == NISAN$2 ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1) : HDate.daysInMonth(month - 1, year)) == 30) {
6673
6782
  add(new RoshChodeshEvent(new HDate(1, month, year), monthName));
6674
6783
  add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
6675
6784
  } else if (month !== TISHREI$1) {
@@ -6685,7 +6794,7 @@ function getHolidaysForYear(year) {
6685
6794
  add(new MevarchimChodeshEvent(new HDate(29, month, year).onOrBefore(SAT$1), nextMonthName));
6686
6795
  }
6687
6796
 
6688
- var sedra = getSedra(year, false);
6797
+ var sedra = getSedra_(year, false);
6689
6798
  var beshalachHd = sedra.find(15);
6690
6799
  add(new HolidayEvent(beshalachHd, 'Shabbat Shirah', SPECIAL_SHABBAT$1));
6691
6800
  yearCache[year] = h;
@@ -6879,7 +6988,100 @@ var MishnaYomiEvent = /*#__PURE__*/function (_Event) {
6879
6988
  return MishnaYomiEvent;
6880
6989
  }(Event);
6881
6990
 
6882
- var version="3.33.3";
6991
+ var NISAN$1 = months.NISAN;
6992
+ var CHESHVAN = months.CHESHVAN;
6993
+ var KISLEV = months.KISLEV;
6994
+ var TEVET = months.TEVET;
6995
+ var SHVAT = months.SHVAT;
6996
+ var ADAR_I = months.ADAR_I;
6997
+ var ADAR_II = months.ADAR_II;
6998
+ /**
6999
+ * @private
7000
+ * @param {number} hyear Hebrew year
7001
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
7002
+ * @return {HDate} anniversary occurring in hyear
7003
+ */
7004
+
7005
+ function getYahrzeit_(hyear, gdate) {
7006
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7007
+ var hDeath = {
7008
+ yy: orig.getFullYear(),
7009
+ mm: orig.getMonth(),
7010
+ dd: orig.getDate()
7011
+ };
7012
+
7013
+ if (hyear <= hDeath.yy) {
7014
+ // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
7015
+ return undefined;
7016
+ }
7017
+
7018
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
7019
+ // If it's Heshvan 30 it depends on the first anniversary;
7020
+ // if that was not Heshvan 30, use the day before Kislev 1.
7021
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
7022
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
7023
+ // If it's Kislev 30 it depends on the first anniversary;
7024
+ // if that was not Kislev 30, use the day before Teveth 1.
7025
+ hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
7026
+ } else if (hDeath.mm == ADAR_II) {
7027
+ // If it's Adar II, use the same day in last month of year (Adar or Adar II).
7028
+ hDeath.mm = HDate.monthsInYear(hyear);
7029
+ } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
7030
+ // If it's the 30th in Adar I and year is not a leap year
7031
+ // (so Adar has only 29 days), use the last day in Shevat.
7032
+ hDeath.dd = 30;
7033
+ hDeath.mm = SHVAT;
7034
+ } // In all other cases, use the normal anniversary of the date of death.
7035
+ // advance day to rosh chodesh if needed
7036
+
7037
+
7038
+ if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
7039
+ hDeath.mm = KISLEV;
7040
+ hDeath.dd = 1;
7041
+ } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
7042
+ hDeath.mm = TEVET;
7043
+ hDeath.dd = 1;
7044
+ }
7045
+
7046
+ return new HDate(hDeath.dd, hDeath.mm, hyear);
7047
+ }
7048
+ /**
7049
+ * @private
7050
+ * @param {number} hyear Hebrew year
7051
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
7052
+ * @return {HDate} anniversary occurring in `hyear`
7053
+ */
7054
+
7055
+ function getBirthdayOrAnniversary_(hyear, gdate) {
7056
+ var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7057
+ var origYear = orig.getFullYear();
7058
+
7059
+ if (hyear <= origYear) {
7060
+ // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
7061
+ return undefined;
7062
+ }
7063
+
7064
+ var isOrigLeap = HDate.isLeapYear(origYear);
7065
+ var month = orig.getMonth();
7066
+ var day = orig.getDate();
7067
+
7068
+ if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
7069
+ month = HDate.monthsInYear(hyear);
7070
+ } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
7071
+ month = KISLEV;
7072
+ day = 1;
7073
+ } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
7074
+ month = TEVET;
7075
+ day = 1;
7076
+ } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
7077
+ month = NISAN$1;
7078
+ day = 1;
7079
+ }
7080
+
7081
+ return new HDate(day, month, hyear);
7082
+ }
7083
+
7084
+ var version="3.33.6";
6883
7085
 
6884
7086
  var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);",language:"en_CA@ashkenazi"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],Tazria:["Sazria"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
6885
7087
 
@@ -6907,26 +7109,6 @@ var poHeNoNikud = {
6907
7109
  };
6908
7110
  Locale.addLocale(localeName, poHeNoNikud);
6909
7111
 
6910
- /*
6911
- Hebcal - A Jewish Calendar Generator
6912
- Copyright (c) 1994-2020 Danny Sadinoff
6913
- Portions copyright Eyal Schachter and Michael J. Radwin
6914
-
6915
- https://github.com/hebcal/hebcal-es6
6916
-
6917
- This program is free software; you can redistribute it and/or
6918
- modify it under the terms of the GNU General Public License
6919
- as published by the Free Software Foundation; either version 2
6920
- of the License, or (at your option) any later version.
6921
-
6922
- This program is distributed in the hope that it will be useful,
6923
- but WITHOUT ANY WARRANTY; without even the implied warranty of
6924
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6925
- GNU General Public License for more details.
6926
-
6927
- You should have received a copy of the GNU General Public License
6928
- along with this program. If not, see <http://www.gnu.org/licenses/>.
6929
- */
6930
7112
  var FRI = 5;
6931
7113
  var SAT = 6;
6932
7114
  var NISAN = months.NISAN; // const IYYAR = months.IYYAR;
@@ -6936,12 +7118,6 @@ var SIVAN = months.SIVAN; // const TAMUZ = months.TAMUZ;
6936
7118
 
6937
7119
  var ELUL = months.ELUL;
6938
7120
  var TISHREI = months.TISHREI;
6939
- var CHESHVAN = months.CHESHVAN;
6940
- var KISLEV = months.KISLEV;
6941
- var TEVET = months.TEVET;
6942
- var SHVAT = months.SHVAT;
6943
- var ADAR_I = months.ADAR_I;
6944
- var ADAR_II = months.ADAR_II;
6945
7121
  var LIGHT_CANDLES = flags.LIGHT_CANDLES;
6946
7122
  var YOM_TOV_ENDS = flags.YOM_TOV_ENDS;
6947
7123
  var CHUL_ONLY = flags.CHUL_ONLY;
@@ -6995,7 +7171,7 @@ var RECOGNIZED_OPTIONS = {
6995
7171
  };
6996
7172
  /**
6997
7173
  * @private
6998
- * @param {HebrewCalendar.Options} options
7174
+ * @param {CalOptions} options
6999
7175
  */
7000
7176
 
7001
7177
  function warnUnrecognizedOptions(options) {
@@ -7024,7 +7200,7 @@ function shallowCopy(target, source) {
7024
7200
  /**
7025
7201
  * Modifies options in-place
7026
7202
  * @private
7027
- * @param {HebrewCalendar.Options} options
7203
+ * @param {CalOptions} options
7028
7204
  */
7029
7205
 
7030
7206
 
@@ -7059,7 +7235,7 @@ function checkCandleOptions(options) {
7059
7235
  }
7060
7236
  /**
7061
7237
  * Options to configure which events are returned
7062
- * @typedef {Object} HebrewCalendar.Options
7238
+ * @typedef {Object} CalOptions
7063
7239
  * @property {Location} location - latitude/longitude/tzid used for candle-lighting
7064
7240
  * @property {number} year - Gregorian or Hebrew year
7065
7241
  * @property {boolean} isHebrewYear - to interpret year as Hebrew year
@@ -7115,7 +7291,7 @@ function getAbs(d) {
7115
7291
  /**
7116
7292
  * Parse options object to determine start & end days
7117
7293
  * @private
7118
- * @param {HebrewCalendar.Options} options
7294
+ * @param {CalOptions} options
7119
7295
  * @return {number[]}
7120
7296
  */
7121
7297
 
@@ -7193,7 +7369,7 @@ function getStartAndEnd(options) {
7193
7369
  /**
7194
7370
  * Mask to filter Holiday array
7195
7371
  * @private
7196
- * @param {HebrewCalendar.Options} options
7372
+ * @param {CalOptions} options
7197
7373
  * @return {number}
7198
7374
  */
7199
7375
 
@@ -7273,511 +7449,489 @@ function getMaskFromOptions(options) {
7273
7449
  }
7274
7450
 
7275
7451
  var MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
7452
+ var defaultLocation = new Location(0, 0, false, 'UTC');
7453
+ var hour12cc = {
7454
+ US: 1,
7455
+ CA: 1,
7456
+ BR: 1,
7457
+ AU: 1,
7458
+ NZ: 1,
7459
+ DO: 1,
7460
+ PR: 1,
7461
+ GR: 1,
7462
+ IN: 1,
7463
+ KR: 1,
7464
+ NP: 1,
7465
+ ZA: 1
7466
+ };
7467
+ /**
7468
+ * @private
7469
+ * @param {Event} ev
7470
+ * @return {boolean}
7471
+ */
7472
+
7473
+ function observedInIsrael(ev) {
7474
+ return ev.observedInIsrael();
7475
+ }
7476
+ /**
7477
+ * @private
7478
+ * @param {Event} ev
7479
+ * @return {boolean}
7480
+ */
7481
+
7482
+
7483
+ function observedInDiaspora(ev) {
7484
+ return ev.observedInDiaspora();
7485
+ }
7276
7486
  /**
7277
- * @namespace
7278
7487
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
7279
7488
  * This namespace is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
7280
7489
  * Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
7281
7490
  * Event names can be rendered in several languges using the `locale` option.
7282
7491
  */
7283
7492
 
7284
- var HebrewCalendar = {
7285
- /** @private */
7286
- defaultLocation: new Location(0, 0, false, 'UTC'),
7287
7493
 
7288
- /**
7289
- * Calculates holidays and other Hebrew calendar events based on {@link HebrewCalendar.Options}.
7290
- *
7291
- * Each holiday is represented by an {@link Event} object which includes a date,
7292
- * a description, flags and optional attributes.
7293
- * If given no options, returns holidays for the Diaspora for the current Gregorian year.
7294
- *
7295
- * The date range returned by this function can be controlled by:
7296
- * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
7297
- * * `options.isHebrewYear` - to interpret `year` as Hebrew year
7298
- * * `options.numYears` - generate calendar for multiple years (default 1)
7299
- * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
7300
- *
7301
- * Alternatively, specify start and end days with `Date` or {@link HDate} instances:
7302
- * * `options.start` - use specific start date (requires `end` date)
7303
- * * `options.end` - use specific end date (requires `start` date)
7304
- *
7305
- * Unless `options.noHolidays == true`, default holidays include:
7306
- * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
7307
- * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
7308
- * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
7309
- * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
7310
- * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
7311
- * * Rosh Chodesh (unless `options.noRoshChodesh`)
7312
- *
7313
- * Holiday and Torah reading schedules differ between Israel and the Disapora.
7314
- * Set `options.il=true` to use the Israeli schedule.
7315
- *
7316
- * Additional non-default event types can be specified:
7317
- * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
7318
- * * Counting of the Omer (`options.omer`)
7319
- * * Daf Yomi (`options.dafyomi`)
7320
- * * Mishna Yomi (`options.mishnaYomi`)
7321
- * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
7322
- * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
7323
- *
7324
- * Candle-lighting and Havdalah times are approximated using latitude and longitude
7325
- * specified by the {@link Location} class. The `Location` class contains a small
7326
- * database of cities with their associated geographic information and time-zone information.
7327
- * If you ever have any doubts about Hebcal's times, consult your local halachic authority.
7328
- * If you enter geographic coordinates above the arctic circle or antarctic circle,
7329
- * the times are guaranteed to be wrong.
7330
- *
7331
- * To add candle-lighting options, set `options.candlelighting=true` and set
7332
- * `options.location` to an instance of `Location`. By default, candle lighting
7333
- * time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
7334
- * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
7335
- * are observable in the night time sky with the naked eye). The default Havdalah
7336
- * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
7337
- * These defaults can be changed using these options:
7338
- * * `options.candleLightingMins` - minutes before sundown to light candles
7339
- * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
7340
- * Havdalah times are supressed when `options.havdalahMins=0`.
7341
- * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
7342
- * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
7343
- * Havdalah times are supressed when `options.havdalahDeg=0`.
7344
- *
7345
- * If both `options.candlelighting=true` and `options.location` is specified,
7346
- * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7347
- * Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
7348
- * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7349
- * Saturday night (see above).
7350
- *
7351
- * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
7352
- * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
7353
- * in the evening).
7354
- *
7355
- * Two options also exist for generating an Event with the Hebrew date:
7356
- * * `options.addHebrewDates` - print the Hebrew date for the entire date range
7357
- * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
7358
- *
7359
- * Lastly, translation and transliteration of event titles is controlled by
7360
- * `options.locale` and the {@link Locale} API.
7361
- * `@hebcal/core` supports three locales by default:
7362
- * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
7363
- * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
7364
- * * `he` - Hebrew (e.g. "שַׁבָּת")
7365
- *
7366
- * Additional locales (such as `ru` or `fr`) are supported by the
7367
- * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
7368
- *
7369
- * @example
7370
- * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
7371
- * const options = {
7372
- * year: 1981,
7373
- * isHebrewYear: false,
7374
- * candlelighting: true,
7375
- * location: Location.lookup('San Francisco'),
7376
- * sedrot: true,
7377
- * omer: true,
7378
- * };
7379
- * const events = HebrewCalendar.calendar(options);
7380
- * for (const ev of events) {
7381
- * const hd = ev.getDate();
7382
- * const date = hd.greg();
7383
- * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
7384
- * }
7385
- * @param {HebrewCalendar.Options} [options={}]
7386
- * @return {Event[]}
7387
- */
7388
- calendar: function calendar() {
7389
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7390
- options = shallowCopy({}, options); // so we can modify freely
7391
-
7392
- checkCandleOptions(options);
7393
- var location = options.location = options.location || this.defaultLocation;
7394
- var il = options.il = options.il || location.il || false;
7395
- options.mask = getMaskFromOptions(options);
7396
-
7397
- if (options.ashkenazi || options.locale) {
7398
- if (options.locale && typeof options.locale !== 'string') {
7399
- throw new TypeError("Invalid options.locale: ".concat(options.locale));
7400
- }
7494
+ var HebrewCalendar = /*#__PURE__*/function () {
7495
+ function HebrewCalendar() {
7496
+ _classCallCheck(this, HebrewCalendar);
7497
+ }
7498
+
7499
+ _createClass(HebrewCalendar, null, [{
7500
+ key: "calendar",
7501
+ value:
7502
+ /**
7503
+ * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
7504
+ *
7505
+ * Each holiday is represented by an {@link Event} object which includes a date,
7506
+ * a description, flags and optional attributes.
7507
+ * If given no options, returns holidays for the Diaspora for the current Gregorian year.
7508
+ *
7509
+ * The date range returned by this function can be controlled by:
7510
+ * * `options.year` - Gregorian (e.g. 1993) or Hebrew year (e.g. 5749)
7511
+ * * `options.isHebrewYear` - to interpret `year` as Hebrew year
7512
+ * * `options.numYears` - generate calendar for multiple years (default 1)
7513
+ * * `options.month` - Gregorian or Hebrew month (to filter results to a single month)
7514
+ *
7515
+ * Alternatively, specify start and end days with `Date` or {@link HDate} instances:
7516
+ * * `options.start` - use specific start date (requires `end` date)
7517
+ * * `options.end` - use specific end date (requires `start` date)
7518
+ *
7519
+ * Unless `options.noHolidays == true`, default holidays include:
7520
+ * * Major holidays - Rosh Hashana, Yom Kippur, Pesach, Sukkot, etc.
7521
+ * * Minor holidays - Purim, Chanukah, Tu BiShvat, Lag BaOmer, etc.
7522
+ * * Minor fasts - Ta'anit Esther, Tzom Gedaliah, etc. (unless `options.noMinorFast`)
7523
+ * * Special Shabbatot - Shabbat Shekalim, Zachor, etc. (unless `options.noSpecialShabbat`)
7524
+ * * Modern Holidays - Yom HaShoah, Yom HaAtzma'ut, etc. (unless `options.noModern`)
7525
+ * * Rosh Chodesh (unless `options.noRoshChodesh`)
7526
+ *
7527
+ * Holiday and Torah reading schedules differ between Israel and the Disapora.
7528
+ * Set `options.il=true` to use the Israeli schedule.
7529
+ *
7530
+ * Additional non-default event types can be specified:
7531
+ * * Parashat HaShavua - weekly Torah Reading on Saturdays (`options.sedrot`)
7532
+ * * Counting of the Omer (`options.omer`)
7533
+ * * Daf Yomi (`options.dafyomi`)
7534
+ * * Mishna Yomi (`options.mishnaYomi`)
7535
+ * * Shabbat Mevarchim HaChodesh on Saturday before Rosh Chodesh (`options.shabbatMevarchim`)
7536
+ * * Molad announcement on Saturday before Rosh Chodesh (`options.molad`)
7537
+ *
7538
+ * Candle-lighting and Havdalah times are approximated using latitude and longitude
7539
+ * specified by the {@link Location} class. The `Location` class contains a small
7540
+ * database of cities with their associated geographic information and time-zone information.
7541
+ * If you ever have any doubts about Hebcal's times, consult your local halachic authority.
7542
+ * If you enter geographic coordinates above the arctic circle or antarctic circle,
7543
+ * the times are guaranteed to be wrong.
7544
+ *
7545
+ * To add candle-lighting options, set `options.candlelighting=true` and set
7546
+ * `options.location` to an instance of `Location`. By default, candle lighting
7547
+ * time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is
7548
+ * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars
7549
+ * are observable in the night time sky with the naked eye). The default Havdalah
7550
+ * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon.
7551
+ * These defaults can be changed using these options:
7552
+ * * `options.candleLightingMins` - minutes before sundown to light candles
7553
+ * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72).
7554
+ * Havdalah times are supressed when `options.havdalahMins=0`.
7555
+ * * `options.havdalahDeg` - degrees for solar depression for Havdalah.
7556
+ * Default is 8.5 degrees for 3 small stars. Use 7.083 degress for 3 medium-sized stars.
7557
+ * Havdalah times are supressed when `options.havdalahDeg=0`.
7558
+ *
7559
+ * If both `options.candlelighting=true` and `options.location` is specified,
7560
+ * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7561
+ * Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening)
7562
+ * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7563
+ * Saturday night (see above).
7564
+ *
7565
+ * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and
7566
+ * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon
7567
+ * in the evening).
7568
+ *
7569
+ * Two options also exist for generating an Event with the Hebrew date:
7570
+ * * `options.addHebrewDates` - print the Hebrew date for the entire date range
7571
+ * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
7572
+ *
7573
+ * Lastly, translation and transliteration of event titles is controlled by
7574
+ * `options.locale` and the {@link Locale} API.
7575
+ * `@hebcal/core` supports three locales by default:
7576
+ * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
7577
+ * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
7578
+ * * `he` - Hebrew (e.g. "שַׁבָּת")
7579
+ *
7580
+ * Additional locales (such as `ru` or `fr`) are supported by the
7581
+ * {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
7582
+ *
7583
+ * @example
7584
+ * import {HebrewCalendar, HDate, Location, Event} from '@hebcal/core';
7585
+ * const options = {
7586
+ * year: 1981,
7587
+ * isHebrewYear: false,
7588
+ * candlelighting: true,
7589
+ * location: Location.lookup('San Francisco'),
7590
+ * sedrot: true,
7591
+ * omer: true,
7592
+ * };
7593
+ * const events = HebrewCalendar.calendar(options);
7594
+ * for (const ev of events) {
7595
+ * const hd = ev.getDate();
7596
+ * const date = hd.greg();
7597
+ * console.log(date.toLocaleDateString(), ev.render(), hd.toString());
7598
+ * }
7599
+ * @param {CalOptions} [options={}]
7600
+ * @return {Event[]}
7601
+ */
7602
+ function calendar() {
7603
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7604
+ options = shallowCopy({}, options); // so we can modify freely
7605
+
7606
+ checkCandleOptions(options);
7607
+ var location = options.location = options.location || defaultLocation;
7608
+ var il = options.il = options.il || location.il || false;
7609
+ options.mask = getMaskFromOptions(options);
7610
+
7611
+ if (options.ashkenazi || options.locale) {
7612
+ if (options.locale && typeof options.locale !== 'string') {
7613
+ throw new TypeError("Invalid options.locale: ".concat(options.locale));
7614
+ }
7401
7615
 
7402
- var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
7403
- var translationObj = Locale.useLocale(locale);
7616
+ var locale = options.ashkenazi ? 'ashkenazi' : options.locale;
7617
+ var translationObj = Locale.useLocale(locale);
7404
7618
 
7405
- if (!translationObj) {
7406
- throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
7619
+ if (!translationObj) {
7620
+ throw new TypeError("Locale '".concat(locale, "' not found; did you forget to import @hebcal/locales?"));
7621
+ }
7622
+ } else {
7623
+ Locale.useLocale('en');
7407
7624
  }
7408
- } else {
7409
- Locale.useLocale('en');
7410
- }
7411
7625
 
7412
- var evts = [];
7413
- var sedra;
7414
- var holidaysYear;
7415
- var beginOmer;
7416
- var endOmer;
7417
- var currentYear = -1;
7418
- var startAndEnd = getStartAndEnd(options);
7419
- warnUnrecognizedOptions(options);
7420
- var startAbs = startAndEnd[0];
7421
- var endAbs = startAndEnd[1];
7422
- var startGreg = greg.abs2greg(startAbs);
7423
-
7424
- if (startGreg.getFullYear() < 100) {
7425
- options.candlelighting = false;
7426
- }
7626
+ var evts = [];
7627
+ var sedra;
7628
+ var holidaysYear;
7629
+ var beginOmer;
7630
+ var endOmer;
7631
+ var currentYear = -1;
7632
+ var startAndEnd = getStartAndEnd(options);
7633
+ warnUnrecognizedOptions(options);
7634
+ var startAbs = startAndEnd[0];
7635
+ var endAbs = startAndEnd[1];
7636
+ var startGreg = greg.abs2greg(startAbs);
7637
+
7638
+ if (startGreg.getFullYear() < 100) {
7639
+ options.candlelighting = false;
7640
+ }
7427
7641
 
7428
- var mishnaYomiIndex;
7642
+ var mishnaYomiIndex;
7429
7643
 
7430
- if (options.mishnaYomi) {
7431
- mishnaYomiIndex = new MishnaYomiIndex();
7432
- }
7644
+ if (options.mishnaYomi) {
7645
+ mishnaYomiIndex = new MishnaYomiIndex();
7646
+ }
7433
7647
 
7434
- var _loop = function _loop(abs) {
7435
- var hd = new HDate(abs);
7436
- var hyear = hd.getFullYear();
7648
+ var _loop = function _loop(abs) {
7649
+ var hd = new HDate(abs);
7650
+ var hyear = hd.getFullYear();
7437
7651
 
7438
- if (hyear != currentYear) {
7439
- currentYear = hyear;
7440
- holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
7652
+ if (hyear != currentYear) {
7653
+ currentYear = hyear;
7654
+ holidaysYear = HebrewCalendar.getHolidaysForYear(currentYear);
7441
7655
 
7442
- if (options.sedrot && currentYear >= 3762) {
7443
- sedra = getSedra(currentYear, il);
7444
- }
7656
+ if (options.sedrot && currentYear >= 3762) {
7657
+ sedra = getSedra_(currentYear, il);
7658
+ }
7445
7659
 
7446
- if (options.omer) {
7447
- beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
7448
- endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
7660
+ if (options.omer) {
7661
+ beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
7662
+ endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
7663
+ }
7449
7664
  }
7450
- }
7451
7665
 
7452
- var prevEventsLength = evts.length;
7453
- var dow = hd.getDay();
7454
- var candlesEv = undefined;
7455
- var ev = holidaysYear.get(hd.toString()) || [];
7456
- ev.forEach(function (e) {
7457
- candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7458
- });
7666
+ var prevEventsLength = evts.length;
7667
+ var dow = hd.getDay();
7668
+ var candlesEv = undefined;
7669
+ var ev = holidaysYear.get(hd.toString()) || [];
7670
+ ev.forEach(function (e) {
7671
+ candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
7672
+ });
7459
7673
 
7460
- if (options.sedrot && dow == SAT && hyear >= 3762) {
7461
- var parsha0 = sedra.lookup(abs);
7674
+ if (options.sedrot && dow == SAT && hyear >= 3762) {
7675
+ var parsha0 = sedra.lookup(abs);
7462
7676
 
7463
- if (!parsha0.chag) {
7464
- evts.push(new ParshaEvent(hd, parsha0.parsha, il));
7677
+ if (!parsha0.chag) {
7678
+ evts.push(new ParshaEvent(hd, parsha0.parsha, il));
7679
+ }
7465
7680
  }
7466
- }
7467
-
7468
- if (options.dafyomi && hyear >= 5684) {
7469
- evts.push(new DafYomiEvent(hd));
7470
- }
7471
-
7472
- if (options.mishnaYomi && abs >= mishnaYomiStart) {
7473
- var mishnaYomi = mishnaYomiIndex.lookup(abs);
7474
- evts.push(new MishnaYomiEvent(hd, mishnaYomi));
7475
- }
7476
7681
 
7477
- if (options.omer && abs >= beginOmer && abs <= endOmer) {
7478
- var omer = abs - beginOmer + 1;
7479
- evts.push(new OmerEvent(hd, omer));
7480
- }
7682
+ if (options.dafyomi && hyear >= 5684) {
7683
+ evts.push(new DafYomiEvent(hd));
7684
+ }
7481
7685
 
7482
- var hmonth = hd.getMonth();
7686
+ if (options.mishnaYomi && abs >= mishnaYomiStart) {
7687
+ var mishnaYomi = mishnaYomiIndex.lookup(abs);
7688
+ evts.push(new MishnaYomiEvent(hd, mishnaYomi));
7689
+ }
7483
7690
 
7484
- if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7485
- var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7486
- evts.push(new MoladEvent(hd, hyear, monNext));
7487
- }
7691
+ if (options.omer && abs >= beginOmer && abs <= endOmer) {
7692
+ var omer = abs - beginOmer + 1;
7693
+ evts.push(new OmerEvent(hd, omer));
7694
+ }
7488
7695
 
7489
- if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7490
- candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
7696
+ var hmonth = hd.getMonth();
7491
7697
 
7492
- if (dow === FRI && candlesEv && sedra) {
7493
- candlesEv.memo = sedra.getString(abs);
7698
+ if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
7699
+ var monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
7700
+ evts.push(new MoladEvent(hd, hyear, monNext));
7494
7701
  }
7495
- } // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
7496
7702
 
7703
+ if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
7704
+ candlesEv = makeCandleEvent(undefined, hd, dow, location, options);
7497
7705
 
7498
- if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
7499
- candlesEv = null;
7500
- }
7706
+ if (dow === FRI && candlesEv && sedra) {
7707
+ candlesEv.memo = sedra.getString(abs);
7708
+ }
7709
+ } // suppress Havdalah when options.havdalahMins=0 or options.havdalahDeg=0
7501
7710
 
7502
- if (candlesEv) {
7503
- evts.push(candlesEv);
7504
- }
7505
7711
 
7506
- if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
7507
- var e2 = new HebrewDateEvent(hd);
7712
+ if (candlesEv instanceof HavdalahEvent && (options.havdalahMins === 0 || options.havdalahDeg === 0)) {
7713
+ candlesEv = null;
7714
+ }
7508
7715
 
7509
- if (prevEventsLength == evts.length) {
7510
- evts.push(e2);
7511
- } else {
7512
- evts.splice(prevEventsLength, 0, e2);
7716
+ if (candlesEv) {
7717
+ evts.push(candlesEv);
7513
7718
  }
7514
- }
7515
- };
7516
7719
 
7517
- for (var abs = startAbs; abs <= endAbs; abs++) {
7518
- _loop(abs);
7519
- }
7720
+ if (options.addHebrewDates || options.addHebrewDatesForEvents && prevEventsLength != evts.length) {
7721
+ var e2 = new HebrewDateEvent(hd);
7520
7722
 
7521
- return evts;
7522
- },
7723
+ if (prevEventsLength == evts.length) {
7724
+ evts.push(e2);
7725
+ } else {
7726
+ evts.splice(prevEventsLength, 0, e2);
7727
+ }
7728
+ }
7729
+ };
7523
7730
 
7524
- /**
7525
- * Calculates a birthday or anniversary (non-yahrzeit).
7526
- * `hyear` must be after original `gdate` of anniversary.
7527
- * Returns `undefined` when requested year preceeds or is same as original year.
7528
- *
7529
- * Hebcal uses the algorithm defined in "Calendrical Calculations"
7530
- * by Edward M. Reingold and Nachum Dershowitz.
7531
- *
7532
- * The birthday of someone born in Adar of an ordinary year or Adar II of
7533
- * a leap year is also always in the last month of the year, be that Adar
7534
- * or Adar II. The birthday in an ordinary year of someone born during the
7535
- * first 29 days of Adar I in a leap year is on the corresponding day of Adar;
7536
- * in a leap year, the birthday occurs in Adar I, as expected.
7537
- *
7538
- * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
7539
- * has his birthday postponed until the first of the following month in
7540
- * years where that day does not occur. [Calendrical Calculations p. 111]
7541
- * @example
7542
- * import {HebrewCalendar} from '@hebcal/core';
7543
- * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7544
- * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
7545
- * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
7546
- * @param {number} hyear Hebrew year
7547
- * @param {Date|HDate} gdate Gregorian or Hebrew date of event
7548
- * @return {HDate} anniversary occurring in `hyear`
7549
- */
7550
- getBirthdayOrAnniversary: function getBirthdayOrAnniversary(hyear, gdate) {
7551
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7552
- var origYear = orig.getFullYear();
7731
+ for (var abs = startAbs; abs <= endAbs; abs++) {
7732
+ _loop(abs);
7733
+ }
7553
7734
 
7554
- if (hyear <= origYear) {
7555
- // `Hebrew year ${hyear} occurs on or before original date in ${origYear}`
7556
- return undefined;
7735
+ return evts;
7557
7736
  }
7737
+ /**
7738
+ * Calculates a birthday or anniversary (non-yahrzeit).
7739
+ * `hyear` must be after original `gdate` of anniversary.
7740
+ * Returns `undefined` when requested year preceeds or is same as original year.
7741
+ *
7742
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
7743
+ * by Edward M. Reingold and Nachum Dershowitz.
7744
+ *
7745
+ * The birthday of someone born in Adar of an ordinary year or Adar II of
7746
+ * a leap year is also always in the last month of the year, be that Adar
7747
+ * or Adar II. The birthday in an ordinary year of someone born during the
7748
+ * first 29 days of Adar I in a leap year is on the corresponding day of Adar;
7749
+ * in a leap year, the birthday occurs in Adar I, as expected.
7750
+ *
7751
+ * Someone born on the thirtieth day of Marcheshvan, Kislev, or Adar I
7752
+ * has his birthday postponed until the first of the following month in
7753
+ * years where that day does not occur. [Calendrical Calculations p. 111]
7754
+ * @example
7755
+ * import {HebrewCalendar} from '@hebcal/core';
7756
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7757
+ * const hd = HebrewCalendar.getBirthdayOrAnniversary(5780, dt); // '1 Nisan 5780'
7758
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '3/26/2020'
7759
+ * @param {number} hyear Hebrew year
7760
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of event
7761
+ * @return {HDate} anniversary occurring in `hyear`
7762
+ */
7558
7763
 
7559
- var isOrigLeap = HDate.isLeapYear(origYear);
7560
- var month = orig.getMonth();
7561
- var day = orig.getDate();
7562
-
7563
- if (month == ADAR_I && !isOrigLeap || month == ADAR_II && isOrigLeap) {
7564
- month = HDate.monthsInYear(hyear);
7565
- } else if (month == CHESHVAN && day == 30 && !HDate.longCheshvan(hyear)) {
7566
- month = KISLEV;
7567
- day = 1;
7568
- } else if (month == KISLEV && day == 30 && HDate.shortKislev(hyear)) {
7569
- month = TEVET;
7570
- day = 1;
7571
- } else if (month == ADAR_I && day == 30 && isOrigLeap && !HDate.isLeapYear(hyear)) {
7572
- month = NISAN;
7573
- day = 1;
7764
+ }, {
7765
+ key: "getBirthdayOrAnniversary",
7766
+ value: function getBirthdayOrAnniversary(hyear, gdate) {
7767
+ return getBirthdayOrAnniversary_(hyear, gdate);
7574
7768
  }
7769
+ /**
7770
+ * Calculates yahrzeit.
7771
+ * `hyear` must be after original `gdate` of death.
7772
+ * Returns `undefined` when requested year preceeds or is same as original year.
7773
+ *
7774
+ * Hebcal uses the algorithm defined in "Calendrical Calculations"
7775
+ * by Edward M. Reingold and Nachum Dershowitz.
7776
+ *
7777
+ * The customary anniversary date of a death is more complicated and depends
7778
+ * also on the character of the year in which the first anniversary occurs.
7779
+ * There are several cases:
7780
+ *
7781
+ * * If the date of death is Marcheshvan 30, the anniversary in general depends
7782
+ * on the first anniversary; if that first anniversary was not Marcheshvan 30,
7783
+ * use the day before Kislev 1.
7784
+ * * If the date of death is Kislev 30, the anniversary in general again depends
7785
+ * on the first anniversary — if that was not Kislev 30, use the day before
7786
+ * Tevet 1.
7787
+ * * If the date of death is Adar II, the anniversary is the same day in the
7788
+ * last month of the Hebrew year (Adar or Adar II).
7789
+ * * If the date of death is Adar I 30, the anniversary in a Hebrew year that
7790
+ * is not a leap year (in which Adar only has 29 days) is the last day in
7791
+ * Shevat.
7792
+ * * In all other cases, use the normal (that is, same month number) anniversary
7793
+ * of the date of death. [Calendrical Calculations p. 113]
7794
+ * @example
7795
+ * import {HebrewCalendar} from '@hebcal/core';
7796
+ * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7797
+ * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
7798
+ * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
7799
+ * @param {number} hyear Hebrew year
7800
+ * @param {Date|HDate} gdate Gregorian or Hebrew date of death
7801
+ * @return {HDate} anniversary occurring in hyear
7802
+ */
7575
7803
 
7576
- return new HDate(day, month, hyear);
7577
- },
7578
-
7579
- /**
7580
- * Calculates yahrzeit.
7581
- * `hyear` must be after original `gdate` of death.
7582
- * Returns `undefined` when requested year preceeds or is same as original year.
7583
- *
7584
- * Hebcal uses the algorithm defined in "Calendrical Calculations"
7585
- * by Edward M. Reingold and Nachum Dershowitz.
7586
- *
7587
- * The customary anniversary date of a death is more complicated and depends
7588
- * also on the character of the year in which the first anniversary occurs.
7589
- * There are several cases:
7590
- *
7591
- * * If the date of death is Marcheshvan 30, the anniversary in general depends
7592
- * on the first anniversary; if that first anniversary was not Marcheshvan 30,
7593
- * use the day before Kislev 1.
7594
- * * If the date of death is Kislev 30, the anniversary in general again depends
7595
- * on the first anniversary — if that was not Kislev 30, use the day before
7596
- * Tevet 1.
7597
- * * If the date of death is Adar II, the anniversary is the same day in the
7598
- * last month of the Hebrew year (Adar or Adar II).
7599
- * * If the date of death is Adar I 30, the anniversary in a Hebrew year that
7600
- * is not a leap year (in which Adar only has 29 days) is the last day in
7601
- * Shevat.
7602
- * * In all other cases, use the normal (that is, same month number) anniversary
7603
- * of the date of death. [Calendrical Calculations p. 113]
7604
- * @example
7605
- * import {HebrewCalendar} from '@hebcal/core';
7606
- * const dt = new Date(2014, 2, 2); // '2014-03-02' == '30 Adar I 5774'
7607
- * const hd = HebrewCalendar.getYahrzeit(5780, dt); // '30 Sh\'vat 5780'
7608
- * console.log(hd.greg().toLocaleDateString('en-US')); // '2/25/2020'
7609
- * @param {number} hyear Hebrew year
7610
- * @param {Date|HDate} gdate Gregorian or Hebrew date of death
7611
- * @return {HDate} anniversary occurring in hyear
7612
- */
7613
- getYahrzeit: function getYahrzeit(hyear, gdate) {
7614
- var orig = HDate.isHDate(gdate) ? gdate : new HDate(gdate);
7615
- var hDeath = {
7616
- yy: orig.getFullYear(),
7617
- mm: orig.getMonth(),
7618
- dd: orig.getDate()
7619
- };
7804
+ }, {
7805
+ key: "getYahrzeit",
7806
+ value: function getYahrzeit(hyear, gdate) {
7807
+ return getYahrzeit_(hyear, gdate);
7808
+ }
7809
+ /**
7810
+ * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
7811
+ * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
7812
+ * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
7813
+ * @function
7814
+ * @param {number} year Hebrew year
7815
+ * @return {Map<string,Event[]>}
7816
+ */
7620
7817
 
7621
- if (hyear <= hDeath.yy) {
7622
- // `Hebrew year ${hyear} occurs on or before original date in ${hDeath.yy}`
7623
- return undefined;
7818
+ }, {
7819
+ key: "getHolidaysForYear",
7820
+ value: function getHolidaysForYear(year) {
7821
+ return getHolidaysForYear_(year);
7624
7822
  }
7823
+ /**
7824
+ * Returns an array of holidays for the year
7825
+ * @param {number} year Hebrew year
7826
+ * @param {boolean} il use the Israeli schedule for holidays
7827
+ * @return {Event[]}
7828
+ */
7625
7829
 
7626
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hDeath.yy + 1)) {
7627
- // If it's Heshvan 30 it depends on the first anniversary;
7628
- // if that was not Heshvan 30, use the day before Kislev 1.
7629
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, KISLEV, 1) - 1);
7630
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hDeath.yy + 1)) {
7631
- // If it's Kislev 30 it depends on the first anniversary;
7632
- // if that was not Kislev 30, use the day before Teveth 1.
7633
- hDeath = HDate.abs2hebrew(HDate.hebrew2abs(hyear, TEVET, 1) - 1);
7634
- } else if (hDeath.mm == ADAR_II) {
7635
- // If it's Adar II, use the same day in last month of year (Adar or Adar II).
7636
- hDeath.mm = HDate.monthsInYear(hyear);
7637
- } else if (hDeath.mm == ADAR_I && hDeath.dd == 30 && !HDate.isLeapYear(hyear)) {
7638
- // If it's the 30th in Adar I and year is not a leap year
7639
- // (so Adar has only 29 days), use the last day in Shevat.
7640
- hDeath.dd = 30;
7641
- hDeath.mm = SHVAT;
7642
- } // In all other cases, use the normal anniversary of the date of death.
7643
- // advance day to rosh chodesh if needed
7644
-
7645
-
7646
- if (hDeath.mm == CHESHVAN && hDeath.dd == 30 && !HDate.longCheshvan(hyear)) {
7647
- hDeath.mm = KISLEV;
7648
- hDeath.dd = 1;
7649
- } else if (hDeath.mm == KISLEV && hDeath.dd == 30 && HDate.shortKislev(hyear)) {
7650
- hDeath.mm = TEVET;
7651
- hDeath.dd = 1;
7652
- }
7653
-
7654
- return new HDate(hDeath.dd, hDeath.mm, hyear);
7655
- },
7830
+ }, {
7831
+ key: "getHolidaysForYearArray",
7832
+ value: function getHolidaysForYearArray(year, il) {
7833
+ var yearMap = getHolidaysForYear_(year);
7834
+ var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
7835
+ var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
7836
+ var events = [];
7837
+ var myFilter = il ? observedInIsrael : observedInDiaspora;
7656
7838
 
7657
- /**
7658
- * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
7659
- * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
7660
- * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
7661
- * @function
7662
- * @param {number} year Hebrew year
7663
- * @return {Map<string,Event[]>}
7664
- */
7665
- getHolidaysForYear: getHolidaysForYear,
7839
+ for (var absDt = startAbs; absDt <= endAbs; absDt++) {
7840
+ var hd = new HDate(absDt);
7841
+ var holidays = yearMap.get(hd.toString());
7666
7842
 
7667
- /**
7668
- * Returns an array of holidays for the year
7669
- * @param {number} year Hebrew year
7670
- * @param {boolean} il use the Israeli schedule for holidays
7671
- * @return {Event[]}
7672
- */
7673
- getHolidaysForYearArray: function getHolidaysForYearArray(year, il) {
7674
- var yearMap = HebrewCalendar.getHolidaysForYear(year);
7675
- var startAbs = HDate.hebrew2abs(year, TISHREI, 1);
7676
- var endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
7677
- var events = [];
7678
-
7679
- for (var absDt = startAbs; absDt <= endAbs; absDt++) {
7680
- var hd = new HDate(absDt);
7681
- var holidays = yearMap.get(hd.toString());
7682
-
7683
- if (holidays) {
7684
- var filtered = holidays.filter(function (ev) {
7685
- return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
7686
- });
7687
- filtered.forEach(function (ev) {
7688
- return events.push(ev);
7689
- });
7843
+ if (holidays) {
7844
+ var filtered = holidays.filter(myFilter);
7845
+ events = events.concat(filtered);
7846
+ }
7690
7847
  }
7848
+
7849
+ return events;
7691
7850
  }
7851
+ /**
7852
+ * Returns an array of Events on this date (or undefined if no events)
7853
+ * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
7854
+ * @param {boolean} [il] use the Israeli schedule for holidays
7855
+ * @return {Event[]}
7856
+ */
7692
7857
 
7693
- return events;
7694
- },
7858
+ }, {
7859
+ key: "getHolidaysOnDate",
7860
+ value: function getHolidaysOnDate(date, il) {
7861
+ var hd = HDate.isHDate(date) ? date : new HDate(date);
7862
+ var yearMap = getHolidaysForYear_(hd.getFullYear());
7863
+ var events = yearMap.get(hd.toString());
7695
7864
 
7696
- /**
7697
- * Returns an array of Events on this date (or undefined if no events)
7698
- * @param {HDate|Date|number} date Hebrew Date, Gregorian date, or absolute R.D. day number
7699
- * @param {boolean} [il] use the Israeli schedule for holidays
7700
- * @return {Event[]}
7701
- */
7702
- getHolidaysOnDate: function getHolidaysOnDate(date, il) {
7703
- var hd = HDate.isHDate(date) ? date : new HDate(date);
7704
- var yearMap = HebrewCalendar.getHolidaysForYear(hd.getFullYear());
7705
- var events = yearMap.get(hd.toString());
7865
+ if (typeof il === 'undefined' || typeof events === 'undefined') {
7866
+ return events;
7867
+ }
7706
7868
 
7707
- if (typeof il === 'undefined' || typeof events === 'undefined') {
7708
- return events;
7869
+ var myFilter = il ? observedInIsrael : observedInDiaspora;
7870
+ return events.filter(myFilter);
7709
7871
  }
7872
+ /**
7873
+ * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
7874
+ * keep as "20:13" for any other locale/country. Uses `CalOptions` to determine
7875
+ * locale.
7876
+ * @param {string} timeStr - original time like "20:30"
7877
+ * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
7878
+ * @param {CalOptions} options
7879
+ * @return {string}
7880
+ */
7710
7881
 
7711
- return events.filter(function (ev) {
7712
- return il && ev.observedInIsrael() || !il && ev.observedInDiaspora();
7713
- });
7714
- },
7715
- hour12cc: {
7716
- US: 1,
7717
- CA: 1,
7718
- BR: 1,
7719
- AU: 1,
7720
- NZ: 1,
7721
- DO: 1,
7722
- PR: 1,
7723
- GR: 1,
7724
- IN: 1,
7725
- KR: 1,
7726
- NP: 1,
7727
- ZA: 1
7728
- },
7882
+ }, {
7883
+ key: "reformatTimeStr",
7884
+ value: function reformatTimeStr(timeStr, suffix, options) {
7885
+ if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
7886
+ var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
7729
7887
 
7730
- /**
7731
- * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
7732
- * keep as "20:13" for any other locale/country. Uses `HebrewCalendar.Options` to determine
7733
- * locale.
7734
- * @param {string} timeStr - original time like "20:30"
7735
- * @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
7736
- * @param {HebrewCalendar.Options} options
7737
- * @return {string}
7738
- */
7739
- reformatTimeStr: function reformatTimeStr(timeStr, suffix, options) {
7740
- if (typeof timeStr !== 'string') throw new TypeError("Bad timeStr: ".concat(timeStr));
7741
- var cc = options.location && options.location.cc || (options.il ? 'IL' : 'US');
7888
+ if (typeof hour12cc[cc] === 'undefined') {
7889
+ return timeStr;
7890
+ }
7742
7891
 
7743
- if (typeof this.hour12cc[cc] === 'undefined') {
7744
- return timeStr;
7745
- }
7892
+ var hm = timeStr.split(':');
7893
+ var hour = parseInt(hm[0], 10);
7746
7894
 
7747
- var hm = timeStr.split(':');
7748
- var hour = parseInt(hm[0], 10);
7895
+ if (hour < 12 && suffix) {
7896
+ suffix = suffix.replace('p', 'a').replace('P', 'A');
7897
+ } else if (hour > 12) {
7898
+ hour = hour % 12;
7899
+ }
7749
7900
 
7750
- if (hour < 12 && suffix) {
7751
- suffix = suffix.replace('p', 'a').replace('P', 'A');
7752
- } else if (hour > 12) {
7753
- hour = hour % 12;
7901
+ return "".concat(hour, ":").concat(hm[1]).concat(suffix);
7754
7902
  }
7903
+ /** @return {string} */
7755
7904
 
7756
- return "".concat(hour, ":").concat(hm[1]).concat(suffix);
7757
- },
7905
+ }, {
7906
+ key: "version",
7907
+ value: function version$1() {
7908
+ return version;
7909
+ }
7910
+ /**
7911
+ * Convenience function to create an instance of `Sedra` or reuse a previously
7912
+ * created and cached instance.
7913
+ * @function
7914
+ * @param {number} hyear
7915
+ * @param {boolean} il
7916
+ * @return {Sedra}
7917
+ */
7758
7918
 
7759
- /** @return {string} */
7760
- version: function version$1() {
7761
- return version;
7762
- },
7919
+ }, {
7920
+ key: "getSedra",
7921
+ value: function getSedra(hyear, il) {
7922
+ return getSedra_(hyear, il);
7923
+ }
7924
+ }]);
7763
7925
 
7764
- /**
7765
- * Convenience function to create an instance of `Sedra` or reuse a previously
7766
- * created and cached instance.
7767
- * @function
7768
- * @param {number} hyear
7769
- * @param {boolean} il
7770
- * @return {Sedra}
7771
- */
7772
- getSedra: getSedra
7773
- };
7926
+ return HebrewCalendar;
7927
+ }();
7774
7928
  /**
7775
7929
  * Appends the Event `ev` to the `events` array. Also may add related
7776
7930
  * timed events like candle-lighting or fast start/end
7777
7931
  * @private
7778
7932
  * @param {Event[]} events
7779
7933
  * @param {Event} ev
7780
- * @param {HebrewCalendar.Options} options
7934
+ * @param {CalOptions} options
7781
7935
  * @param {Event} candlesEv
7782
7936
  * @param {number} dow
7783
7937
  * @return {Event}