@hebcal/core 6.8.2 → 6.9.1

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 (109) hide show
  1. package/README.md +262 -4
  2. package/dist/bundle.js +1530 -944
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +18 -17
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/CalOptions.d.ts +12 -2
  7. package/dist/esm/DailyLearning.d.ts +5 -5
  8. package/dist/esm/DailyLearning.js +5 -5
  9. package/dist/esm/DailyLearning.js.map +1 -1
  10. package/dist/esm/HebrewDateEvent.d.ts +2 -2
  11. package/dist/esm/HebrewDateEvent.js +1 -1
  12. package/dist/esm/HebrewDateEvent.js.map +1 -1
  13. package/dist/esm/HolidayEvent.d.ts +9 -4
  14. package/dist/esm/HolidayEvent.js +8 -3
  15. package/dist/esm/HolidayEvent.js.map +1 -1
  16. package/dist/esm/MevarchimChodeshEvent.d.ts +4 -3
  17. package/dist/esm/MevarchimChodeshEvent.js +3 -2
  18. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  19. package/dist/esm/ParshaEvent.d.ts +16 -3
  20. package/dist/esm/ParshaEvent.js +14 -1
  21. package/dist/esm/ParshaEvent.js.map +1 -1
  22. package/dist/esm/TimedEvent.d.ts +16 -8
  23. package/dist/esm/TimedEvent.js +13 -5
  24. package/dist/esm/TimedEvent.js.map +1 -1
  25. package/dist/esm/YomKippurKatanEvent.d.ts +4 -3
  26. package/dist/esm/YomKippurKatanEvent.js +3 -2
  27. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  28. package/dist/esm/ashkenazi.po.js +1 -1
  29. package/dist/esm/calendar.d.ts +19 -9
  30. package/dist/esm/calendar.js +23 -10
  31. package/dist/esm/calendar.js.map +1 -1
  32. package/dist/esm/candles.d.ts +24 -6
  33. package/dist/esm/candles.js +20 -2
  34. package/dist/esm/candles.js.map +1 -1
  35. package/dist/esm/cities.json.d.ts +2 -0
  36. package/dist/esm/cities.json.js +68 -2
  37. package/dist/esm/cities.json.js.map +1 -1
  38. package/dist/esm/event.d.ts +3 -5
  39. package/dist/esm/event.js +3 -5
  40. package/dist/esm/event.js.map +1 -1
  41. package/dist/esm/getStartAndEnd.d.ts +1 -1
  42. package/dist/esm/getStartAndEnd.js +1 -1
  43. package/dist/esm/getStartAndEnd.js.map +1 -1
  44. package/dist/esm/hallel.d.ts +1 -1
  45. package/dist/esm/hallel.js +1 -1
  46. package/dist/esm/hallel.js.map +1 -1
  47. package/dist/esm/he-x-NoNikud.po.js +1 -1
  48. package/dist/esm/he.po.js +1 -1
  49. package/dist/esm/hebcal.d.ts +38 -103
  50. package/dist/esm/hebcal.js +34 -107
  51. package/dist/esm/hebcal.js.map +1 -1
  52. package/dist/esm/holidays.d.ts +9 -2
  53. package/dist/esm/holidays.js +2 -2
  54. package/dist/esm/holidays.js.map +1 -1
  55. package/dist/esm/index.d.ts +29 -27
  56. package/dist/esm/index.js +3 -1
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/isAssurBemlacha.d.ts +1 -1
  59. package/dist/esm/isAssurBemlacha.js +6 -3
  60. package/dist/esm/isAssurBemlacha.js.map +1 -1
  61. package/dist/esm/isAveilut.js +1 -1
  62. package/dist/esm/isFastDay.d.ts +1 -1
  63. package/dist/esm/isFastDay.js +2 -2
  64. package/dist/esm/isFastDay.js.map +1 -1
  65. package/dist/esm/locale.js +1 -1
  66. package/dist/esm/locale.js.map +1 -1
  67. package/dist/esm/location.d.ts +37 -9
  68. package/dist/esm/location.js +38 -10
  69. package/dist/esm/location.js.map +1 -1
  70. package/dist/esm/modern.js +1 -1
  71. package/dist/esm/molad.d.ts +29 -23
  72. package/dist/esm/molad.js +27 -21
  73. package/dist/esm/molad.js.map +1 -1
  74. package/dist/esm/moladBase.d.ts +11 -0
  75. package/dist/esm/moladBase.js +12 -1
  76. package/dist/esm/moladBase.js.map +1 -1
  77. package/dist/esm/moladDate.d.ts +11 -7
  78. package/dist/esm/moladDate.js +25 -18
  79. package/dist/esm/moladDate.js.map +1 -1
  80. package/dist/esm/omer.d.ts +21 -5
  81. package/dist/esm/omer.js +20 -4
  82. package/dist/esm/omer.js.map +1 -1
  83. package/dist/esm/parshaName.js +1 -1
  84. package/dist/esm/parshaName.js.map +1 -1
  85. package/dist/esm/parshaYear.d.ts +3 -3
  86. package/dist/esm/parshaYear.js +3 -3
  87. package/dist/esm/parshaYear.js.map +1 -1
  88. package/dist/esm/pkgVersion.d.ts +1 -1
  89. package/dist/esm/pkgVersion.js +2 -2
  90. package/dist/esm/pkgVersion.js.map +1 -1
  91. package/dist/esm/reformatTimeStr.d.ts +15 -3
  92. package/dist/esm/reformatTimeStr.js +15 -3
  93. package/dist/esm/reformatTimeStr.js.map +1 -1
  94. package/dist/esm/sedra.d.ts +45 -19
  95. package/dist/esm/sedra.js +39 -17
  96. package/dist/esm/sedra.js.map +1 -1
  97. package/dist/esm/sefira.json.d.ts +6 -0
  98. package/dist/esm/sefira.json.js +65 -3
  99. package/dist/esm/sefira.json.js.map +1 -1
  100. package/dist/esm/staticHolidays.d.ts +0 -2
  101. package/dist/esm/staticHolidays.js +1 -3
  102. package/dist/esm/staticHolidays.js.map +1 -1
  103. package/dist/esm/string.js +1 -1
  104. package/dist/esm/tachanun.js +1 -1
  105. package/dist/esm/tachanun.js.map +1 -1
  106. package/dist/esm/zmanim.d.ts +177 -142
  107. package/dist/esm/zmanim.js +183 -148
  108. package/dist/esm/zmanim.js.map +1 -1
  109. package/package.json +18 -15
