@hebcal/core 6.14.1 → 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 +68 -4
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +3 -3
  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 +5 -5
package/dist/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
- /*! @hebcal/core v6.14.1, distributed under GPLv2 or later 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.1';
6
+ const version = '6.14.2';
7
7
 
8
8
  /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
9
9
  /**
@@ -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 +