@hebcal/core 6.0.5 → 6.0.7

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 (149) hide show
  1. package/README.md +42 -27
  2. package/dist/bundle.js +26 -15
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +3 -3
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/DailyLearning.js +1 -1
  7. package/dist/esm/HebrewDateEvent.js +1 -1
  8. package/dist/esm/HolidayEvent.js +2 -2
  9. package/dist/esm/HolidayEvent.js.map +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  11. package/dist/esm/ParshaEvent.js +2 -2
  12. package/dist/esm/ParshaEvent.js.map +1 -1
  13. package/dist/esm/TimedEvent.js +1 -1
  14. package/dist/esm/YomKippurKatanEvent.js +1 -1
  15. package/dist/esm/ashkenazi.po.js +1 -1
  16. package/dist/esm/calendar.js +7 -5
  17. package/dist/esm/calendar.js.map +1 -1
  18. package/dist/esm/candles.js +1 -1
  19. package/dist/esm/event.js +1 -1
  20. package/dist/esm/getStartAndEnd.js +1 -1
  21. package/dist/esm/hallel.js +1 -1
  22. package/dist/esm/he-x-NoNikud.po.d.ts +2 -0
  23. package/dist/esm/he-x-NoNikud.po.js +2 -2
  24. package/dist/esm/he-x-NoNikud.po.js.map +1 -1
  25. package/dist/esm/he.po.d.ts +1 -0
  26. package/dist/esm/he.po.js +2 -2
  27. package/dist/esm/he.po.js.map +1 -1
  28. package/dist/esm/hebcal.js +1 -1
  29. package/dist/esm/holidays.js +1 -1
  30. package/dist/esm/holidays.js.map +1 -1
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/isAssurBemlacha.js +1 -1
  33. package/dist/esm/locale.js +1 -1
  34. package/dist/esm/location.js +2 -2
  35. package/dist/esm/location.js.map +1 -1
  36. package/dist/esm/modern.js +1 -1
  37. package/dist/esm/molad.js +1 -1
  38. package/dist/esm/omer.d.ts +1 -1
  39. package/dist/esm/omer.js +6 -2
  40. package/dist/esm/omer.js.map +1 -1
  41. package/dist/esm/parshaName.js +1 -1
  42. package/dist/esm/parshaYear.d.ts +2 -2
  43. package/dist/esm/parshaYear.js +1 -1
  44. package/dist/esm/parshaYear.js.map +1 -1
  45. package/dist/esm/pkgVersion.d.ts +1 -1
  46. package/dist/esm/pkgVersion.js +2 -2
  47. package/dist/esm/pkgVersion.js.map +1 -1
  48. package/dist/esm/reformatTimeStr.js +1 -1
  49. package/dist/esm/sedra.d.ts +5 -1
  50. package/dist/esm/sedra.js +9 -3
  51. package/dist/esm/sedra.js.map +1 -1
  52. package/dist/esm/staticHolidays.js +1 -2
  53. package/dist/esm/staticHolidays.js.map +1 -1
  54. package/dist/esm/tachanun.js +1 -1
  55. package/dist/esm/zmanim.js +1 -1
  56. package/dist/he-x-NoNikud.po.d.ts +2 -0
  57. package/dist/he.po.d.ts +1 -0
  58. package/dist/omer.d.ts +1 -1
  59. package/dist/parshaYear.d.ts +2 -2
  60. package/dist/pkgVersion.d.ts +1 -1
  61. package/dist/po2json.d.ts +1 -0
  62. package/dist/po2json.js +41 -0
  63. package/dist/sedra.d.ts +5 -1
  64. package/dist/size-demo/dist/getHoliday.d.ts +1944 -0
  65. package/dist/size-demo/dist/getHoliday.js +3712 -0
  66. package/dist/size-demo/dist/parshiyot.js +10662 -0
  67. package/dist/size-demo/dist/sedra.d.ts +1411 -0
  68. package/dist/size-demo/dist/sedra.js +2359 -0
  69. package/dist/size-demo/dist/tachanun.d.ts +1015 -0
  70. package/dist/size-demo/dist/tachanun.js +1755 -0
  71. package/dist/size-demo/getHoliday.d.ts +1 -0
  72. package/dist/size-demo/getHoliday.js +3 -0
  73. package/dist/size-demo/parshiyot.d.ts +1 -0
  74. package/dist/size-demo/parshiyot.js +11 -0
  75. package/dist/size-demo/rollup.config.d.ts +3 -0
  76. package/dist/size-demo/rollup.config.js +47 -0
  77. package/dist/size-demo/sedra.d.ts +1 -0
  78. package/dist/size-demo/sedra.js +3 -0
  79. package/dist/size-demo/tachanun.d.ts +1 -0
  80. package/dist/size-demo/tachanun.js +3 -0
  81. package/dist/src/CalOptions.d.ts +168 -0
  82. package/dist/src/CalOptions.js +1 -0
  83. package/dist/src/DailyLearning.d.ts +32 -0
  84. package/dist/src/DailyLearning.js +55 -0
  85. package/dist/src/HebrewDateEvent.d.ts +37 -0
  86. package/dist/src/HebrewDateEvent.js +72 -0
  87. package/dist/src/HolidayEvent.d.ts +83 -0
  88. package/dist/src/HolidayEvent.js +186 -0
  89. package/dist/src/MevarchimChodeshEvent.d.ts +26 -0
  90. package/dist/src/MevarchimChodeshEvent.js +50 -0
  91. package/dist/src/ParshaEvent.d.ts +19 -0
  92. package/dist/src/ParshaEvent.js +43 -0
  93. package/dist/src/TimedEvent.d.ts +47 -0
  94. package/dist/src/TimedEvent.js +92 -0
  95. package/dist/src/YomKippurKatanEvent.d.ts +23 -0
  96. package/dist/src/YomKippurKatanEvent.js +38 -0
  97. package/dist/src/ashkenazi.po.d.ts +70 -0
  98. package/dist/src/ashkenazi.po.js +1 -0
  99. package/dist/src/calendar.d.ts +111 -0
  100. package/dist/src/calendar.js +660 -0
  101. package/dist/src/candles.d.ts +44 -0
  102. package/dist/src/candles.js +163 -0
  103. package/dist/src/event.d.ts +188 -0
  104. package/dist/src/event.js +233 -0
  105. package/dist/src/getStartAndEnd.d.ts +6 -0
  106. package/dist/src/getStartAndEnd.js +97 -0
  107. package/dist/src/hallel.d.ts +6 -0
  108. package/dist/src/hallel.js +47 -0
  109. package/dist/src/he-x-NoNikud.po.d.ts +15 -0
  110. package/dist/src/he-x-NoNikud.po.js +1 -0
  111. package/dist/src/he.po.d.ts +195 -0
  112. package/dist/src/he.po.js +1 -0
  113. package/dist/src/hebcal.d.ts +260 -0
  114. package/dist/src/hebcal.js +332 -0
  115. package/dist/src/holidays.d.ts +22 -0
  116. package/dist/src/holidays.js +288 -0
  117. package/dist/src/index.d.ts +26 -0
  118. package/dist/src/index.js +24 -0
  119. package/dist/src/isAssurBemlacha.d.ts +9 -0
  120. package/dist/src/isAssurBemlacha.js +62 -0
  121. package/dist/src/locale.d.ts +2 -0
  122. package/dist/src/locale.js +11 -0
  123. package/dist/src/location.d.ts +73 -0
  124. package/dist/src/location.js +306 -0
  125. package/dist/src/modern.d.ts +18 -0
  126. package/dist/src/modern.js +59 -0
  127. package/dist/src/molad.d.ts +62 -0
  128. package/dist/src/molad.js +169 -0
  129. package/dist/src/omer.d.ts +53 -0
  130. package/dist/src/omer.js +302 -0
  131. package/dist/src/parshaName.d.ts +2 -0
  132. package/dist/src/parshaName.js +13 -0
  133. package/dist/src/parshaYear.d.ts +9 -0
  134. package/dist/src/parshaYear.js +24 -0
  135. package/dist/src/pkgVersion.d.ts +2 -0
  136. package/dist/src/pkgVersion.js +2 -0
  137. package/dist/src/reformatTimeStr.d.ts +8 -0
  138. package/dist/src/reformatTimeStr.js +48 -0
  139. package/dist/src/sedra.d.ts +95 -0
  140. package/dist/src/sedra.js +477 -0
  141. package/dist/src/staticHolidays.d.ts +176 -0
  142. package/dist/src/staticHolidays.js +614 -0
  143. package/dist/src/tachanun.d.ts +29 -0
  144. package/dist/src/tachanun.js +120 -0
  145. package/dist/src/zmanim.d.ts +347 -0
  146. package/dist/src/zmanim.js +579 -0
  147. package/dist/version.d.ts +1 -0
  148. package/dist/version.js +9 -0
  149. package/package.json +12 -9