@@ -1 +1 @@
1
- {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim';\nimport {Location} from './location';\nimport {getHolidaysOnDate} from './holidays';\nimport {Event, flags} from './event';\n\nconst LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n if (dow === 5) {\n return true;\n }\n const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);\n if (erev) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if it is <em>Shabbos</em> or if it is a <em>Yom Tov</em> day that has a <em>melacha</em> (work) prohibition.\n *\n * @return if the day is a <em>Yom Tov</em> that is <em>assur bemlacha</em> or <em>Shabbos</em>\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n if (dow === 6) {\n return true;\n }\n const chag = events.find(ev => ev.getFlags() & flags.CHAG);\n if (chag) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) || [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,mBAAmB;AAErE,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;AAC7D,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,aAAa,CAAC;IAC7D,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;AAIG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE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AG,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE;IAC9C,IAAI,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,aAAa,IAAI,YAAY,EAAE;AAC3E,QAAA,OAAO,IAAI;IACb;;AAEA,IAAA,IAAI,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;AACtC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE;AAC5B,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE;QACnC,OAAO,aAAa,IAAI,WAAW;IACrC;AACA,IAAA,OAAO,KAAK;AACd;;;;"}
1
+ {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event, flags} from './event.js';\n\nconst LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n if (dow === 5) {\n return true;\n }\n const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);\n if (erev) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a\n * _melacha_ (work) prohibition.\n *\n * @param dow day of week, where `6` is Shabbos\n * @param events events occurring on the day\n * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n if (dow === 6) {\n return true;\n }\n const chag = events.find(ev => ev.getFlags() & flags.CHAG);\n if (chag) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) || [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,mBAAmB;AAErE,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;AAC7D,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,aAAa,CAAC;IAC7D,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;AAOG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAC1D,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,eAAe,CAC7B,WAAiB,EACjB,QAAkB,EAClB,YAAqB,EAAA;;;;;IAMrB,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC;AAC7D,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;AAClD,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAA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.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const NISAN = months.NISAN;
@@ -15,7 +15,7 @@ import { HDate } from '@hebcal/hdate';
15
15
  * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)
