@hebcal/core 6.14.0 → 6.14.2

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.
Files changed (48) hide show
  1. package/dist/bundle.js +81 -17
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +15 -15
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/DailyLearning.js +1 -1
  6. package/dist/esm/HebrewDateEvent.js +1 -1
  7. package/dist/esm/HolidayEvent.js +1 -1
  8. package/dist/esm/KiddushLevanaEvent.js +1 -1
  9. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  10. package/dist/esm/ParshaEvent.js +1 -1
  11. package/dist/esm/TimedEvent.js +1 -1
  12. package/dist/esm/YomKippurKatanEvent.js +1 -1
  13. package/dist/esm/ashkenazi.po.js +1 -1
  14. package/dist/esm/calendar.js +1 -1
  15. package/dist/esm/candles.js +1 -1
  16. package/dist/esm/cities.json.js +1 -1
  17. package/dist/esm/event.js +1 -1
  18. package/dist/esm/getStartAndEnd.js +1 -1
  19. package/dist/esm/hallel.js +1 -1
  20. package/dist/esm/he-x-NoNikud.po.js +1 -1
  21. package/dist/esm/he.po.js +1 -1
  22. package/dist/esm/hebcal.js +1 -1
  23. package/dist/esm/holidays.js +1 -1
  24. package/dist/esm/index.js +1 -1
  25. package/dist/esm/isAssurBemlacha.js +1 -1
  26. package/dist/esm/isAveilut.js +1 -1
  27. package/dist/esm/isFastDay.js +1 -1
  28. package/dist/esm/locale.js +1 -1
  29. package/dist/esm/location.js +1 -1
  30. package/dist/esm/modern.js +1 -1
  31. package/dist/esm/molad.js +1 -1
  32. package/dist/esm/moladBase.js +1 -1
  33. package/dist/esm/moladDate.js +1 -1
  34. package/dist/esm/omer.js +1 -1
  35. package/dist/esm/parshaName.js +1 -1
  36. package/dist/esm/parshaYear.js +1 -1
  37. package/dist/esm/pkgVersion.d.ts +1 -1
  38. package/dist/esm/pkgVersion.js +2 -2
  39. package/dist/esm/pkgVersion.js.map +1 -1
  40. package/dist/esm/reformatTimeStr.js +1 -1
  41. package/dist/esm/sedra.js +1 -1
  42. package/dist/esm/sefira.json.js +1 -1
  43. package/dist/esm/staticHolidays.js +1 -1
  44. package/dist/esm/string.js +1 -1
  45. package/dist/esm/tachanun.js +1 -1
  46. package/dist/esm/zenith.js +1 -1
  47. package/dist/esm/zmanim.js +1 -1
  48. package/package.json +7 -7
package/dist/bundle.js CHANGED
@@ -1,11 +1,11 @@
1
- /*! @hebcal/core v6.14.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.14.2, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
5
5
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
6
- const version = '6.14.0';
6
+ const version = '6.14.2';
7
7
 
8
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
8
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
9
9
  /**
10
10
  * Days per Gregorian month (1-based), indexed first by `+isGregLeapYear()`.
11
11
  * @private
@@ -191,7 +191,7 @@ function abs2greg(abs) {
191
191
  return dt;
192
192
  }
193
193
 
194
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
194
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
195
195
  /**
196
196
  * Gregorian date helper functions.
197
197
  *
@@ -219,7 +219,7 @@ const greg = {
219
219
  isLeapYear: isGregLeapYear,
220
220
  };
221
221
 
222
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
222
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
223
223
  /**
224
224
  * Removes niqqud from Hebrew string
225
225
  * @example
@@ -235,7 +235,7 @@ function hebrewStripNikkud(str) {
235
235
  return a.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
236
236
  }
237
237
 
238
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
238
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
239
239
  /*
240
240
  * More minimal HDate
241
241
  */
@@ -805,7 +805,7 @@ function monthFromName(monthName) {
805
805
  throw new RangeError(`bad monthName: ${monthName}`);
806
806
  }
807
807
 
808
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
808
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
809
809
  const NISAN$5 = months.NISAN;