@@ -0,0 +1,24 @@
1
+ export { version } from './pkgVersion';
2
+ export { gematriya, gematriyaStrToNum } from '@hebcal/hdate';
3
+ export { greg, months, HDate, Locale, } from '@hebcal/hdate';
4
+ import './locale'; // Adds Hebrew and Ashkenazic translations
5
+ export { HebrewDateEvent } from './HebrewDateEvent';
6
+ export { Event, flags } from './event';
7
+ export { GeoLocation, NOAACalculator } from '@hebcal/noaa';
8
+ export { Location } from './location';
9
+ export { Zmanim } from './zmanim';
10
+ export { isAssurBemlacha } from './isAssurBemlacha';
11
+ export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent';
12
+ export { FastDayEvent, TimedChanukahEvent } from './candles';
13
+ export { Molad, MoladEvent } from './molad';
14
+ export { OmerEvent } from './omer';
15
+ export { Sedra, parshiot, getSedra } from './sedra';
16
+ export { ParshaEvent } from './ParshaEvent';
17
+ export { parshaYear } from './parshaYear';
18
+ export { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent, RoshHashanaEvent, } from './HolidayEvent';
19
+ export { getHolidaysOnDate } from './holidays';
20
+ export { MevarchimChodeshEvent } from './MevarchimChodeshEvent';
21
+ export { YomKippurKatanEvent } from './YomKippurKatanEvent';
22
+ export { holidayDesc } from './staticHolidays';
23
+ export { DailyLearning } from './DailyLearning';
24
+ export { HebrewCalendar } from './hebcal';
@@ -0,0 +1,9 @@
1
+ import { Location } from './location';
2
+ /**
3
+ * Utility method to determine if the date and time has a <em>melacha</em> (work) prohibition.
4
+ * Although there are many opinions on the time of <em>tzais</em>, for simplicity
5
+ * this function uses solar depression of 8.5 degrees.
6
+ *
7
+ * @return `true` if <em>melacha</em> is prohibited or `false` if it is not.
8
+ */
9
+ export declare function isAssurBemlacha(currentTime: Date, location: Location, useElevation: boolean): boolean;
@@ -0,0 +1,62 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Zmanim } from './zmanim';
3
+ import { getHolidaysOnDate } from './holidays';
4
+ import { flags } from './event';
5
+ const LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;
6
+ function isTomorrowShabbosOrYomTov(dow, events) {
7
+ if (dow === 5) {
8
+ return true;
9
+ }
10
+ const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);
11
+ if (erev) {
12
+ return true;
13
+ }
14
+ return false;
15
+ }
16
+ /**
17
+ * 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.
18
+ *
19
+ * @return if the day is a <em>Yom Tov</em> that is <em>assur bemlacha</em> or <em>Shabbos</em>
20
+ */
21
+ function isTodayAssurBemelacha(dow, events) {
22
+ if (dow === 6) {
23
+ return true;
24
+ }
25
+ const chag = events.find(ev => ev.getFlags() & flags.CHAG);
26
+ if (chag) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ /**
32
+ * Utility method to determine if the date and time has a <em>melacha</em> (work) prohibition.
33
+ * Although there are many opinions on the time of <em>tzais</em>, for simplicity
34
+ * this function uses solar depression of 8.5 degrees.
35
+ *
36
+ * @return `true` if <em>melacha</em> is prohibited or `false` if it is not.
37
+ */
38
+ export function isAssurBemlacha(currentTime, location, useElevation) {
39
+ const zmanim = new Zmanim(location, currentTime, useElevation);
40
+ // erev shabbos, YT or YT sheni and after shkiah
41
+ const sunset = zmanim.sunset();
42
+ const sunsetMillis = sunset.getTime();
43
+ if (isNaN(sunsetMillis)) {
44
+ throw new Error('Could not determine sunset');
45
+ }
46
+ // erev shabbos, YT or YT sheni and after shkiah
47
+ const il = location.getIsrael();
48
+ const currentMillis = currentTime.getTime();
49
+ const hd = new HDate(currentTime);
50
+ const dow = hd.getDay();
51
+ const events = getHolidaysOnDate(hd, il) || [];
52
+ if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {
53
+ return true;
54
+ }
55
+ // is shabbos or YT and it is before tzais
56
+ if (isTodayAssurBemelacha(dow, events)) {
57
+ const tzais = zmanim.tzeit();
58
+ const tzaisMillis = tzais.getTime();
59
+ return currentMillis <= tzaisMillis;
60
+ }
61
+ return false;
62
+ }
@@ -0,0 +1,2 @@
1
+ import { Locale } from '@hebcal/hdate';
2
+ export { Locale };
@@ -0,0 +1,11 @@
1
+ import { Locale } from '@hebcal/hdate';
2
+ import poAshkenazi from './ashkenazi.po';
3
+ import poHe from './he.po';
4
+ import noNikudOverride from './he-x-NoNikud.po';
5
+ export { Locale };
6
+ Locale.addTranslations('he', poHe);
7
+ Locale.addTranslations('ashkenazi', poAshkenazi);
8
+ /* Hebrew without nikkud */
9
+ const poHeNoNikud = Locale.copyLocaleNoNikud(poHe);
10
+ Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
11
+ Locale.addTranslations('he-x-NoNikud', noNikudOverride);
@@ -0,0 +1,73 @@
1
+ import { GeoLocation } from '@hebcal/noaa';
2
+ /** Class representing Location */
3
+ export declare class Location extends GeoLocation {
4
+ private readonly il;
5
+ private readonly cc?;
6
+ private readonly geoid?;
7
+ /**
8
+ * Initialize a Location instance
9
+ * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
10
+ * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
11
+ * @param il - in Israel (true) or Diaspora (false)
12
+ * @param tzid - Olson timezone ID, e.g. "America/Chicago"
13
+ * @param [cityName] - optional descriptive city name
14
+ * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR")
15
+ * @param [geoid] - optional string or numeric geographic ID
16
+ * @param [elevation] - in meters (default `0`)
17
+ */
18
+ constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName?: string, countryCode?: string, geoid?: string | number, elevation?: number);
19
+ getIsrael(): boolean;
20
+ getName(): string | null;
21
+ /**
22
+ * Returns the location name, up to the first comma
23
+ */
24
+ getShortName(): string | null;
25
+ getCountryCode(): string | undefined;
26
+ getTzid(): string;
27
+ /**
28
+ * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
29
+ */
30
+ getTimeFormatter(): Intl.DateTimeFormat;
31
+ getGeoId(): string | number | undefined;
32
+ /**
33
+ * Creates a location object from one of 60 "classic" Hebcal city names.
34
+ * The following city names are supported:
35
+ * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',
36
+ * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',
37
+ * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',
38
+ * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',
39
+ * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',
40
+ * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',
41
+ * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',
42
+ * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',
43
+ * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',
44
+ * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',
45
+ * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
46
+ * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
47
+ * 'Washington DC', 'Worcester'
48
+ * @param name
49
+ */
50
+ static lookup(name: string): Location | undefined;
51
+ toString(): string;
52
+ /**
53
+ * Converts legacy Hebcal timezone to a standard Olson tzid.
54
+ * @param tz integer, GMT offset in hours
55
+ * @param dst 'none', 'eu', 'usa', or 'israel'
56
+ */
57
+ static legacyTzToTzid(tz: number, dst: string): string | undefined;
58
+ /**
59
+ * Converts timezone info from Zip-Codes.com to a standard Olson tzid.
60
+ * @example
61
+ * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
62
+ * @param state two-letter all-caps US state abbreviation like 'CA'
63
+ * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles
64
+ * @param dst single char 'Y' or 'N'
65
+ */
66
+ static getUsaTzid(state: string, tz: number, dst: string): string;
67
+ /**
68
+ * Adds a location name for `Location.lookup()` only if the name isn't
69
+ * already being used. Returns `false` if the name is already taken
70
+ * and `true` if successfully added.
71
+ */
72
+ static addLocation(cityName: string, location: Location): boolean;
73
+ }
@@ -0,0 +1,306 @@
1
+ /*
2
+ Hebcal - A Jewish Calendar Generator
3
+ Copyright (c) 1994-2020 Danny Sadinoff
4
+ Portions copyright Eyal Schachter and Michael J. Radwin
5
+
6
+ https://github.com/hebcal/hebcal-es6
7
+
8
+ This program is free software; you can redistribute it and/or
9
+ modify it under the terms of the GNU General Public License
10
+ as published by the Free Software Foundation; either version 2
11
+ of the License, or (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { GeoLocation } from '@hebcal/noaa';
22
+ const classicCities0 = [
23
+ ['Ashdod', 'IL', 31.79213, 34.64966, 'Asia/Jerusalem', 27],
24
+ ['Atlanta', 'US', 33.749, -84.38798, 'America/New_York', 336],
25
+ ['Austin', 'US', 30.26715, -97.74306, 'America/Chicago', 165],
26
+ ['Baghdad', 'IQ', 33.34058, 44.40088, 'Asia/Baghdad', 41],
27
+ ['Beer Sheva', 'IL', 31.25181, 34.7913, 'Asia/Jerusalem', 285],
28
+ ['Berlin', 'DE', 52.52437, 13.41053, 'Europe/Berlin', 43],
29
+ ['Baltimore', 'US', 39.29038, -76.61219, 'America/New_York', 35],
30
+ ['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],
31
+ ['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],
32
+ ['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],
33
+ [
34
+ 'Buenos Aires',
35
+ 'AR',
36
+ -34.61315,
37
+ -58.37723,
38
+ 'America/Argentina/Buenos_Aires',
39
+ 31,
40
+ ],
41
+ ['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],
42
+ ['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],
43
+ ['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],
44
+ ['Cleveland', 'US', 41.4995, -81.69541, 'America/New_York', 204],
45
+ ['Dallas', 'US', 32.78306, -96.80667, 'America/Chicago', 139],
46
+ ['Denver', 'US', 39.73915, -104.9847, 'America/Denver', 1636],
47
+ ['Detroit', 'US', 42.33143, -83.04575, 'America/Detroit', 192],
48
+ ['Eilat', 'IL', 29.55805, 34.94821, 'Asia/Jerusalem', 63],
49
+ ['Gibraltar', 'GI', 36.14474, -5.35257, 'Europe/Gibraltar', 11],
50
+ ['Haifa', 'IL', 32.81841, 34.9885, 'Asia/Jerusalem', 40],
51
+ ['Hawaii', 'US', 21.30694, -157.85833, 'Pacific/Honolulu', 18],
52
+ ['Helsinki', 'FI', 60.16952, 24.93545, 'Europe/Helsinki', 26],
53
+ ['Houston', 'US', 29.76328, -95.36327, 'America/Chicago', 30],
54
+ ['Jerusalem', 'IL', 31.76904, 35.21633, 'Asia/Jerusalem', 786],
55
+ ['Johannesburg', 'ZA', -26.20227, 28.04363, 'Africa/Johannesburg', 1767],
56
+ ['Kiev', 'UA', 50.45466, 30.5238, 'Europe/Kiev', 187],
57
+ ['La Paz', 'BO', -16.5, -68.15, 'America/La_Paz', 3782],
58
+ ['Livingston', 'US', 40.79593, -74.31487, 'America/New_York', 98],
59
+ ['Las Vegas', 'US', 36.17497, -115.13722, 'America/Los_Angeles', 613],
60
+ ['London', 'GB', 51.50853, -0.12574, 'Europe/London', 25],
61
+ ['Los Angeles', 'US', 34.05223, -118.24368, 'America/Los_Angeles', 96],
62
+ ['Marseilles', 'FR', 43.29695, 5.38107, 'Europe/Paris', 28],
63
+ ['Miami', 'US', 25.77427, -80.19366, 'America/New_York', 25],
64
+ ['Minneapolis', 'US', 44.97997, -93.26384, 'America/Chicago', 262],
65
+ ['Melbourne', 'AU', -37.814, 144.96332, 'Australia/Melbourne', 25],
66
+ ['Mexico City', 'MX', 19.42847, -99.12766, 'America/Mexico_City', 2240],
67
+ ['Montreal', 'CA', 45.50884, -73.58781, 'America/Toronto', 216],
68
+ ['Moscow', 'RU', 55.75222, 37.61556, 'Europe/Moscow', 144],
69
+ ['New York', 'US', 40.71427, -74.00597, 'America/New_York', 57],
70
+ ['Omaha', 'US', 41.25861, -95.93779, 'America/Chicago', 315],
71
+ ['Ottawa', 'CA', 45.41117, -75.69812, 'America/Toronto', 71],
72
+ ['Panama City', 'PA', 8.9936, -79.51973, 'America/Panama', 17],
73
+ ['Paris', 'FR', 48.85341, 2.3488, 'Europe/Paris', 42],
74
+ ['Pawtucket', 'US', 41.87871, -71.38256, 'America/New_York', 0], // -11
75
+ ['Petach Tikvah', 'IL', 32.08707, 34.88747, 'Asia/Jerusalem', 54],
76
+ ['Philadelphia', 'US', 39.95233, -75.16379, 'America/New_York', 8],
77
+ ['Phoenix', 'US', 33.44838, -112.07404, 'America/Phoenix', 366],
78
+ ['Pittsburgh', 'US', 40.44062, -79.99589, 'America/New_York', 239],
79
+ ['Providence', 'US', 41.82399, -71.41283, 'America/New_York', 0], // -15
80
+ ['Portland', 'US', 45.52345, -122.67621, 'America/Los_Angeles', 15],
81
+ ['Saint Louis', 'US', 38.62727, -90.19789, 'America/Chicago', 149],
82
+ ['Saint Petersburg', 'RU', 59.93863, 30.31413, 'Europe/Moscow', 11],
83
+ ['San Diego', 'US', 32.71533, -117.15726, 'America/Los_Angeles', 20],
84
+ ['San Francisco', 'US', 37.77493, -122.41942, 'America/Los_Angeles', 28],
85
+ ['Sao Paulo', 'BR', -23.5475, -46.63611, 'America/Sao_Paulo', 769],
86
+ ['Seattle', 'US', 47.60621, -122.33207, 'America/Los_Angeles', 56],
87
+ ['Sydney', 'AU', -33.86785, 151.20732, 'Australia/Sydney', 58],
88
+ ['Tel Aviv', 'IL', 32.08088, 34.78057, 'Asia/Jerusalem', 15],
89
+ ['Tiberias', 'IL', 32.79221, 35.53124, 'Asia/Jerusalem', 0], // -140
90
+ ['Toronto', 'CA', 43.70011, -79.4163, 'America/Toronto', 175],
91
+ ['Vancouver', 'CA', 49.24966, -123.11934, 'America/Vancouver', 70],
92
+ ['White Plains', 'US', 41.03399, -73.76291, 'America/New_York', 82],
93
+ ['Washington DC', 'US', 38.89511, -77.03637, 'America/New_York', 6],
94
+ ['Worcester', 'US', 42.26259, -71.80229, 'America/New_York', 164],
95
+ ];
96
+ const classicCities = new Map();
97
+ // Zip-Codes.com TimeZone IDs
98
+ const ZIPCODES_TZ_MAP = {
99
+ '0': 'UTC',
100
+ '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)
101
+ '5': 'America/New_York', // Eastern (GMT -05:00)
102
+ '6': 'America/Chicago', // Central (GMT -06:00)
103
+ '7': 'America/Denver', // Mountain (GMT -07:00)
104
+ '8': 'America/Los_Angeles', // Pacific (GMT -08:00)
105
+ '9': 'America/Anchorage', // Alaska (GMT -09:00)
106
+ '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)
107
+ '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)
108
+ '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)
109
+ '14': 'Pacific/Guam', // Guam (GMT +10:00)
110
+ '15': 'Pacific/Palau', // Palau (GMT +9:00)
111
+ '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)
112
+ };
113
+ /** @private */
114
+ const timeFormatCache = new Map();
115
+ /**
116
+ * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache
117
+ * or makes a new one if needed
118
+ * @private
119
+ */
120
+ function getFormatter(tzid) {
121
+ const fmt = timeFormatCache.get(tzid);
122
+ if (fmt)
123
+ return fmt;
124
+ const f = new Intl.DateTimeFormat('en-US', {
125
+ timeZone: tzid,
126
+ hour: 'numeric',
127
+ minute: 'numeric',
128
+ hour12: false,
129
+ });
130
+ timeFormatCache.set(tzid, f);
131
+ return f;
132
+ }
133
+ /** Class representing Location */
134
+ export class Location extends GeoLocation {
135
+ /**
136
+ * Initialize a Location instance
137
+ * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
138
+ * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
139
+ * @param il - in Israel (true) or Diaspora (false)
140
+ * @param tzid - Olson timezone ID, e.g. "America/Chicago"
141
+ * @param [cityName] - optional descriptive city name
142
+ * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR")
143
+ * @param [geoid] - optional string or numeric geographic ID
144
+ * @param [elevation] - in meters (default `0`)
145
+ */
146
+ constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
147
+ const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
148
+ if (isNaN(lat) || lat < -90 || lat > 90) {
149
+ throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
150
+ }
151
+ const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
152
+ if (isNaN(long) || long < -180 || long > 180) {
153
+ throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
154
+ }
155
+ if (!tzid) {
156
+ throw new RangeError('Invalid timezone');
157
+ }
158
+ const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;
159
+ super(cityName || null, lat, long, elev, tzid);
160
+ this.il = Boolean(il);
161
+ this.cc = countryCode;
162
+ this.geoid = geoid;
163
+ }
164
+ getIsrael() {
165
+ return this.il;
166
+ }
167
+ getName() {
168
+ return this.getLocationName();
169
+ }
170
+ /**
171
+ * Returns the location name, up to the first comma
172
+ */
173
+ getShortName() {
174
+ const name = this.getLocationName();
175
+ if (!name)
176
+ return name;
177
+ const comma = name.indexOf(', ');
178
+ if (comma === -1)
179
+ return name;
180
+ if (this.cc === 'US' && name[comma + 2] === 'D') {
181
+ if (name[comma + 3] === 'C') {
182
+ return name.substring(0, comma + 4);
183
+ }
184
+ else if (name[comma + 3] === '.' && name[comma + 4] === 'C') {
185
+ return name.substring(0, comma + 6);
186
+ }
187
+ }
188
+ return name.substring(0, comma);
189
+ }
190
+ getCountryCode() {
191
+ return this.cc;
192
+ }
193
+ getTzid() {
194
+ return this.getTimeZone();
195
+ }
196
+ /**
197
+ * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
198
+ */
199
+ getTimeFormatter() {
200
+ return getFormatter(this.getTimeZone());
201
+ }
202
+ getGeoId() {
203
+ return this.geoid;
204
+ }
205
+ /**
206
+ * Creates a location object from one of 60 "classic" Hebcal city names.
207
+ * The following city names are supported:
208
+ * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',
209
+ * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',
210
+ * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',
211
+ * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',
212
+ * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',
213
+ * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',
214
+ * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',
215
+ * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',
216
+ * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',
217
+ * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',
218
+ * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
219
+ * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
220
+ * 'Washington DC', 'Worcester'
221
+ * @param name
222
+ */
223
+ static lookup(name) {
224
+ return classicCities.get(name.toLowerCase());
225
+ }
226
+ toString() {
227
+ return JSON.stringify(this);
228
+ }
229
+ /**
230
+ * Converts legacy Hebcal timezone to a standard Olson tzid.
231
+ * @param tz integer, GMT offset in hours
232
+ * @param dst 'none', 'eu', 'usa', or 'israel'
233
+ */
234
+ static legacyTzToTzid(tz, dst) {
235
+ tz = +tz;
236
+ if (dst === 'none') {
237
+ if (tz === 0) {
238
+ return 'UTC';
239
+ }
240
+ else {
241
+ const plus = tz > 0 ? '+' : '';
242
+ return `Etc/GMT${plus}${tz}`;
243
+ }
244
+ }
245
+ else if (tz === 2 && dst === 'israel') {
246
+ return 'Asia/Jerusalem';
247
+ }
248
+ else if (dst === 'eu') {
249
+ switch (tz) {
250
+ case -2:
251
+ return 'Atlantic/Cape_Verde';
252
+ case -1:
253
+ return 'Atlantic/Azores';
254
+ case 0:
255
+ return 'Europe/London';
256
+ case 1:
257
+ return 'Europe/Paris';
258
+ case 2:
259
+ return 'Europe/Athens';
260
+ default:
261
+ break;
262
+ }
263
+ }
264
+ else if (dst === 'usa') {
265
+ return ZIPCODES_TZ_MAP[String(tz * -1)];
266
+ }
267
+ return undefined;
268
+ }
269
+ /**
270
+ * Converts timezone info from Zip-Codes.com to a standard Olson tzid.
271
+ * @example
272
+ * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
273
+ * @param state two-letter all-caps US state abbreviation like 'CA'
274
+ * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles
275
+ * @param dst single char 'Y' or 'N'
276
+ */
277
+ static getUsaTzid(state, tz, dst) {
278
+ tz = +tz;
279
+ if (tz === 10 && state === 'AK') {
280
+ return 'America/Adak';
281
+ }
282
+ else if (tz === 7 && state === 'AZ') {
283
+ return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';
284
+ }
285
+ else {
286
+ return ZIPCODES_TZ_MAP[tz];
287
+ }
288
+ }
289
+ /**
290
+ * Adds a location name for `Location.lookup()` only if the name isn't
291
+ * already being used. Returns `false` if the name is already taken
292
+ * and `true` if successfully added.
293
+ */
294
+ static addLocation(cityName, location) {
295
+ const name = cityName.toLowerCase();
296
+ if (classicCities.has(name)) {
297
+ return false;
298
+ }
299
+ classicCities.set(name, location);
300
+ return true;
301
+ }
302
+ }
303
+ for (const city of classicCities0) {
304
+ const location = new Location(city[2], city[3], city[1] === 'IL', city[4], city[0], city[1], undefined, city[5]);
305
+ Location.addLocation(city[0], location);
306
+ }
@@ -0,0 +1,18 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ /**
3
+ * Yom HaShoah first observed in 1951.
4
+ * When the actual date of Yom Hashoah falls on a Friday, the
5
+ * state of Israel observes Yom Hashoah on the preceding
6
+ * Thursday. When it falls on a Sunday, Yom Hashoah is observed
7
+ * on the following Monday.
8
+ * http://www.ushmm.org/remembrance/dor/calendar/
9
+ * @private
10
+ * @param year
11
+ */
12
+ export declare function dateYomHaShoah(year: number): HDate | null;
13
+ /**
14
+ * Yom HaAtzma'ut only celebrated after 1948
15
+ * @private
16
+ * @param year
17
+ */
18
+ export declare function dateYomHaZikaron(year: number): HDate | null;
@@ -0,0 +1,59 @@
1
+ import { HDate, months } from '@hebcal/hdate';
2
+ const SUN = 0;
3
+ const TUE = 2;
4
+ const FRI = 5;
5
+ const SAT = 6;
6
+ const NISAN = months.NISAN;
7
+ const IYYAR = months.IYYAR;
8
+ /**
9
+ * Yom HaShoah first observed in 1951.
10
+ * When the actual date of Yom Hashoah falls on a Friday, the
11
+ * state of Israel observes Yom Hashoah on the preceding
12
+ * Thursday. When it falls on a Sunday, Yom Hashoah is observed
13
+ * on the following Monday.
14
+ * http://www.ushmm.org/remembrance/dor/calendar/
15
+ * @private
16
+ * @param year
17
+ */
18
+ export function dateYomHaShoah(year) {
19
+ if (year < 5711) {
20
+ return null;
21
+ }
22
+ let nisan27dt = new HDate(27, NISAN, year);
23
+ if (nisan27dt.getDay() === FRI) {
24
+ nisan27dt = new HDate(26, NISAN, year);
25
+ }
26
+ else if (nisan27dt.getDay() === SUN) {
27
+ nisan27dt = new HDate(28, NISAN, year);
28
+ }
29
+ return nisan27dt;
30
+ }
31
+ /**
32
+ * Yom HaAtzma'ut only celebrated after 1948
33
+ * @private
34
+ * @param year
35
+ */
36
+ export function dateYomHaZikaron(year) {
37
+ if (year < 5708) {
38
+ return null;
39
+ }
40
+ let day;
41
+ const pesach = new HDate(15, NISAN, year);
42
+ const pdow = pesach.getDay();
43
+ if (pdow === SUN) {
44
+ day = 2;
45
+ }
46
+ else if (pdow === SAT) {
47
+ day = 3;
48
+ }
49
+ else if (year < 5764) {
50
+ day = 4;
51
+ }
52
+ else if (pdow === TUE) {
53
+ day = 5;
54
+ }
55
+ else {
56
+ day = 4;
57
+ }
58
+ return new HDate(day, IYYAR, year);
59
+ }
@@ -0,0 +1,62 @@
1
+ import { Event } from './event';
2
+ import { CalOptions } from './CalOptions';
3
+ import { HDate } from '@hebcal/hdate';
4
+ import './locale';
5
+ /**
6
+ * Represents a molad, the moment when the new moon is "born"
7
+ */
8
+ export declare class Molad {
9
+ private readonly m;
10
+ /**
11
+ * Calculates the molad for a Hebrew month
12
+ * @param year
13
+ * @param month
14
+ */
15
+ constructor(year: number, month: number);
16
+ /**
17
+ */
18
+ getYear(): number;
19
+ /**
20
+ */
21
+ getMonth(): number;
22
+ /**
23
+ */
24
+ getMonthName(): string;
25
+ /**
26
+ * @returns Day of Week (0=Sunday, 6=Saturday)
27
+ */
28
+ getDow(): number;
29
+ /**
30
+ * @returns hour of day (0-23)
31
+ */
32
+ getHour(): number;
33
+ /**
34
+ * @returns minutes past hour (0-59)
35
+ */
36
+ getMinutes(): number;
37
+ /**
38
+ * @returns parts of a minute (0-17)
39
+ */
40
+ getChalakim(): number;
41
+ /**
42
+ * @param [locale] Optional locale name (defaults to empty locale)
43
+ * @param options
44
+ */
45
+ render(locale?: string, options?: CalOptions): string;
46
+ }
47
+ /** Represents a Molad announcement on Shabbat Mevarchim */
48
+ export declare class MoladEvent extends Event {
49
+ readonly molad: Molad;
50
+ private readonly options;
51
+ /**
52
+ * @param date Hebrew date event occurs
53
+ * @param hyear molad year
54
+ * @param hmonth molad month
55
+ * @param options
56
+ */
57
+ constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions);
58
+ /**
59
+ * @param [locale] Optional locale name (defaults to empty locale)
60
+ */
61
+ render(locale?: string): string;
62
+ }