16
16
  * isFastDay(new HDate(11, months.TISHREI, 5784)); // false
17
17
  * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
18
- * @param il use the Israeli schedule for holidays
18
+ * @param il optional; use the Israeli schedule for holidays (default Diaspora)
19
19
  * @return `true` if the date is a major or minor fast day
20
20
  */
21
21
  export declare function isFastDay(date: HDate | Date | number, il?: boolean): boolean;
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { flags } from './event.js';
3
3
  import { getHolidaysOnDate } from './holidays.js';
4
4
 
@@ -20,7 +20,7 @@ const EREV = flags.EREV;
20
20
  * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)
21
21
  * isFastDay(new HDate(11, months.TISHREI, 5784)); // false
22
22
  * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
23
- * @param il use the Israeli schedule for holidays
23
+ * @param il optional; use the Israeli schedule for holidays (default Diaspora)
24
24
  * @return `true` if the date is a major or minor fast day
25
25
  */
26
26
  function isFastDay(date, il) {
@@ -1 +1 @@
1
- {"version":3,"file":"isFastDay.js","sources":["../../../src/isFastDay.ts"],"sourcesContent":["import {HDate} from '@hebcal/hdate';\nimport {flags} from './event';\nimport {getHolidaysOnDate} from './holidays';\n\nconst FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;\nconst EREV = flags.EREV;\n\n/**\n * Returns `true` if the given date is observed as a major or minor fast day.\n *\n * Major fasts: Yom Kippur, Tish'a B'Av.\n * Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit\n * Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).\n *\n * Erev Tish'a B'Av — even though the fast begins at sunset — is *not*\n * counted here: only the actual fast day itself returns `true`.\n * Postponed fasts return `true` on the actual observed date (e.g. when\n * 17 Tammuz falls on Shabbat and is observed on the 18th).\n * @example\n * import {isFastDay, HDate, months} from '@hebcal/core';\n * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)\n * isFastDay(new HDate(11, months.TISHREI, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param il use the Israeli schedule for holidays\n * @return `true` if the date is a major or minor fast day\n */\nexport function isFastDay(date: HDate | Date | number, il?: boolean): boolean {\n const events = getHolidaysOnDate(date, il) || [];\n const fastDay = events.find(ev => {\n const mask = ev.getFlags();\n return mask & FAST_DAY && !(mask & EREV);\n });\n return Boolean(fastDay);\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU;AACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;AAEvB;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,SAAS,CAAC,IAA2B,EAAE,EAAY,EAAA;IACjE,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAG;AAC/B,QAAA,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,IAAI,GAAG,QAAQ,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;AAC1C,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB;;;;"}
1
+ {"version":3,"file":"isFastDay.js","sources":["../../../src/isFastDay.ts"],"sourcesContent":["import {HDate} from '@hebcal/hdate';\nimport {flags} from './event.js';\nimport {getHolidaysOnDate} from './holidays.js';\n\nconst FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;\nconst EREV = flags.EREV;\n\n/**\n * Returns `true` if the given date is observed as a major or minor fast day.\n *\n * Major fasts: Yom Kippur, Tish'a B'Av.\n * Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit\n * Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).\n *\n * Erev Tish'a B'Av — even though the fast begins at sunset — is *not*\n * counted here: only the actual fast day itself returns `true`.\n * Postponed fasts return `true` on the actual observed date (e.g. when\n * 17 Tammuz falls on Shabbat and is observed on the 18th).\n * @example\n * import {isFastDay, HDate, months} from '@hebcal/core';\n * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)\n * isFastDay(new HDate(11, months.TISHREI, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param il optional; use the Israeli schedule for holidays (default Diaspora)\n * @return `true` if the date is a major or minor fast day\n */\nexport function isFastDay(date: HDate | Date | number, il?: boolean): boolean {\n const events = getHolidaysOnDate(date, il) || [];\n const fastDay = events.find(ev => {\n const mask = ev.getFlags();\n return mask & FAST_DAY && !(mask & EREV);\n });\n return Boolean(fastDay);\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU;AACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;AAEvB;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,SAAS,CAAC,IAA2B,EAAE,EAAY,EAAA;IACjE,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAG;AAC/B,QAAA,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,IAAI,GAAG,QAAQ,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;AAC1C,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale } from '@hebcal/hdate';
3
3
  export { Locale } from '@hebcal/hdate';
4
4
  import poAshkenazi from './ashkenazi.po.js';
@@ -1 +1 @@
1
- {"version":3,"file":"locale.js","sources":["../../../src/locale.ts"],"sourcesContent":["import {Locale} from '@hebcal/hdate';\nimport poAshkenazi from './ashkenazi.po';\nimport poHe from './he.po';\nimport noNikudOverride from './he-x-NoNikud.po';\n\nLocale.addTranslations('he', poHe);\nLocale.addTranslations('ashkenazi', poAshkenazi);\n\n/* Hebrew without nikkud */\nconst poHeNoNikud = Locale.copyLocaleNoNikud(poHe);\nLocale.addTranslations('he-x-NoNikud', poHeNoNikud);\nLocale.addTranslations('he-x-NoNikud', noNikudOverride);\n\nexport {Locale} from '@hebcal/hdate';\n"],"names":[],"mappings":";;;;;;;AAKA,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;AAClC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC;AAEhD;AACA,MAAM,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAClD,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC;AACnD,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC"}
1
+ {"version":3,"file":"locale.js","sources":["../../../src/locale.ts"],"sourcesContent":["import {Locale} from '@hebcal/hdate';\nimport poAshkenazi from './ashkenazi.po.js';\nimport poHe from './he.po.js';\nimport noNikudOverride from './he-x-NoNikud.po.js';\n\nLocale.addTranslations('he', poHe);\nLocale.addTranslations('ashkenazi', poAshkenazi);\n\n/* Hebrew without nikkud */\nconst poHeNoNikud = Locale.copyLocaleNoNikud(poHe);\nLocale.addTranslations('he-x-NoNikud', poHeNoNikud);\nLocale.addTranslations('he-x-NoNikud', noNikudOverride);\n\nexport {Locale} from '@hebcal/hdate';\n"],"names":[],"mappings":";;;;;;;AAKA,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;AAClC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC;AAEhD;AACA,MAAM,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAClD,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC;AACnD,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC"}
@@ -5,7 +5,7 @@ import { GeoLocation } from '@hebcal/noaa';
5
5
  *
6
6
  * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar
7
7
  * specific data: an Israel/Diaspora flag, ISO country code, and an optional
8
- * geographic identifier. Also provides {@link Location.lookup} for ~60
8
+ * geographic identifier. Also provides {@link Location.lookup} for the 65
9
9
  * built-in "classic" Hebcal cities.
10
10
  *
11
11
  * @example
@@ -28,11 +28,27 @@ export declare class Location extends GeoLocation {
28
28
  private readonly il;
29
29
  private readonly cc?;
30
30
  private readonly geoid?;
31
+ /**
32
+ * First-level administrative division (e.g. a US state or a French
33
+ * region) as an abbreviation, such as `"CA"`. Not set by this package;
34
+ * populated by callers that hydrate a `Location` from a geo database.
35
+ */
31
36
  admin1?: string;
37
+ /**
38
+ * Full name of the first-level administrative division, such as
39
+ * `"California"`. Not set by this package.
40
+ */
32
41
  stateName?: string;
42
+ /**
43
+ * Which kind of lookup produced this location: `'zip'` for a US Zip Code
44
+ * or `'geoname'` for a GeoNames city. Not set by this package.
45
+ */
33
46
  geo?: 'zip' | 'geoname';
47
+ /** US Zip Code, such as `"02912"`. Not set by this package. */
34
48
  zip?: string;
49
+ /** Approximate population of the city. Not set by this package. */
35
50
  population?: number;
51
+ /** City name in plain ASCII, for sorting or URL generation. Not set by this package. */
36
52
  asciiname?: string;
37
53
  /**
38
54
  * Initialize a Location instance
@@ -54,19 +70,29 @@ export declare class Location extends GeoLocation {
54
70
  /**
55
71
  * Returns the full descriptive location name passed to the constructor,
56
72
  * or `null` if no name was provided.
73
+ *
74
+ * Note that the built-in classic cities are named by city alone, so
75
+ * `getName()` and {@link getShortName} return the same string for them.
57
76
  * @example
58
- * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'
77
+ * const loc = new Location(41.85003, -87.65005, false,
78
+ * 'America/Chicago', 'Chicago, Illinois, USA', 'US');
79
+ * loc.getName(); // 'Chicago, Illinois, USA'
80
+ * Location.lookup('San Francisco')?.getName(); // 'San Francisco'
59
81
  */
60
82
  getName(): string | null;
61
83
  /**
62
84
  * Returns the location name truncated at the first comma. Useful for
63
85
  * compact display where only the city name is desired.
64
86
  *
65
- * Special-cased so that US locations of the form `"Washington, DC"` or
87
+ * Special-cased so that US locations of the form `"Washington, DC ..."` or
66
88
  * `"Washington, D.C., ..."` keep the `DC` / `D.C.` suffix attached.
67
89
  * @example
68
- * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'
69
- * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'
90
+ * const chi = new Location(41.85003, -87.65005, false,
91
+ * 'America/Chicago', 'Chicago, Illinois, USA', 'US');
92
+ * chi.getShortName(); // 'Chicago'
93
+ * const dc = new Location(38.89511, -77.03637, false,
94
+ * 'America/New_York', 'Washington, D.C., USA', 'US');
95
+ * dc.getShortName(); // 'Washington, D.C.'
70
96
  */
71
97
  getShortName(): string | null;
72
98
  /**
@@ -96,7 +122,7 @@ export declare class Location extends GeoLocation {
96
122
  */
97
123
  getGeoId(): string | number | undefined;
98
124
  /**
99
- * Creates a location object from one of 60 "classic" Hebcal city names.
125
+ * Creates a location object from one of 65 "classic" Hebcal city names.
100
126
  * The following city names are supported:
101
127
  * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',
102
128
  * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',
@@ -155,13 +181,15 @@ export declare class Location extends GeoLocation {
155
181
  * location with the same (lower-cased) name is already registered, and
156
182
  * `true` if successfully added.
157
183
  *
158
- * Use this to extend the built-in set of ~60 classic Hebcal cities with
184
+ * Use this to extend the built-in set of 65 classic Hebcal cities with
159
185
  * your own custom locations.
160
186
  * @example
161
187
  * const tlv = new Location(32.0853, 34.7818, true,
162
- * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');
188
+ * 'Asia/Jerusalem', 'My Office, Tel Aviv', 'IL');
163
189
  * Location.addLocation('My Office', tlv); // true
164
- * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'
190
+ * Location.lookup('my office')?.getTzid(); // 'Asia/Jerusalem'
191
+ * @param cityName name to register the location under (case insensitive)
192
+ * @param location the `Location` instance to register
165
193
  */
166
194
  static addLocation(cityName: string, location: Location): boolean;
167
195
  }
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { GeoLocation } from '@hebcal/noaa';
3
3
  import citiesJson from './cities.json.js';
4
4
  import QuickLRU from 'quick-lru';
@@ -75,7 +75,7 @@ function initClassicCities() {
75
75
  *
76
76
  * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar
77
77
  * specific data: an Israel/Diaspora flag, ISO country code, and an optional
78
- * geographic identifier. Also provides {@link Location.lookup} for ~60
78
+ * geographic identifier. Also provides {@link Location.lookup} for the 65
79
79
  * built-in "classic" Hebcal cities.
80
80
  *
81
81
  * @example
@@ -98,11 +98,27 @@ class Location extends GeoLocation {
98
98
  il;
99
99
  cc;
100
100
  geoid;
101
+ /**
102
+ * First-level administrative division (e.g. a US state or a French
103
+ * region) as an abbreviation, such as `"CA"`. Not set by this package;
104
+ * populated by callers that hydrate a `Location` from a geo database.
105
+ */
101
106
  admin1;
107
+ /**
108
+ * Full name of the first-level administrative division, such as
109
+ * `"California"`. Not set by this package.
110
+ */
102
111
  stateName;
112
+ /**
113
+ * Which kind of lookup produced this location: `'zip'` for a US Zip Code
114
+ * or `'geoname'` for a GeoNames city. Not set by this package.
115
+ */
103
116
  geo;
117
+ /** US Zip Code, such as `"02912"`. Not set by this package. */
104
118
  zip;
119
+ /** Approximate population of the city. Not set by this package. */
105
120
  population;
121
+ /** City name in plain ASCII, for sorting or URL generation. Not set by this package. */
106
122
  asciiname;
107
123
  /**
108
124
  * Initialize a Location instance
@@ -149,8 +165,14 @@ class Location extends GeoLocation {
149
165
  /**
150
166
  * Returns the full descriptive location name passed to the constructor,
151
167
  * or `null` if no name was provided.
168
+ *
169
+ * Note that the built-in classic cities are named by city alone, so
170
+ * `getName()` and {@link getShortName} return the same string for them.
152
171
  * @example
153
- * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'
172
+ * const loc = new Location(41.85003, -87.65005, false,
173
+ * 'America/Chicago', 'Chicago, Illinois, USA', 'US');
174
+ * loc.getName(); // 'Chicago, Illinois, USA'
175
+ * Location.lookup('San Francisco')?.getName(); // 'San Francisco'
154
176
  */
155
177
  getName() {
156
178
  return this.getLocationName();
@@ -159,11 +181,15 @@ class Location extends GeoLocation {
159
181
  * Returns the location name truncated at the first comma. Useful for
160
182
  * compact display where only the city name is desired.
161
183
  *
162
- * Special-cased so that US locations of the form `"Washington, DC"` or
184
+ * Special-cased so that US locations of the form `"Washington, DC ..."` or
163
185
  * `"Washington, D.C., ..."` keep the `DC` / `D.C.` suffix attached.
164
186
  * @example
165
- * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'
166
- * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'
187
+ * const chi = new Location(41.85003, -87.65005, false,
188
+ * 'America/Chicago', 'Chicago, Illinois, USA', 'US');
189
+ * chi.getShortName(); // 'Chicago'
190
+ * const dc = new Location(38.89511, -77.03637, false,
191
+ * 'America/New_York', 'Washington, D.C., USA', 'US');
192
+ * dc.getShortName(); // 'Washington, D.C.'
167
193
  */
168
194
  getShortName() {
169
195
  const name = this.getLocationName();
@@ -217,7 +243,7 @@ class Location extends GeoLocation {
217
243
  return this.geoid;
218
244
  }
219
245
  /**
220
- * Creates a location object from one of 60 "classic" Hebcal city names.
246
+ * Creates a location object from one of 65 "classic" Hebcal city names.
221
247
  * The following city names are supported:
222
248
  * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',
223
249
  * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',
@@ -322,13 +348,15 @@ class Location extends GeoLocation {
322
348
  * location with the same (lower-cased) name is already registered, and
323
349
  * `true` if successfully added.
324
350
  *
325
- * Use this to extend the built-in set of ~60 classic Hebcal cities with
351
+ * Use this to extend the built-in set of 65 classic Hebcal cities with
326
352
  * your own custom locations.
327
353
  * @example
328
354
  * const tlv = new Location(32.0853, 34.7818, true,
329
- * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');
355
+ * 'Asia/Jerusalem', 'My Office, Tel Aviv', 'IL');
330
356
  * Location.addLocation('My Office', tlv); // true
331
- * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'
357
+ * Location.lookup('my office')?.getTzid(); // 'Asia/Jerusalem'
358
+ * @param cityName name to register the location under (case insensitive)
359
+ * @param location the `Location` instance to register
332
360
  */
333
361
  static addLocation(cityName, location) {
334
362
  const name = cityName.toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for ~60\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n admin1?: string;\n stateName?: string;\n geo?: 'zip' | 'geoname';\n zip?: string;\n population?: number;\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n if (countryCode === 'IL') {\n this.il = true;\n }\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n * @example\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'\n * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n }\n if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 60 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n }\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n }\n if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n }\n if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n }\n if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n }\n return ZIPCODES_TZ_MAP[tz];\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of ~60 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;CACb;AAEV;AACA,MAAM,eAAe,GAAG,IAAI,QAAQ,CAA8B;AAChE,IAAA,OAAO,EAAE,GAAG;AACb,CAAA,CAAC;AAEF;;;;AAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAA;IAChC,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,I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OAAO,UAAU,CAAC,KAAa,EAAE,EAAU,EAAE,GAAW,EAAA;QACtD,EAAE,GAAG,CAAC,EAAE;QACR,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;QACA,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YAC9B,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;AACA,QAAA,OAAO,eAAe,CAAC,EAAE,CAAC;IAC5B;AAEA;;;;;;;;;;;;;AAaG;AACH,IAAA,OAAO,WAAW,CAAC,QAAgB,EAAE,QAAkB,EAAA;AACrD,QAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE;AACnC,QAAA,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC3B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjC,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
1
+ {"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json.js';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for the 65\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n /**\n * First-level administrative division (e.g. a US state or a French\n * region) as an abbreviation, such as `\"CA\"`. Not set by this package;\n * populated by callers that hydrate a `Location` from a geo database.\n */\n admin1?: string;\n /**\n * Full name of the first-level administrative division, such as\n * `\"California\"`. Not set by this package.\n */\n stateName?: string;\n /**\n * Which kind of lookup produced this location: `'zip'` for a US Zip Code\n * or `'geoname'` for a GeoNames city. Not set by this package.\n */\n geo?: 'zip' | 'geoname';\n /** US Zip Code, such as `\"02912\"`. Not set by this package. */\n zip?: string;\n /** Approximate population of the city. Not set by this package. */\n population?: number;\n /** City name in plain ASCII, for sorting or URL generation. Not set by this package. */\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n if (countryCode === 'IL') {\n this.il = true;\n }\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n *\n * Note that the built-in classic cities are named by city alone, so\n * `getName()` and {@link getShortName} return the same string for them.\n * @example\n * const loc = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * loc.getName(); // 'Chicago, Illinois, USA'\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC ...\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * const chi = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * chi.getShortName(); // 'Chicago'\n * const dc = new Location(38.89511, -77.03637, false,\n * 'America/New_York', 'Washington, D.C., USA', 'US');\n * dc.getShortName(); // 'Washington, D.C.'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n }\n if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 65 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n }\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n }\n if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n }\n if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n }\n if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n }\n return ZIPCODES_TZ_MAP[tz];\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of 65 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Jerusalem', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Jerusalem'\n * @param cityName name to register the location under (case insensitive)\n * @param location the `Location` instance to register\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,kBAAkB;IACxB,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B,gBAAA,KAAK,CAAC;AACJ,oBAAA,OAAO,eAAe;AACxB,gBAAA,KAAK,CAAC;AACJ,oBAAA,OAAO,cAAc;AACvB,gBAAA,KAAK,CAAC;AACJ,oBAAA,OAAO,eAAe;;QAI5B;AACA,QAAA,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,OAAO,eAAe,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QACzC;AACA,QAAA,OAAO,SAAS;IAClB;AAEA;;;;;;;AAOG;AACH,IAAA,OAAO,UAAU,CAAC,KAAa,EAAE,EAAU,EAAE,GAAW,EAAA;QACtD,EAAE,GAAG,CAAC,EAAE;QACR,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;QACA,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YAC9B,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;AACA,QAAA,OAAO,eAAe,CAAC,EAAE,CAAC;IAC5B;AAEA;;;;;;;;;;;;;;;AAeG;AACH,IAAA,OAAO,WAAW,CAAC,QAAgB,EAAE,QAAkB,EAAA;AACrD,QAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE;AACnC,QAAA,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC3B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjC,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const SUN = 0;
@@ -1,8 +1,8 @@
1
1
  import 'temporal-polyfill/global';
2
- import { Event } from './event';
3
- import { CalOptions } from './CalOptions';
2
+ import { Event } from './event.js';
3
+ import { CalOptions } from './CalOptions.js';
4
4
  import { HDate } from '@hebcal/hdate';
5
- import './locale';
5
+ import './locale.js';
6
6
  /**
7
7
  * Represents a *molad* — the calculated moment when the new moon is "born"
8
8
  * for a given Hebrew month.
@@ -16,8 +16,8 @@ import './locale';
16
16
  * import {Molad, months} from '@hebcal/core';
17
17
  * const m = new Molad(5784, months.NISAN);
18
18
  * console.log(m.getMonthName()); // 'Nisan'
19
- * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12
20
- * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'
19
+ * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // 22 57 7
20
+ * console.log(m.render('en')); // 'Molad Nisan: Monday, 10:57pm and 7 chalakim'
21
21
  */
22
22
  export declare class Molad {
23
23
  private readonly m;
@@ -69,17 +69,21 @@ export declare class Molad {
69
69
  */
70
70
  getChalakim(): number;
71
71
  /**
72
- * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.
73
- * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
74
- * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
75
- * intentionally uses standard time and not daylight savings time.
72
+ * Returns the moment of the molad as a `Temporal.ZonedDateTime` in the `UTC` zone.
73
+ *
74
+ * The molad is computed in Jerusalem *standard* time and then converted, so the
75
+ * returned instant is correct year-round; only the zone of the returned object
76
+ * is `UTC`. This method subtracts 20.94 minutes (20 minutes and 56.496 seconds)
77
+ * from the computed time — Har Habayis, at longitude 35.2354°, is 5.2354° away
78
+ * from the multiple-of-15 timezone longitude — to get to standard time. Daylight
79
+ * savings time is intentionally not applied; adjust when formatting for display.
76
80
  *
77
81
  * The returned value is cached after the first call.
78
82
  * @example
79
83
  * import {Molad, months} from '@hebcal/core';
80
84
  * const m = new Molad(5784, months.NISAN);
81
85
  * const zdt = m.getInstant();
82
- * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'
86
+ * console.log(zdt.toString()); // '2024-04-08T20:36:26.837+00:00[UTC]'
83
87
  * @return the `Temporal.ZonedDateTime` representing the moment of the molad
84
88
  */
85
89
  getInstant(): Temporal.ZonedDateTime;
@@ -92,9 +96,9 @@ export declare class Molad {
92
96
  */
93
97
  getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime;
94
98
  /**
95
- * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a
96
- * href="https://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a>. See the <a
97
- * href="https://en.wikipedia.org/wiki/Yoel_Sirkis">Bach's</a> opinion on this time. This method returns the time
99
+ * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the
100
+ * [Mechaber](https://en.wikipedia.org/wiki/Yosef_Karo). See the
101
+ * [Bach's](https://en.wikipedia.org/wiki/Yoel_Sirkis) opinion on this time. This method returns the time
98
102
  * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
99
103
  * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
100
104
  *
@@ -102,8 +106,8 @@ export declare class Molad {
102
106
  */
103
107
  getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime;
104
108
  /**
105
- * Returns the latest time of Kiddush Levana according to the <a
106
- * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
109
+ * Returns the latest time of Kiddush Levana according to the
110
+ * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) opinion that it is calculated as
107
111
  * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and
108
112
  * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time
109
113
  * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
@@ -115,12 +119,12 @@ export declare class Molad {
115
119
  /**
116
120
  * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down
117
121
  * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
118
- * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
119
- * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
120
- * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber
122
+ * [Rema](https://en.wikipedia.org/wiki/Moses_Isserles) who brings down the opinion of the
123
+ * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) of calculating
124
+ * {@link Molad.getSofZmanKidushLevanaBetweenMoldos | half way between molad and molad} is of the opinion that Mechaber
121
125
  * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid
122
- * Heber's very detailed writeup in Siman Daled (chapter 4) of <a
123
- * href="https://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>. This method returns the time even if it is during
126
+ * Heber's very detailed writeup in Siman Daled (chapter 4) of
127
+ * [Shaarei Zmanim](https://www.worldcat.org/oclc/461326125). This method returns the time even if it is during
124
128
  * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_
125
129
  * before this time if the zman is between _alos_ and _tzais_.
126
130
  *
@@ -133,14 +137,16 @@ export declare class Molad {
133
137
  * month name, day of week, hour : minute, and chalakim if non-zero.
134
138
  *
135
139
  * Time format honors `options.hour12` and `options.location` (12-hour vs.
136
- * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.
140
+ * 24-hour); see {@link reformatTimeStr}.
137
141
  * @example
138
142
  * import {Molad, months} from '@hebcal/core';
139
143
  * const m = new Molad(5784, months.NISAN);
140
144
  * m.render('en', {hour12: true});
141
- * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'
145
+ * // => 'Molad Nisan: Monday, 10:57pm and 7 chalakim'
146
+ * m.render('en', {hour12: false});
147
+ * // => 'Molad Nisan: Monday, 22:57 and 7 chalakim'
142
148
  * m.render('he');
143
- * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
149
+ * // => 'מוֹלָד הָלְּבָנָה נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
144
150
  * @param [locale] Optional locale name (defaults to empty locale)
145
151
  * @param options used for time formatting (12-hour vs 24-hour)
146
152
  */