810
810
  const CHESHVAN$2 = months.CHESHVAN;
811
811
  const KISLEV$1 = months.KISLEV;
@@ -1024,7 +1024,7 @@ function getBirthdayHD(hyear, date) {
1024
1024
  return { yy: hyear, mm: month, dd: day };
1025
1025
  }
1026
1026
 
1027
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1027
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1028
1028
  const GERESH = '׳';
1029
1029
  const GERSHAYIM = '״';
1030
1030
  const heb2num = {
@@ -1159,7 +1159,7 @@ function gematriyaStrToNum(str) {
1159
1159
  return num;
1160
1160
  }
1161
1161
 
1162
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1162
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1163
1163
  /**
1164
1164
  * Formats a number with leading zeros so the resulting string is 4 digits long.
1165
1165
  * Similar to `string.padStart(4, '0')` but will also format
@@ -1199,7 +1199,7 @@ function pad2(num) {
1199
1199
  return String(num);
1200
1200
  }
1201
1201
 
1202
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1202
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1203
1203
  const _formatters = new Map();
1204
1204
  /**
1205
1205
  * @private
@@ -1280,13 +1280,13 @@ function isoDateString(dt) {
1280
1280
  pad2(dt.getDate()));
1281
1281
  }
1282
1282
 
1283
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1283
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1284
1284
  var poAshkenazi$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "und-x-ashkenaz" }, "contexts": { "": { "Tevet": ["Teves"] } } };
1285
1285
 
1286
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1286
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1287
1287
  var poHe$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he" }, "contexts": { "": { "Adar": ["אֲדָר"], "Adar I": ["אֲדָר א׳"], "Adar II": ["אֲדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָּיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tammuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
1288
1288
 
1289
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1289
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1290
1290
  const noopLocale = {
1291
1291
  headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
1292
1292
  contexts: { '': {} },
@@ -1570,7 +1570,7 @@ Locale.addLocale('he', poHe$1);
1570
1570
  const poHeNoNikud$1 = Locale.copyLocaleNoNikud(poHe$1);
1571
1571
  Locale.addLocale('he-x-NoNikud', poHeNoNikud$1);
1572
1572
 
1573
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1573
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1574
1574
  /*
1575
1575
  Hebcal - A Jewish Calendar Generator
1576
1576
  Copyright (c) 1994-2020 Danny Sadinoff
@@ -2406,7 +2406,7 @@ function onOrBefore(day, t, offset) {
2406
2406
  return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
2407
2407
  }
2408
2408
 
2409
- /*! @hebcal/hdate v0.23.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2409
+ /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2410
2410
  /**
2411
2411
  * Calculates yahrzeit, the anniversary of a death, and returns it as an
2412
2412
  * {@link HDate}.
@@ -7704,6 +7704,60 @@ class GeoLocation {
7704
7704
  }
7705
7705
  this.timeZoneId = timeZoneId;
7706
7706
  }
7707
+ /**
7708
+ * A method that will return the location's local mean time offset in milliseconds from local
7709
+ * [standard time](https://en.wikipedia.org/wiki/Standard_time). The globe is split into 360°, with
7710
+ * 15° per hour of the day. For a local that is at a longitude that is evenly divisible by 15
7711
+ * (longitude % 15 == 0), at solar noon (with adjustment for the
7712
+ * [equation of time](https://en.wikipedia.org/wiki/Equation_of_time)) the sun should be directly overhead,
7713
+ * so a user who is 1° west of this will have noon at 4 minutes after standard time noon, and conversely,
7714
+ * a user who is 1° east of the 15° longitude will have noon at 11:56 AM.
7715
+ * @param instant the instant at which to read the time zone offset (DST is taken into account)
7716
+ * @return the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned
7717
+ * East of the 15° timezone line, and a negative value West of it.
7718
+ */
7719
+ getLocalMeanTimeOffset(instant) {
7720
+ const timezoneOffsetMillis = instant.toZonedDateTimeISO(this.timeZoneId).offsetNanoseconds / 1e6;
7721
+ return this.longitude * 4 * 60 * 1000 - timezoneOffsetMillis;
7722
+ }
7723
+ /**
7724
+ * Adjust the date for [antimeridian](https://en.wikipedia.org/wiki/180th_meridian) crossover. This is
7725
+ * needed to deal with edge cases such as Samoa that use a different calendar date than expected based on their
7726
+ * geographic location.
7727
+ *
7728
+ * The actual Time Zone offset may deviate from the expected offset based on the longitude. Since the 'absolute time'
7729
+ * calculations are always based on longitudinal offset from UTC for a given date, the date is presumed to only
7730
+ * increase East of the Prime Meridian, and to only decrease West of it. For Time Zones that cross the antimeridian,
7731
+ * the date will be artificially adjusted before calculation to conform with this presumption.
7732
+ *
7733
+ * For example, Apia, Samoa with a longitude of -171.75 uses a local offset of +14:00. When calculating sunrise for
7734
+ * 2018-02-03, the calculator should operate using 2018-02-02 since the expected zone is -11. After determining the
7735
+ * UTC time, the local DST offset of [UTC+14:00](https://en.wikipedia.org/wiki/UTC%2B14:00) should be applied
7736
+ * to bring the date back to 2018-02-03.
7737
+ * @param date the date, at the start of which (in this location's time zone) the offset is read
7738
+ * @return the number of days to adjust the date This will typically be 0 unless the date crosses the antimeridian
7739
+ */
7740
+ getAntimeridianAdjustment(date) {
7741
+ // Time zone offsets range from -12:00 to +14:00, so an offset of 20 hours
7742
+ // or more needs a longitude of at least 120 degrees east or 90 degrees
7743
+ // west. Skip resolving the time zone for the rest of the world.
7744
+ if (this.longitude > -90 && this.longitude < 120) {
7745
+ return 0;
7746
+ }
7747
+ const midnight = date.toZonedDateTime(this.timeZoneId).toInstant();
7748
+ const localHoursOffset = this.getLocalMeanTimeOffset(midnight) / 3600000;
7749
+ if (localHoursOffset >= 20) {
7750
+ // a location far east using a time zone from across the antimeridian to
7751
+ // the west (none are known today, but better safe than sorry)
7752
+ return 1; // roll the date forward a day
7753
+ }
7754
+ else if (localHoursOffset <= -20) {
7755
+ // a location far west using a time zone from across the antimeridian to
7756
+ // the east, such as Samoa or Kiritimati
7757
+ return -1; // roll the date back a day
7758
+ }
7759
+ return 0; // 99.999% of the world will have no adjustment
7760
+ }
7707
7761
  }
