@hebcal/core 5.0.0-rc1 → 5.0.0-rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1947,8 +1947,8 @@ https://gml.noaa.gov/grad/solcalc/calcdetails.html
1947
1947
  * [.tzeit([angle])](#Zmanim+tzeit) ⇒ <code>Date</code>
1948
1948
  * [.neitzHaChama()](#Zmanim+neitzHaChama) ⇒ <code>Date</code>
1949
1949
  * [.shkiah()](#Zmanim+shkiah) ⇒ <code>Date</code>
1950
- * [.sunriseOffset(offset, roundMinute)](#Zmanim+sunriseOffset) ⇒ <code>Date</code>
1951
- * [.sunsetOffset(offset, roundMinute)](#Zmanim+sunsetOffset) ⇒ <code>Date</code>
1950
+ * [.sunriseOffset(offset, roundMinute, seaLevel)](#Zmanim+sunriseOffset) ⇒ <code>Date</code>
1951
+ * [.sunsetOffset(offset, roundMinute, seaLevel)](#Zmanim+sunsetOffset) ⇒ <code>Date</code>
1952
1952
  * _static_
1953
1953
  * [.formatTime(dt, timeFormat)](#Zmanim.formatTime) ⇒ <code>string</code>
1954
1954
  * [.roundTime(dt)](#Zmanim.roundTime) ⇒ <code>Date</code>
@@ -2126,7 +2126,7 @@ Alias for sunset
2126
2126
  **Kind**: instance method of [<code>Zmanim</code>](#Zmanim)
2127
2127
  <a name="Zmanim+sunriseOffset"></a>
2128
2128
 
2129
- ### zmanim.sunriseOffset(offset, roundMinute) ⇒ <code>Date</code>
2129
+ ### zmanim.sunriseOffset(offset, roundMinute, seaLevel) ⇒ <code>Date</code>
2130
2130
  Returns sunrise + `offset` minutes (either positive or negative).
2131
2131
 
2132
2132
  **Kind**: instance method of [<code>Zmanim</code>](#Zmanim)
@@ -2135,10 +2135,11 @@ Returns sunrise + `offset` minutes (either positive or negative).
2135
2135
  | --- | --- | --- | --- |
2136
2136
  | offset | <code>number</code> | | minutes |
2137
2137
  | roundMinute | <code>boolean</code> | <code>true</code> | round time to nearest minute (default true) |
2138
+ | seaLevel | <code>boolean</code> | <code>false</code> | use sea-level sunrise (default false) |
2138
2139
 
2139
2140
  <a name="Zmanim+sunsetOffset"></a>
2140
2141
 
2141
- ### zmanim.sunsetOffset(offset, roundMinute) ⇒ <code>Date</code>
2142
+ ### zmanim.sunsetOffset(offset, roundMinute, seaLevel) ⇒ <code>Date</code>
2142
2143
  Returns sunset + `offset` minutes (either positive or negative).
2143
2144
 
2144
2145
  **Kind**: instance method of [<code>Zmanim</code>](#Zmanim)
@@ -2147,6 +2148,7 @@ Returns sunset + `offset` minutes (either positive or negative).
2147
2148
  | --- | --- | --- | --- |
2148
2149
  | offset | <code>number</code> | | minutes |
2149
2150
  | roundMinute | <code>boolean</code> | <code>true</code> | round time to nearest minute (default true) |
2151
+ | seaLevel | <code>boolean</code> | <code>false</code> | use sea-level sunset (default false) |
2150
2152
 
2151
2153
  <a name="Zmanim.formatTime"></a>
2152
2154
 
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.0-rc1 */
1
+ /*! @hebcal/core v5.0.0-rc3 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -371,7 +371,7 @@ const ABS_2SEP1752 = 639785;
371
371
  /**
372
372
  * Gregorian date helper functions.
373
373
  */
374
- var greg;
374
+ exports.greg = void 0;
375
375
  (function (greg) {
376
376
  /**
377
377
  * Long names of the Gregorian months (1='January', 12='December')
@@ -483,7 +483,7 @@ var greg;
483
483
  return dt;
484
484
  }
485
485
  greg.abs2greg = abs2greg;
486
- })(greg || (greg = {}));
486
+ })(exports.greg || (exports.greg = {}));
487
487
 
488
488
  /*
489
489
  * More minimal HDate
@@ -761,8 +761,8 @@ function toSimpleHebrewDate(obj) {
761
761
  return obj;
762
762
  } else if (typeof obj === 'number') {
763
763
  return abs2hebrew(obj);
764
- } else if (greg.isDate(obj)) {
765
- const abs = greg.greg2abs(obj);
764
+ } else if (exports.greg.isDate(obj)) {
765
+ const abs = exports.greg.greg2abs(obj);
766
766
  return abs2hebrew(abs);
767
767
  } else {
768
768
  throw new TypeError(`Argument not a Date: ${obj}`);
@@ -806,7 +806,7 @@ function getYahrzeit(hyear, date) {
806
806
  if (typeof hd === 'undefined') {
807
807
  return hd;
808
808
  }
809
- return greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
809
+ return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
810
810
  }
811
811
  function getYahrzeitHD(hyear, date) {
812
812
  let hDeath = toSimpleHebrewDate(date);
@@ -873,7 +873,7 @@ function getBirthdayOrAnniversary(hyear, date) {
873
873
  if (typeof hd === 'undefined') {
874
874
  return hd;
875
875
  }
876
- return greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
876
+ return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
877
877
  }
878
878
  function getBirthdayHD(hyear, date) {
879
879
  const orig = toSimpleHebrewDate(date);
@@ -1029,7 +1029,7 @@ class HDate {
1029
1029
  day = new Date();
1030
1030
  }
1031
1031
  // 1 argument
1032
- const abs0 = typeof day === 'number' && !isNaN(day) ? day : greg.isDate(day) ? greg.greg2abs(day) : HDate.isHDate(day) ? {
1032
+ const abs0 = typeof day === 'number' && !isNaN(day) ? day : exports.greg.isDate(day) ? exports.greg.greg2abs(day) : HDate.isHDate(day) ? {
1033
1033
  dd: day.day,
1034
1034
  mm: day.month,
1035
1035
  yy: day.year
@@ -1146,7 +1146,7 @@ class HDate {
1146
1146
  * @return {Date}
1147
1147
  */
1148
1148
  greg() {
1149
- return greg.abs2greg(this.abs());
1149
+ return exports.greg.abs2greg(this.abs());
1150
1150
  }
1151
1151
 
1152
1152
  /**
@@ -6672,7 +6672,7 @@ class Zmanim {
6672
6672
  * hours, minutes, seconds and milliseconds are ignored.
6673
6673
  */
6674
6674
  constructor(gloc, date) {
6675
- const dt = greg.isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError(`invalid date: ${date}`);
6675
+ const dt = exports.greg.isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError(`invalid date: ${date}`);
6676
6676
  this.date = dt;
6677
6677
  this.gloc = gloc;
6678
6678
  const plainDate = s.PlainDate.from({
@@ -6828,8 +6828,8 @@ class Zmanim {
6828
6828
  */
6829
6829
  sofZmanShmaMGA() {
6830
6830
  // Magen Avraham
6831
- const alot72 = this.sunriseOffset(-72, false);
6832
- const tzeit72 = this.sunsetOffset(72, false);
6831
+ const alot72 = this.sunriseOffset(-72, false, true);
6832
+ const tzeit72 = this.sunsetOffset(72, false, true);
6833
6833
  const temporalHour = (tzeit72 - alot72) / 12; // ms in hour
6834
6834
  return new Date(alot72.getTime() + 3 * temporalHour);
6835
6835
  }
@@ -6839,8 +6839,8 @@ class Zmanim {
6839
6839
  */
6840
6840
  sofZmanTfillaMGA() {
6841
6841
  // Magen Avraham
6842
- const alot72 = this.sunriseOffset(-72, false);
6843
- const tzeit72 = this.sunsetOffset(72, false);
6842
+ const alot72 = this.sunriseOffset(-72, false, true);
6843
+ const tzeit72 = this.sunsetOffset(72, false, true);
6844
6844
  const temporalHour = (tzeit72 - alot72) / 12; // ms in hour
6845
6845
  return new Date(alot72.getTime() + 4 * temporalHour);
6846
6846
  }
@@ -6956,11 +6956,13 @@ class Zmanim {
6956
6956
  * Returns sunrise + `offset` minutes (either positive or negative).
6957
6957
  * @param {number} offset minutes
6958
6958
  * @param {boolean} roundMinute round time to nearest minute (default true)
6959
+ * @param {boolean} seaLevel use sea-level sunrise (default false)
6959
6960
  * @return {Date}
6960
6961
  */
6961
6962
  sunriseOffset(offset) {
6962
6963
  let roundMinute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6963
- const sunrise = this.seaLevelSunrise();
6964
+ let seaLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6965
+ const sunrise = seaLevel ? this.seaLevelSunrise() : this.sunrise();
6964
6966
  if (isNaN(sunrise.getTime())) {
6965
6967
  return sunrise;
6966
6968
  }
@@ -6978,11 +6980,13 @@ class Zmanim {
6978
6980
  * Returns sunset + `offset` minutes (either positive or negative).
6979
6981
  * @param {number} offset minutes
6980
6982
  * @param {boolean} roundMinute round time to nearest minute (default true)
6983
+ * @param {boolean} seaLevel use sea-level sunset (default false)
6981
6984
  * @return {Date}
6982
6985
  */
6983
6986
  sunsetOffset(offset) {
6984
6987
  let roundMinute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6985
- const sunset = this.seaLevelSunset();
6988
+ let seaLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6989
+ const sunset = seaLevel ? this.seaLevelSunset() : this.sunset();
6986
6990
  if (isNaN(sunset.getTime())) {
6987
6991
  return sunset;
6988
6992
  }
@@ -9752,7 +9756,7 @@ class DailyLearning {
9752
9756
  }
9753
9757
  }
9754
9758
 
9755
- const version="5.0.0-rc1";
9759
+ const version="5.0.0-rc3";
9756
9760
 
9757
9761
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"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"],"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"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
9758
9762
 
@@ -10729,7 +10733,7 @@ function checkCandleOptions(options) {
10729
10733
  */
10730
10734
  function getAbs(d) {
10731
10735
  if (typeof d == 'number') return d;
10732
- if (greg.isDate(d)) return greg.greg2abs(d);
10736
+ if (exports.greg.isDate(d)) return exports.greg.greg2abs(d);
10733
10737
  if (HDate.isHDate(d)) return d.abs();
10734
10738
  throw new TypeError(`Invalid date type: ${d}`);
10735
10739
  }
@@ -10779,17 +10783,17 @@ function getStartAndEnd(options) {
10779
10783
  if (theYear < 100) {
10780
10784
  startGreg.setFullYear(theYear);
10781
10785
  }
10782
- const startAbs = greg.greg2abs(startGreg);
10786
+ const startAbs = exports.greg.greg2abs(startGreg);
10783
10787
  let endAbs;
10784
10788
  if (options.month) {
10785
- endAbs = startAbs + greg.daysInMonth(theMonth, theYear) - 1;
10789
+ endAbs = startAbs + exports.greg.daysInMonth(theMonth, theYear) - 1;
10786
10790
  } else {
10787
10791
  const endYear = theYear + numYears;
10788
10792
  const endGreg = new Date(endYear, 0, 1);
10789
10793
  if (endYear < 100) {
10790
10794
  endGreg.setFullYear(endYear);
10791
10795
  }
10792
- endAbs = greg.greg2abs(endGreg) - 1;
10796
+ endAbs = exports.greg.greg2abs(endGreg) - 1;
10793
10797
  }
10794
10798
  return [startAbs, endAbs];
10795
10799
  }
@@ -11079,7 +11083,7 @@ class HebrewCalendar {
11079
11083
  warnUnrecognizedOptions(options);
11080
11084
  const startAbs = startAndEnd[0];
11081
11085
  const endAbs = startAndEnd[1];
11082
- const startGreg = greg.abs2greg(startAbs);
11086
+ const startGreg = exports.greg.abs2greg(startAbs);
11083
11087
  if (startGreg.getFullYear() < 100) {
11084
11088
  options.candlelighting = false;
11085
11089
  }