@hebcal/core 5.0.0-rc1 → 5.0.0-rc2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.0-rc1 */
1
+ /*! @hebcal/core v5.0.0-rc2 */
2
2
  'use strict';
3
3
 
4
4
  const GERESH = '׳';
@@ -373,7 +373,7 @@ const ABS_2SEP1752 = 639785;
373
373
  /**
374
374
  * Gregorian date helper functions.
375
375
  */
376
- var greg;
376
+ exports.greg = void 0;
377
377
  (function (greg) {
378
378
  /**
379
379
  * Long names of the Gregorian months (1='January', 12='December')
@@ -505,7 +505,7 @@ var greg;
505
505
  return dt;
506
506
  }
507
507
  greg.abs2greg = abs2greg;
508
- })(greg || (greg = {}));
508
+ })(exports.greg || (exports.greg = {}));
509
509
 
510
510
  /*
511
511
  * More minimal HDate
@@ -815,8 +815,8 @@ function toSimpleHebrewDate(obj) {
815
815
  else if (typeof obj === 'number') {
816
816
  return abs2hebrew(obj);
817
817
  }
818
- else if (greg.isDate(obj)) {
819
- const abs = greg.greg2abs(obj);
818
+ else if (exports.greg.isDate(obj)) {
819
+ const abs = exports.greg.greg2abs(obj);
820
820
  return abs2hebrew(abs);
821
821
  }
822
822
  else {
@@ -861,7 +861,7 @@ function getYahrzeit(hyear, date) {
861
861
  if (typeof hd === 'undefined') {
862
862
  return hd;
863
863
  }
864
- return greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
864
+ return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
865
865
  }
866
866
  function getYahrzeitHD(hyear, date) {
867
867
  let hDeath = toSimpleHebrewDate(date);
@@ -932,7 +932,7 @@ function getBirthdayOrAnniversary(hyear, date) {
932
932
  if (typeof hd === 'undefined') {
933
933
  return hd;
934
934
  }
935
- return greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
935
+ return exports.greg.abs2greg(hebrew2abs(hd.yy, hd.mm, hd.dd));
936
936
  }
937
937
  function getBirthdayHD(hyear, date) {
938
938
  const orig = toSimpleHebrewDate(date);
@@ -1088,7 +1088,7 @@ class HDate {
1088
1088
  day = new Date();
1089
1089
  }
1090
1090
  // 1 argument
1091
- const abs0 = typeof day === 'number' && !isNaN(day) ? day : greg.isDate(day) ? greg.greg2abs(day) : HDate.isHDate(day) ? {
1091
+ const abs0 = typeof day === 'number' && !isNaN(day) ? day : exports.greg.isDate(day) ? exports.greg.greg2abs(day) : HDate.isHDate(day) ? {
1092
1092
  dd: day.day,
1093
1093
  mm: day.month,
1094
1094
  yy: day.year
@@ -1205,7 +1205,7 @@ class HDate {
1205
1205
  * @return {Date}
1206
1206
  */
1207
1207
  greg() {
1208
- return greg.abs2greg(this.abs());
1208
+ return exports.greg.abs2greg(this.abs());
1209
1209
  }
1210
1210
 
1211
1211
  /**
@@ -3600,7 +3600,7 @@ class Zmanim {
3600
3600
  * hours, minutes, seconds and milliseconds are ignored.
3601
3601
  */
3602
3602
  constructor(gloc, date) {
3603
- const dt = greg.isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError(`invalid date: ${date}`);
3603
+ const dt = exports.greg.isDate(date) ? date : HDate.isHDate(date) ? date.greg() : throwTypeError(`invalid date: ${date}`);
3604
3604
  this.date = dt;
3605
3605
  this.gloc = gloc;
3606
3606
  const plainDate = s.PlainDate.from({
@@ -5947,7 +5947,7 @@ class DailyLearning {
5947
5947
  }
5948
5948
  }
5949
5949
 
5950
- const version="5.0.0-rc1";
5950
+ const version="5.0.0-rc2";
5951
5951
 
5952
5952
  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};
5953
5953
 
@@ -6412,7 +6412,7 @@ function checkCandleOptions(options) {
6412
6412
  */
6413
6413
  function getAbs(d) {
6414
6414
  if (typeof d == 'number') return d;
6415
- if (greg.isDate(d)) return greg.greg2abs(d);
6415
+ if (exports.greg.isDate(d)) return exports.greg.greg2abs(d);
6416
6416
  if (HDate.isHDate(d)) return d.abs();
6417
6417
  throw new TypeError(`Invalid date type: ${d}`);
6418
6418
  }
@@ -6462,17 +6462,17 @@ function getStartAndEnd(options) {
6462
6462
  if (theYear < 100) {
6463
6463
  startGreg.setFullYear(theYear);
6464
6464
  }
6465
- const startAbs = greg.greg2abs(startGreg);
6465
+ const startAbs = exports.greg.greg2abs(startGreg);
6466
6466
  let endAbs;
6467
6467
  if (options.month) {
6468
- endAbs = startAbs + greg.daysInMonth(theMonth, theYear) - 1;
6468
+ endAbs = startAbs + exports.greg.daysInMonth(theMonth, theYear) - 1;
6469
6469
  } else {
6470
6470
  const endYear = theYear + numYears;
6471
6471
  const endGreg = new Date(endYear, 0, 1);
6472
6472
  if (endYear < 100) {
6473
6473
  endGreg.setFullYear(endYear);
6474
6474
  }
6475
- endAbs = greg.greg2abs(endGreg) - 1;
6475
+ endAbs = exports.greg.greg2abs(endGreg) - 1;
6476
6476
  }
6477
6477
  return [startAbs, endAbs];
6478
6478
  }
@@ -6761,7 +6761,7 @@ class HebrewCalendar {
6761
6761
  warnUnrecognizedOptions(options);
6762
6762
  const startAbs = startAndEnd[0];
6763
6763
  const endAbs = startAndEnd[1];
6764
- const startGreg = greg.abs2greg(startAbs);
6764
+ const startGreg = exports.greg.abs2greg(startAbs);
6765
6765
  if (startGreg.getFullYear() < 100) {
6766
6766
  options.candlelighting = false;
6767
6767
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.0-rc1 */
1
+ /*! @hebcal/core v5.0.0-rc2 */
2
2
  const GERESH = '׳';
3
3
  const GERSHAYIM = '״';
4
4
  const heb2num = {
@@ -5945,7 +5945,7 @@ class DailyLearning {
5945
5945
  }
5946
5946
  }
5947
5947
 
5948
- const version="5.0.0-rc1";
5948
+ const version="5.0.0-rc2";
5949
5949
 
5950
5950
  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};
5951
5951
 
@@ -7134,4 +7134,4 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7134
7134
  return candlesEv;
7135
7135
  }
7136
7136
 
7137
- export { AsaraBTevetEvent, CandleLightingEvent, DailyLearning, Event, GeoLocation, HDate, HavdalahEvent, HebrewCalendar, HebrewDateEvent, HolidayEvent, Locale, Location, MevarchimChodeshEvent, Molad, MoladEvent, NOAACalculator, OmerEvent, ParshaEvent, RoshChodeshEvent, RoshHashanaEvent, Sedra, TimedEvent, Zmanim, flags, gematriya, gematriyaStrToNum, months, parshiot, version };
7137
+ export { AsaraBTevetEvent, CandleLightingEvent, DailyLearning, Event, GeoLocation, HDate, HavdalahEvent, HebrewCalendar, HebrewDateEvent, HolidayEvent, Locale, Location, MevarchimChodeshEvent, Molad, MoladEvent, NOAACalculator, OmerEvent, ParshaEvent, RoshChodeshEvent, RoshHashanaEvent, Sedra, TimedEvent, Zmanim, flags, gematriya, gematriyaStrToNum, greg, months, parshiot, version };
package/hebcal.d.ts CHANGED
@@ -806,6 +806,53 @@ declare module '@hebcal/core' {
806
806
  getChalakim(): number;
807
807
  }
808
808
 
809
+ /**
810
+ * Gregorian date helper functions.
811
+ */
812
+ export declare namespace greg {
813
+ /**
814
+ * Long names of the Gregorian months (1='January', 12='December')
815
+ * @readonly
816
+ * @type {string[]}
817
+ */
818
+ const monthNames: string[];
819
+ /**
820
+ * Returns true if the Gregorian year is a leap year
821
+ * @param {number} year Gregorian year
822
+ * @return {boolean}
823
+ */
824
+ function isLeapYear(year: number): boolean;
825
+ /**
826
+ * Number of days in the Gregorian month for given year
827
+ * @param {number} month Gregorian month (1=January, 12=December)
828
+ * @param {number} year Gregorian year
829
+ * @return {number}
830
+ */
831
+ function daysInMonth(month: number, year: number): number;
832
+ /**
833
+ * Returns true if the object is a Javascript Date
834
+ * @param {Object} obj
835
+ * @return {boolean}
836
+ */
837
+ function isDate(obj: any): boolean;
838
+ /**
839
+ * Converts Gregorian date to absolute R.D. (Rata Die) days
840
+ * @param {Date} date Gregorian date
841
+ * @return {number}
842
+ */
843
+ function greg2abs(date: Date): number;
844
+ /**
845
+ * Converts from Rata Die (R.D. number) to Gregorian date.
846
+ * See the footnote on page 384 of ``Calendrical Calculations, Part II:
847
+ * Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
848
+ * Clamen, Software--Practice and Experience, Volume 23, Number 4
849
+ * (April, 1993), pages 383-404 for an explanation.
850
+ * @param {number} abs - R.D. number of days
851
+ * @return {Date}
852
+ */
853
+ function abs2greg(abs: number): Date;
854
+ }
855
+
809
856
  /**
810
857
  * Hebrew months of the year (NISAN=1, TISHREI=7)
811
858
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.0.0-rc1",
3
+ "version": "5.0.0-rc2",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",