7708
7762
  /**
7709
7763
  * The commonly used average solar refraction. Calendrical Calculations lists a more accurate global average of
@@ -8056,8 +8110,15 @@ class NOAACalculator {
8056
8110
  * @return the adjusted Calendar
8057
8111
  */
8058
8112
  getAdjustedDate() {
8059
- return this.date;
8113
+ if (this.adjustedDate === undefined) {
8114
+ const offset = this.geoLocation.getAntimeridianAdjustment(this.date);
8115
+ this.adjustedDate =
8116
+ offset === 0 ? this.date : this.date.add({ days: offset });
8117
+ }
8118
+ return this.adjustedDate;
8060
8119
  }
8120
+ /** Memoized result of {@link getAdjustedDate} */
8121
+ adjustedDate;
8061
8122
  /**
8062
8123
  * Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher
8063
8124
  * elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon
@@ -8337,8 +8398,11 @@ class NOAACalculator {
8337
8398
  year -= 1;
8338
8399
  month += 12;
8339
8400
  }
8401
+ // Integer division, as in the Java original: truncating `2 - a + a / 4`
8402
+ // as a whole is off by one day whenever `a` is not a multiple of 4
8403
+ // (e.g. every year from 1900 through 1999).
8340
8404
  const a = Math.trunc(year / 100);
8341
- const b = Math.trunc(2 - a + a / 4);
8405
+ const b = 2 - a + Math.trunc(a / 4);
8342
8406
  return (Math.floor(365.25 * (year + 4716)) +
8343
8407
  Math.floor(30.6001 * (month + 1)) +
8344
8408
  day +