@hebcal/core 6.0.8 → 6.1.0

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 (157) hide show
  1. package/dist/DailyLearning.d.ts +1 -1
  2. package/dist/HolidayEvent.d.ts +1 -0
  3. package/dist/ashkenazi.po.d.ts +14 -2
  4. package/dist/bundle.js +2085 -1535
  5. package/dist/bundle.js.map +1 -1
  6. package/dist/bundle.min.js +17 -19
  7. package/dist/bundle.min.js.map +1 -1
  8. package/dist/coverage/block-navigation.d.ts +1 -0
  9. package/dist/coverage/block-navigation.js +70 -0
  10. package/dist/coverage/prettify.d.ts +0 -0
  11. package/dist/coverage/prettify.js +477 -0
  12. package/dist/coverage/sorter.d.ts +1 -0
  13. package/dist/coverage/sorter.js +176 -0
  14. package/dist/eslint.config.d.mts +83 -0
  15. package/dist/eslint.config.mjs +28 -0
  16. package/dist/esm/DailyLearning.d.ts +1 -1
  17. package/dist/esm/DailyLearning.js +1 -1
  18. package/dist/esm/DailyLearning.js.map +1 -1
  19. package/dist/esm/HebrewDateEvent.js +5 -5
  20. package/dist/esm/HebrewDateEvent.js.map +1 -1
  21. package/dist/esm/HolidayEvent.d.ts +1 -0
  22. package/dist/esm/HolidayEvent.js +17 -1
  23. package/dist/esm/HolidayEvent.js.map +1 -1
  24. package/dist/esm/MevarchimChodeshEvent.js +2 -1
  25. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  26. package/dist/esm/ParshaEvent.js +2 -1
  27. package/dist/esm/ParshaEvent.js.map +1 -1
  28. package/dist/esm/TimedEvent.js +9 -3
  29. package/dist/esm/TimedEvent.js.map +1 -1
  30. package/dist/esm/YomKippurKatanEvent.js +2 -1
  31. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  32. package/dist/esm/ashkenazi.po.d.ts +14 -2
  33. package/dist/esm/ashkenazi.po.js +2 -2
  34. package/dist/esm/ashkenazi.po.js.map +1 -1
  35. package/dist/esm/calendar.js +6 -8
  36. package/dist/esm/calendar.js.map +1 -1
  37. package/dist/esm/candles.js +11 -3
  38. package/dist/esm/candles.js.map +1 -1
  39. package/dist/esm/event.js +18 -1
  40. package/dist/esm/event.js.map +1 -1
  41. package/dist/esm/getStartAndEnd.js +2 -2
  42. package/dist/esm/getStartAndEnd.js.map +1 -1
  43. package/dist/esm/hallel.js +1 -1
  44. package/dist/esm/he-x-NoNikud.po.js +1 -1
  45. package/dist/esm/he.po.d.ts +20 -0
  46. package/dist/esm/he.po.js +2 -2
  47. package/dist/esm/he.po.js.map +1 -1
  48. package/dist/esm/hebcal.js +3 -3
  49. package/dist/esm/hebcal.js.map +1 -1
  50. package/dist/esm/holidays.js +3 -3
  51. package/dist/esm/holidays.js.map +1 -1
  52. package/dist/esm/index.d.ts +2 -0
  53. package/dist/esm/index.js +3 -1
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/isAssurBemlacha.js +1 -1
  56. package/dist/esm/locale.d.ts +1 -2
  57. package/dist/esm/locale.js +1 -1
  58. package/dist/esm/locale.js.map +1 -1
  59. package/dist/esm/location.js +7 -1
  60. package/dist/esm/location.js.map +1 -1
  61. package/dist/esm/modern.js +1 -1
  62. package/dist/esm/molad.d.ts +71 -1
  63. package/dist/esm/molad.js +113 -12
  64. package/dist/esm/molad.js.map +1 -1
  65. package/dist/esm/moladBase.d.ts +15 -0
  66. package/dist/esm/moladBase.js +83 -0
  67. package/dist/esm/moladBase.js.map +1 -0
  68. package/dist/esm/moladDate.d.ts +12 -0
  69. package/dist/esm/moladDate.js +63 -0
  70. package/dist/esm/moladDate.js.map +1 -0
  71. package/dist/esm/omer.d.ts +0 -1
  72. package/dist/esm/omer.js +7 -4
  73. package/dist/esm/omer.js.map +1 -1
  74. package/dist/esm/parshaName.js +2 -2
  75. package/dist/esm/parshaName.js.map +1 -1
  76. package/dist/esm/parshaYear.js +1 -1
  77. package/dist/esm/pkgVersion.d.ts +1 -1
  78. package/dist/esm/pkgVersion.js +2 -2
  79. package/dist/esm/pkgVersion.js.map +1 -1
  80. package/dist/esm/reformatTimeStr.js +5 -6
  81. package/dist/esm/reformatTimeStr.js.map +1 -1
  82. package/dist/esm/sedra.js +13 -7
  83. package/dist/esm/sedra.js.map +1 -1
  84. package/dist/esm/staticHolidays.js +1 -1
  85. package/dist/esm/tachanun.js +4 -4
  86. package/dist/esm/tachanun.js.map +1 -1
  87. package/dist/esm/zmanim.d.ts +114 -1
  88. package/dist/esm/zmanim.js +242 -8
  89. package/dist/esm/zmanim.js.map +1 -1
  90. package/dist/he.po.d.ts +20 -0
  91. package/dist/index.d.ts +2 -0
  92. package/dist/locale.d.ts +1 -2
  93. package/dist/molad.d.ts +71 -1
  94. package/dist/moladBase.d.ts +15 -0
  95. package/dist/moladDate.d.ts +12 -0
  96. package/dist/omer.d.ts +0 -1
  97. package/dist/pkgVersion.d.ts +1 -1
  98. package/dist/po2json.js +3 -4
  99. package/dist/src/DailyLearning.d.ts +1 -1
  100. package/dist/src/HebrewDateEvent.js +4 -4
  101. package/dist/src/HolidayEvent.d.ts +1 -0
  102. package/dist/src/HolidayEvent.js +16 -0
  103. package/dist/src/MevarchimChodeshEvent.js +1 -0
  104. package/dist/src/ParshaEvent.js +1 -0
  105. package/dist/src/TimedEvent.js +8 -2
  106. package/dist/src/YomKippurKatanEvent.js +1 -0
  107. package/dist/src/ashkenazi.po.d.ts +14 -2
  108. package/dist/src/ashkenazi.po.js +1 -1
  109. package/dist/src/calendar.js +5 -7
  110. package/dist/src/candles.js +10 -2
  111. package/dist/src/event.js +17 -0
  112. package/dist/src/getStartAndEnd.js +1 -1
  113. package/dist/src/he.po.d.ts +20 -0
  114. package/dist/src/he.po.js +1 -1
  115. package/dist/src/hebcal.js +2 -2
  116. package/dist/src/holidays.js +2 -2
  117. package/dist/src/index.d.ts +2 -0
  118. package/dist/src/index.js +2 -0
  119. package/dist/src/locale.d.ts +1 -2
  120. package/dist/src/locale.js +1 -1
  121. package/dist/src/location.js +6 -0
  122. package/dist/src/molad.d.ts +71 -1
  123. package/dist/src/molad.js +112 -11
  124. package/dist/src/moladBase.d.ts +15 -0
  125. package/dist/src/moladBase.js +78 -0
  126. package/dist/src/moladDate.d.ts +12 -0
  127. package/dist/src/moladDate.js +58 -0
  128. package/dist/src/omer.d.ts +0 -1
  129. package/dist/src/omer.js +6 -3
  130. package/dist/src/parshaName.js +1 -1
  131. package/dist/src/pkgVersion.d.ts +1 -1
  132. package/dist/src/pkgVersion.js +1 -1
  133. package/dist/src/reformatTimeStr.js +4 -5
  134. package/dist/src/sedra.js +12 -6
  135. package/dist/src/tachanun.js +3 -3
  136. package/dist/src/zmanim.d.ts +114 -1
  137. package/dist/src/zmanim.js +240 -6
  138. package/dist/version.js +1 -2
  139. package/dist/zmanim.d.ts +114 -1
  140. package/package.json +17 -19
  141. package/dist/size-demo/dist/getHoliday.d.ts +0 -1944
  142. package/dist/size-demo/dist/getHoliday.js +0 -3712
  143. package/dist/size-demo/dist/parshiyot.js +0 -10662
  144. package/dist/size-demo/dist/sedra.d.ts +0 -1411
  145. package/dist/size-demo/dist/sedra.js +0 -2359
  146. package/dist/size-demo/dist/tachanun.d.ts +0 -1015
  147. package/dist/size-demo/dist/tachanun.js +0 -1755
  148. package/dist/size-demo/getHoliday.d.ts +0 -1
  149. package/dist/size-demo/getHoliday.js +0 -3
  150. package/dist/size-demo/parshiyot.d.ts +0 -1
  151. package/dist/size-demo/parshiyot.js +0 -11
  152. package/dist/size-demo/rollup.config.d.ts +0 -3
  153. package/dist/size-demo/rollup.config.js +0 -47
  154. package/dist/size-demo/sedra.d.ts +0 -1
  155. package/dist/size-demo/sedra.js +0 -3
  156. package/dist/size-demo/tachanun.d.ts +0 -1
  157. package/dist/size-demo/tachanun.js +0 -3
@@ -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';\n\nconst classicCities0: [string, string, number, number, string, number][] = [\n ['Ashdod', 'IL', 31.79213, 34.64966, 'Asia/Jerusalem', 27],\n ['Atlanta', 'US', 33.749, -84.38798, 'America/New_York', 336],\n ['Austin', 'US', 30.26715, -97.74306, 'America/Chicago', 165],\n ['Baghdad', 'IQ', 33.34058, 44.40088, 'Asia/Baghdad', 41],\n ['Beer Sheva', 'IL', 31.25181, 34.7913, 'Asia/Jerusalem', 285],\n ['Berlin', 'DE', 52.52437, 13.41053, 'Europe/Berlin', 43],\n ['Baltimore', 'US', 39.29038, -76.61219, 'America/New_York', 35],\n ['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],\n ['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],\n ['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],\n [\n 'Buenos Aires',\n 'AR',\n -34.61315,\n -58.37723,\n 'America/Argentina/Buenos_Aires',\n 31,\n ],\n ['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],\n ['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],\n ['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],\n ['Cleveland', 'US', 41.4995, -81.69541, 'America/New_York', 204],\n ['Dallas', 'US', 32.78306, -96.80667, 'America/Chicago', 139],\n ['Denver', 'US', 39.73915, -104.9847, 'America/Denver', 1636],\n ['Detroit', 'US', 42.33143, -83.04575, 'America/Detroit', 192],\n ['Eilat', 'IL', 29.55805, 34.94821, 'Asia/Jerusalem', 63],\n ['Gibraltar', 'GI', 36.14474, -5.35257, 'Europe/Gibraltar', 11],\n ['Haifa', 'IL', 32.81841, 34.9885, 'Asia/Jerusalem', 40],\n ['Hawaii', 'US', 21.30694, -157.85833, 'Pacific/Honolulu', 18],\n ['Helsinki', 'FI', 60.16952, 24.93545, 'Europe/Helsinki', 26],\n ['Houston', 'US', 29.76328, -95.36327, 'America/Chicago', 30],\n ['Jerusalem', 'IL', 31.76904, 35.21633, 'Asia/Jerusalem', 786],\n ['Johannesburg', 'ZA', -26.20227, 28.04363, 'Africa/Johannesburg', 1767],\n ['Kiev', 'UA', 50.45466, 30.5238, 'Europe/Kiev', 187],\n ['La Paz', 'BO', -16.5, -68.15, 'America/La_Paz', 3782],\n ['Livingston', 'US', 40.79593, -74.31487, 'America/New_York', 98],\n ['Las Vegas', 'US', 36.17497, -115.13722, 'America/Los_Angeles', 613],\n ['London', 'GB', 51.50853, -0.12574, 'Europe/London', 25],\n ['Los Angeles', 'US', 34.05223, -118.24368, 'America/Los_Angeles', 96],\n ['Marseilles', 'FR', 43.29695, 5.38107, 'Europe/Paris', 28],\n ['Miami', 'US', 25.77427, -80.19366, 'America/New_York', 25],\n ['Minneapolis', 'US', 44.97997, -93.26384, 'America/Chicago', 262],\n ['Melbourne', 'AU', -37.814, 144.96332, 'Australia/Melbourne', 25],\n ['Mexico City', 'MX', 19.42847, -99.12766, 'America/Mexico_City', 2240],\n ['Montreal', 'CA', 45.50884, -73.58781, 'America/Toronto', 216],\n ['Moscow', 'RU', 55.75222, 37.61556, 'Europe/Moscow', 144],\n ['New York', 'US', 40.71427, -74.00597, 'America/New_York', 57],\n ['Omaha', 'US', 41.25861, -95.93779, 'America/Chicago', 315],\n ['Ottawa', 'CA', 45.41117, -75.69812, 'America/Toronto', 71],\n ['Panama City', 'PA', 8.9936, -79.51973, 'America/Panama', 17],\n ['Paris', 'FR', 48.85341, 2.3488, 'Europe/Paris', 42],\n ['Pawtucket', 'US', 41.87871, -71.38256, 'America/New_York', 0], // -11\n ['Petach Tikvah', 'IL', 32.08707, 34.88747, 'Asia/Jerusalem', 54],\n ['Philadelphia', 'US', 39.95233, -75.16379, 'America/New_York', 8],\n ['Phoenix', 'US', 33.44838, -112.07404, 'America/Phoenix', 366],\n ['Pittsburgh', 'US', 40.44062, -79.99589, 'America/New_York', 239],\n ['Providence', 'US', 41.82399, -71.41283, 'America/New_York', 0], // -15\n ['Portland', 'US', 45.52345, -122.67621, 'America/Los_Angeles', 15],\n ['Saint Louis', 'US', 38.62727, -90.19789, 'America/Chicago', 149],\n ['Saint Petersburg', 'RU', 59.93863, 30.31413, 'Europe/Moscow', 11],\n ['San Diego', 'US', 32.71533, -117.15726, 'America/Los_Angeles', 20],\n ['San Francisco', 'US', 37.77493, -122.41942, 'America/Los_Angeles', 28],\n ['Sao Paulo', 'BR', -23.5475, -46.63611, 'America/Sao_Paulo', 769],\n ['Seattle', 'US', 47.60621, -122.33207, 'America/Los_Angeles', 56],\n ['Sydney', 'AU', -33.86785, 151.20732, 'Australia/Sydney', 58],\n ['Tel Aviv', 'IL', 32.08088, 34.78057, 'Asia/Jerusalem', 15],\n ['Tiberias', 'IL', 32.79221, 35.53124, 'Asia/Jerusalem', 0], // -140\n ['Toronto', 'CA', 43.70011, -79.4163, 'America/Toronto', 175],\n ['Vancouver', 'CA', 49.24966, -123.11934, 'America/Vancouver', 70],\n ['White Plains', 'US', 41.03399, -73.76291, 'America/New_York', 82],\n ['Washington DC', 'US', 38.89511, -77.03637, 'America/New_York', 6],\n ['Worcester', 'US', 42.26259, -71.80229, 'America/New_York', 164],\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 Map<string, Intl.DateTimeFormat>();\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\n/** Class representing Location */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\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 =\n 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 super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n this.geoid = geoid;\n }\n\n getIsrael(): boolean {\n return this.il;\n }\n\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name, up to the first comma\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 } else 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 getCountryCode(): string | undefined {\n return this.cc;\n }\n\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\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 * @param name\n */\n static lookup(name: string): Location | undefined {\n return classicCities.get(name.toLowerCase());\n }\n\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts legacy Hebcal timezone to a standard Olson tzid.\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 } else {\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n } else if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n } else 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 } else 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 } else if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n } else {\n return ZIPCODES_TZ_MAP[tz];\n }\n }\n\n /**\n * Adds a location name for `Location.lookup()` only if the name isn't\n * already being used. Returns `false` if the name is already taken\n * and `true` if successfully added.\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\nfor (const city of classicCities0) {\n const location = new Location(\n city[2],\n city[3],\n city[1] === 'IL',\n city[4],\n city[0],\n city[1],\n undefined,\n city[5]\n );\n Location.addLocation(city[0], location);\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAGH,MAAM,cAAc,GAAuD;IACzE,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,CAAC;AAC1D,IAAA,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,CAAC;AAC7D,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,CAAC;IAC7D,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,CAAC;IACzD,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC;IAC9D,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,CAAC;AACzD,IAAA,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC;AAChE,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC;AAC5D,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,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I,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;aAAO,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YACrC,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;aAAO;AACL,YAAA,OAAO,eAAe,CAAC,EAAE,CAAC;QAC5B;IACF;AAEA;;;;AAIG;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;AAED,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE;IACjC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAC3B,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAChB,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,SAAS,EACT,IAAI,CAAC,CAAC,CAAC,CACR;IACD,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;AACzC;;;;"}
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';\n\nconst classicCities0: [string, string, number, number, string, number][] = [\n ['Ashdod', 'IL', 31.79213, 34.64966, 'Asia/Jerusalem', 27],\n ['Atlanta', 'US', 33.749, -84.38798, 'America/New_York', 336],\n ['Austin', 'US', 30.26715, -97.74306, 'America/Chicago', 165],\n ['Baghdad', 'IQ', 33.34058, 44.40088, 'Asia/Baghdad', 41],\n ['Beer Sheva', 'IL', 31.25181, 34.7913, 'Asia/Jerusalem', 285],\n ['Berlin', 'DE', 52.52437, 13.41053, 'Europe/Berlin', 43],\n ['Baltimore', 'US', 39.29038, -76.61219, 'America/New_York', 35],\n ['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],\n ['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],\n ['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],\n [\n 'Buenos Aires',\n 'AR',\n -34.61315,\n -58.37723,\n 'America/Argentina/Buenos_Aires',\n 31,\n ],\n ['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],\n ['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],\n ['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],\n ['Cleveland', 'US', 41.4995, -81.69541, 'America/New_York', 204],\n ['Dallas', 'US', 32.78306, -96.80667, 'America/Chicago', 139],\n ['Denver', 'US', 39.73915, -104.9847, 'America/Denver', 1636],\n ['Detroit', 'US', 42.33143, -83.04575, 'America/Detroit', 192],\n ['Eilat', 'IL', 29.55805, 34.94821, 'Asia/Jerusalem', 63],\n ['Gibraltar', 'GI', 36.14474, -5.35257, 'Europe/Gibraltar', 11],\n ['Haifa', 'IL', 32.81841, 34.9885, 'Asia/Jerusalem', 40],\n ['Hawaii', 'US', 21.30694, -157.85833, 'Pacific/Honolulu', 18],\n ['Helsinki', 'FI', 60.16952, 24.93545, 'Europe/Helsinki', 26],\n ['Houston', 'US', 29.76328, -95.36327, 'America/Chicago', 30],\n ['Jerusalem', 'IL', 31.76904, 35.21633, 'Asia/Jerusalem', 786],\n ['Johannesburg', 'ZA', -26.20227, 28.04363, 'Africa/Johannesburg', 1767],\n ['Kiev', 'UA', 50.45466, 30.5238, 'Europe/Kiev', 187],\n ['La Paz', 'BO', -16.5, -68.15, 'America/La_Paz', 3782],\n ['Livingston', 'US', 40.79593, -74.31487, 'America/New_York', 98],\n ['Las Vegas', 'US', 36.17497, -115.13722, 'America/Los_Angeles', 613],\n ['London', 'GB', 51.50853, -0.12574, 'Europe/London', 25],\n ['Los Angeles', 'US', 34.05223, -118.24368, 'America/Los_Angeles', 96],\n ['Marseilles', 'FR', 43.29695, 5.38107, 'Europe/Paris', 28],\n ['Miami', 'US', 25.77427, -80.19366, 'America/New_York', 25],\n ['Minneapolis', 'US', 44.97997, -93.26384, 'America/Chicago', 262],\n ['Melbourne', 'AU', -37.814, 144.96332, 'Australia/Melbourne', 25],\n ['Mexico City', 'MX', 19.42847, -99.12766, 'America/Mexico_City', 2240],\n ['Montreal', 'CA', 45.50884, -73.58781, 'America/Toronto', 216],\n ['Moscow', 'RU', 55.75222, 37.61556, 'Europe/Moscow', 144],\n ['New York', 'US', 40.71427, -74.00597, 'America/New_York', 57],\n ['Omaha', 'US', 41.25861, -95.93779, 'America/Chicago', 315],\n ['Ottawa', 'CA', 45.41117, -75.69812, 'America/Toronto', 71],\n ['Panama City', 'PA', 8.9936, -79.51973, 'America/Panama', 17],\n ['Paris', 'FR', 48.85341, 2.3488, 'Europe/Paris', 42],\n ['Pawtucket', 'US', 41.87871, -71.38256, 'America/New_York', 0], // -11\n ['Petach Tikvah', 'IL', 32.08707, 34.88747, 'Asia/Jerusalem', 54],\n ['Philadelphia', 'US', 39.95233, -75.16379, 'America/New_York', 8],\n ['Phoenix', 'US', 33.44838, -112.07404, 'America/Phoenix', 366],\n ['Pittsburgh', 'US', 40.44062, -79.99589, 'America/New_York', 239],\n ['Providence', 'US', 41.82399, -71.41283, 'America/New_York', 0], // -15\n ['Portland', 'US', 45.52345, -122.67621, 'America/Los_Angeles', 15],\n ['Saint Louis', 'US', 38.62727, -90.19789, 'America/Chicago', 149],\n ['Saint Petersburg', 'RU', 59.93863, 30.31413, 'Europe/Moscow', 11],\n ['San Diego', 'US', 32.71533, -117.15726, 'America/Los_Angeles', 20],\n ['San Francisco', 'US', 37.77493, -122.41942, 'America/Los_Angeles', 28],\n ['Sao Paulo', 'BR', -23.5475, -46.63611, 'America/Sao_Paulo', 769],\n ['Seattle', 'US', 47.60621, -122.33207, 'America/Los_Angeles', 56],\n ['Sydney', 'AU', -33.86785, 151.20732, 'Australia/Sydney', 58],\n ['Tel Aviv', 'IL', 32.08088, 34.78057, 'Asia/Jerusalem', 15],\n ['Tiberias', 'IL', 32.79221, 35.53124, 'Asia/Jerusalem', 0], // -140\n ['Toronto', 'CA', 43.70011, -79.4163, 'America/Toronto', 175],\n ['Vancouver', 'CA', 49.24966, -123.11934, 'America/Vancouver', 70],\n ['White Plains', 'US', 41.03399, -73.76291, 'America/New_York', 82],\n ['Washington DC', 'US', 38.89511, -77.03637, 'America/New_York', 6],\n ['Worcester', 'US', 42.26259, -71.80229, 'America/New_York', 164],\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 Map<string, Intl.DateTimeFormat>();\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\n/** Class representing Location */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\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 =\n 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 this.geoid = geoid;\n }\n\n getIsrael(): boolean {\n return this.il;\n }\n\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name, up to the first comma\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 } else 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 getCountryCode(): string | undefined {\n return this.cc;\n }\n\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\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 * @param name\n */\n static lookup(name: string): Location | undefined {\n return classicCities.get(name.toLowerCase());\n }\n\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts legacy Hebcal timezone to a standard Olson tzid.\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 } else {\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n } else if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n } else 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 } else 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 } else if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n } else {\n return ZIPCODES_TZ_MAP[tz];\n }\n }\n\n /**\n * Adds a location name for `Location.lookup()` only if the name isn't\n * already being used. Returns `false` if the name is already taken\n * and `true` if successfully added.\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\nfor (const city of classicCities0) {\n const location = new Location(\n city[2],\n city[3],\n city[1] === 'IL',\n city[4],\n city[0],\n city[1],\n undefined,\n city[5]\n );\n Location.addLocation(city[0], location);\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAGH,MAAM,cAAc,GAAuD;IACzE,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,CAAC;AAC1D,IAAA,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,CAAC;AAC7D,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,CAAC;IAC7D,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,CAAC;IACzD,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC;IAC9D,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,CAAC;AACzD,IAAA,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC;AAChE,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC;AAC5D,IAAA,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC;IAC7D,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,Q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,EAAE,GAAW,EAAA;QACtD,EAAE,GAAG,CAAC,EAAE;QACR,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;aAAO,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YACrC,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;aAAO;AACL,YAAA,OAAO,eAAe,CAAC,EAAE,CAAC;QAC5B;IACF;AAEA;;;;AAIG;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;AAED,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE;IACjC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAC3B,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAChB,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,SAAS,EACT,IAAI,CAAC,CAAC,CAAC,CACR;IACD,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;AACzC;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.0.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.1.0, 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,3 +1,4 @@
1
+ import 'temporal-polyfill/global';
1
2
  import { Event } from './event';
2
3
  import { CalOptions } from './CalOptions';
3
4
  import { HDate } from '@hebcal/hdate';
@@ -7,19 +8,35 @@ import './locale';
7
8
  */
8
9
  export declare class Molad {
9
10
  private readonly m;
11
+ private readonly year;
12
+ private readonly month;
13
+ private instant?;
10
14
  /**
11
15
  * Calculates the molad for a Hebrew month
12
16
  * @param year
13
- * @param month
17
+ * @param month 1=NISSAN, 7=TISHREI
14
18
  */
15
19
  constructor(year: number, month: number);
16
20
  /**
21
+ * The exact Hebrew date of the molad, which often falls on the
22
+ * 28th or 30th of the preceeding month, occasionally on the first of the
23
+ * month, and in extremely rare circumstances the 27th of the month.
24
+ * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z
25
+ * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z
26
+ * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z
27
+ */
28
+ getMoladDate(): HDate;
29
+ /**
30
+ * The year of the molad (as constructed)
17
31
  */
18
32
  getYear(): number;
19
33
  /**
34
+ * The month (1=NISSAN, 7=TISHREI) as constructed
20
35
  */
21
36
  getMonth(): number;
22
37
  /**
38
+ * Returns a transliterated string name of the molad's Hebrew month,
39
+ * for example 'Elul' or 'Cheshvan'.
23
40
  */
24
41
  getMonthName(): string;
25
42
  /**
@@ -38,6 +55,59 @@ export declare class Molad {
38
55
  * @returns parts of a minute (0-17)
39
56
  */
40
57
  getChalakim(): number;
58
+ /**
59
+ * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.
60
+ * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
61
+ * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
62
+ * intentionally uses standard time and not daylight savings time.
63
+ *
64
+ * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)
65
+ */
66
+ getInstant(): Temporal.ZonedDateTime;
67
+ /**
68
+ * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time
69
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
70
+ * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
71
+ *
72
+ * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.
73
+ */
74
+ getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime;
75
+ /**
76
+ * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a
77
+ * href="https://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a>. See the <a
78
+ * href="https://en.wikipedia.org/wiki/Yoel_Sirkis">Bach's</a> opinion on this time. This method returns the time
79
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
80
+ * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
81
+ *
82
+ * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.
83
+ */
84
+ getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime;
85
+ /**
86
+ * Returns the latest time of Kiddush Levana according to the <a
87
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
88
+ * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and
89
+ * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time
90
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
91
+ * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.
92
+ *
93
+ * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.
94
+ */
95
+ getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime;
96
+ /**
97
+ * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down
98
+ * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
99
+ * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
100
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
101
+ * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber
102
+ * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid
103
+ * Heber's very detailed writeup in Siman Daled (chapter 4) of <a
104
+ * href="https://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>. This method returns the time even if it is during
105
+ * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_
106
+ * before this time if the zman is between _alos_ and _tzais_.
107
+ *
108
+ * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.
109
+ */
110
+ getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime;
41
111
  /**
42
112
  * @param [locale] Optional locale name (defaults to empty locale)
43
113
  * @param options
package/dist/esm/molad.js CHANGED
@@ -1,10 +1,12 @@
1
- /*! @hebcal/core v6.0.8, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.1.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ import 'temporal-polyfill/global';
2
3
  import { Event, flags } from './event.js';
3
- import { molad, HDate, Locale, pad2 } from '@hebcal/hdate';
4
+ import { HDate, Locale, pad2 } from '@hebcal/hdate';
4
5
  import { reformatTimeStr } from './reformatTimeStr.js';
6
+ import { calculateMolad } from './moladBase.js';
7
+ import { getMoladAsDate } from './moladDate.js';
5
8
  import './locale.js';
6
9
 
7
- /* eslint-disable camelcase */
8
10
  const enDoW = [
9
11
  'Sunday',
10
12
  'Monday',
@@ -57,34 +59,55 @@ function getHebrewTimeOfDay(hour) {
57
59
  * Represents a molad, the moment when the new moon is "born"
58
60
  */
59
61
  class Molad {
62
+ m;
63
+ year;
64
+ month;
65
+ instant;
60
66
  /**
61
67
  * Calculates the molad for a Hebrew month
62
68
  * @param year
63
- * @param month
69
+ * @param month 1=NISSAN, 7=TISHREI
64
70
  */
65
71
  constructor(year, month) {
66
- this.m = molad(year, month);
72
+ this.m = calculateMolad(year, month);
73
+ this.year = year;
74
+ this.month = month;
67
75
  }
68
76
  /**
77
+ * The exact Hebrew date of the molad, which often falls on the
78
+ * 28th or 30th of the preceeding month, occasionally on the first of the
79
+ * month, and in extremely rare circumstances the 27th of the month.
80
+ * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z
81
+ * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z
82
+ * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z
83
+ */
84
+ getMoladDate() {
85
+ return this.m.hdate;
86
+ }
87
+ /**
88
+ * The year of the molad (as constructed)
69
89
  */
70
90
  getYear() {
71
- return this.m.year;
91
+ return this.year;
72
92
  }
73
93
  /**
94
+ * The month (1=NISSAN, 7=TISHREI) as constructed
74
95
  */
75
96
  getMonth() {
76
- return this.m.month;
97
+ return this.month;
77
98
  }
78
99
  /**
100
+ * Returns a transliterated string name of the molad's Hebrew month,
101
+ * for example 'Elul' or 'Cheshvan'.
79
102
  */
80
103
  getMonthName() {
81
- return HDate.getMonthName(this.m.month, this.m.year);
104
+ return HDate.getMonthName(this.month, this.year);
82
105
  }
83
106
  /**
84
107
  * @returns Day of Week (0=Sunday, 6=Saturday)
85
108
  */
86
109
  getDow() {
87
- return this.m.dayOfWeek;
110
+ return this.m.hdate.getDay();
88
111
  }
89
112
  /**
90
113
  * @returns hour of day (0-23)
@@ -104,13 +127,89 @@ class Molad {
104
127
  getChalakim() {
105
128
  return this.m.chalakim;
106
129
  }
130
+ /**
131
+ * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.
132
+ * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
133
+ * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
134
+ * intentionally uses standard time and not daylight savings time.
135
+ *
136
+ * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)
137
+ */
138
+ getInstant() {
139
+ this.instant ??= getMoladAsDate(this.m);
140
+ return this.instant;
141
+ }
142
+ /**
143
+ * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time
144
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
145
+ * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
146
+ *
147
+ * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.
148
+ */
149
+ getTchilasZmanKidushLevana3Days() {
150
+ const zdt = this.getInstant();
151
+ return zdt.add({ hours: 72 });
152
+ }
153
+ /**
154
+ * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a
155
+ * href="https://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a>. See the <a
156
+ * href="https://en.wikipedia.org/wiki/Yoel_Sirkis">Bach's</a> opinion on this time. This method returns the time
157
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
158
+ * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
159
+ *
160
+ * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.
161
+ */
162
+ getTchilasZmanKidushLevana7Days() {
163
+ const zdt = this.getInstant();
164
+ return zdt.add({ hours: 168 });
165
+ }
166
+ /**
167
+ * Returns the latest time of Kiddush Levana according to the <a
168
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
169
+ * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and
170
+ * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time
171
+ * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
172
+ * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.
173
+ *
174
+ * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.
175
+ */
176
+ getSofZmanKidushLevanaBetweenMoldos() {
177
+ const zdt = this.getInstant();
178
+ // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3
179
+ // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid
180
+ // DST/ST crossover issues.
181
+ return zdt.add({
182
+ hours: 24 * 14 + 18,
183
+ minutes: 22,
184
+ seconds: 1,
185
+ milliseconds: 666,
186
+ });
187
+ }
188
+ /**
189
+ * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down
190
+ * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
191
+ * <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
192
+ * href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
193
+ * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber
194
+ * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid
195
+ * Heber's very detailed writeup in Siman Daled (chapter 4) of <a
196
+ * href="https://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>. This method returns the time even if it is during
197
+ * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_
198
+ * before this time if the zman is between _alos_ and _tzais_.
199
+ *
200
+ * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.
201
+ */
202
+ getSofZmanKidushLevana15Days() {
203
+ const zdt = this.getInstant();
204
+ // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.
205
+ return zdt.add({ hours: 24 * 15 });
206
+ }
107
207
  /**
108
208
  * @param [locale] Optional locale name (defaults to empty locale)
109
209
  * @param options
110
210
  */
111
211
  render(locale, options) {
112
- var _a;
113
- locale = locale !== null && locale !== void 0 ? locale : 'en';
212
+ locale = locale ?? 'en';
114
213
  if (typeof locale === 'string') {
115
214
  locale = locale.toLowerCase();
116
215
  }
@@ -122,7 +221,7 @@ class Molad {
122
221
  const hour = this.getHour();
123
222
  const chalakim = this.getChalakim();
124
223
  const moladStr = Locale.gettext('Molad', locale);
125
- const minutesStr = (_a = Locale.lookupTranslation('min', locale)) !== null && _a !== void 0 ? _a : 'minutes';
224
+ const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';
126
225
  const chalakimStr = Locale.gettext('chalakim', locale);
127
226
  const and = Locale.gettext('and', locale);
128
227
  if (isHebrewLocale) {
@@ -149,6 +248,8 @@ class Molad {
149
248
  }
150
249
  /** Represents a Molad announcement on Shabbat Mevarchim */
151
250
  class MoladEvent extends Event {
251
+ molad;
252
+ options;
152
253
  /**
153
254
  * @param date Hebrew date event occurs
154
255
  * @param hyear molad year
@@ -1 +1 @@
1
- {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, molad, Molad as MoladBase, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale: string): readonly string[] {\n if (locale === 'he' || locale === 'he-x-nonikud' || locale === 'h') {\n return heDayNames;\n } else if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n else if (hour < 12) return 'בַּבֹּקֶר';\n else if (hour < 17) return 'בַּצׇּהֳרַיִים';\n else if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport class Molad {\n private readonly m: MoladBase;\n /**\n * Calculates the molad for a Hebrew month\n * @param year\n * @param month\n */\n constructor(year: number, month: number) {\n this.m = molad(year, month);\n }\n /**\n */\n getYear(): number {\n return this.m.year;\n }\n /**\n */\n getMonth(): number {\n return this.m.month;\n }\n /**\n */\n getMonthName(): string {\n return HDate.getMonthName(this.m.month, this.m.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.dayOfWeek;\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options\n */\n render(locale?: string, options?: CalOptions): string {\n locale = locale ?? 'en';\n if (typeof locale === 'string') {\n locale = locale.toLowerCase();\n }\n const isHebrewLocale =\n locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (isHebrewLocale) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = monthName.replace(/'/g, '’');\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;AAOA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA;AACV,MAAM,KAAK,GAAG,cAAc;AAE5B,SAAS,WAAW,CAAC,MAAc,EAAA;AACjC,IAAA,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,cAAc,IAAI,MAAM,KAAK,GAAG,EA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,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
1
+ {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {MoladBase, calculateMolad} from './moladBase';\nimport {getMoladAsDate} from './moladDate';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale: string): readonly string[] {\n if (locale === 'he' || locale === 'he-x-nonikud' || locale === 'h') {\n return heDayNames;\n } else if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n else if (hour < 12) return 'בַּבֹּקֶר';\n else if (hour < 17) return 'בַּצׇּהֳרַיִים';\n else if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a Hebrew month\n * @param year\n * @param month 1=NISSAN, 7=TISHREI\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.\n * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude\n * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method\n * intentionally uses standard time and not daylight savings time.\n *\n * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a\n * href=\"https://en.wikipedia.org/wiki/Yosef_Karo\">Mechaber</a>. See the <a\n * href=\"https://en.wikipedia.org/wiki/Yoel_Sirkis\">Bach's</a> opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * <a href=\"https://en.wikipedia.org/wiki/Moses_Isserles\">Rema</a> who brings down the opinion of the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of <a\n * href=\"https://www.worldcat.org/oclc/461326125\">Shaarei Zmanim</a>. This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options\n */\n render(locale?: string, options?: CalOptions): string {\n locale = locale ?? 'en';\n if (typeof locale === 'string') {\n locale = locale.toLowerCase();\n }\n const isHebrewLocale =\n locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (isHebrewLocale) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = monthName.replace(/'/g, '’');\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAA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;AAClC,QAAA,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE;AAClC,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
@@ -0,0 +1,15 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ /**
3
+ * Represents a molad, the moment when the new moon is "born"
4
+ */
5
+ export type MoladBase = {
6
+ /** Hebrew date */
7
+ readonly hdate: HDate;
8
+ /** hour of day (0-23) */
9
+ readonly hour: number;
10
+ /** minutes past hour (0-59) */
11
+ readonly minutes: number;
12
+ /** parts of a minute (0-17) */
13
+ readonly chalakim: number;
14
+ };
15
+ export declare function calculateMolad(year: number, month: number): MoladBase;
@@ -0,0 +1,83 @@
1
+ /*! @hebcal/core v6.1.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ import { HDate, isLeapYear } from '@hebcal/hdate';
3
+
4
+ /*
5
+ * Includes code ported from KosherJava, copyright 2004 Eliyahu Hershfeld,
6
+ * released under LGPL 2.1.
7
+ */
8
+ /**
9
+ * the Jewish epoch using the RD (Rata Die/Fixed Date or Reingold Dershowitz) day used in Calendrical Calculations.
10
+ * Day 1 is January 1, 0001 of the Gregorian calendar
11
+ */
12
+ const JEWISH_EPOCH = -1373429;
13
+ /** The number of _chalakim_ (18) in a minute. */
14
+ const CHALAKIM_PER_MINUTE = 18;
15
+ /** The number of _chalakim_ (1080) in an hour. */
16
+ const CHALAKIM_PER_HOUR = 1080;
17
+ /** The number of _chalakim_ (25,920) in a 24-hour day. */
18
+ const CHALAKIM_PER_DAY = 25920; // 24 * 1080
19
+ /** The number of _chalakim_ in an average Jewish month. A month has 29 days, 12 hours and 793
20
+ * _chalakim_ (44 minutes and 3.3 seconds) for a total of 765,433 _chalakim_ */
21
+ const CHALAKIM_PER_MONTH = 765433; // (29 * 24 + 12) * 1080 + 793
22
+ /**
23
+ * Days from the beginning of Sunday till _molad BaHaRaD_. Calculated as 1 day, 5 hours and 204 _chalakim_ =
24
+ * (24 + 5) * 1080 + 204 = 31524
25
+ */
26
+ const CHALAKIM_MOLAD_TOHU = 31524;
27
+ /**
28
+ * Converts the NISSAN-based constants used by this class to numeric month starting from
29
+ * TISHREI. This is required for _molad_ calculations.
30
+ */
31
+ function getJewishMonthOfYear(year, month) {
32
+ const leap = isLeapYear(year);
33
+ return ((month + (leap ? 6 : 5)) % (leap ? 13 : 12)) + 1;
34
+ }
35
+ /**
36
+ * Returns the number of _chalakim_ (parts - 1080 to the hour) from
37
+ * the original hypothetical _Molad Tohu_ to the year and month
38
+ * passed in.
39
+ */
40
+ function getChalakimSinceMoladTohu(year, month) {
41
+ // Jewish lunar month = 29 days, 12 hours and 793 chalakim
42
+ // chalakim since Molad Tohu BeHaRaD - 1 day, 5 hours and 204 chalakim
43
+ const monthOfYear = getJewishMonthOfYear(year, month);
44
+ const monthsElapsed = 235 * Math.trunc((year - 1) / 19) + // Months in complete 19-year lunar (Metonic) cycles so far
45
+ 12 * ((year - 1) % 19) + // Regular months in this cycle
46
+ Math.trunc((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle
47
+ (monthOfYear - 1); // add elapsed months till the start of the molad of the month
48
+ // return chalakim prior to BeHaRaD + number of chalakim since
49
+ return CHALAKIM_MOLAD_TOHU + CHALAKIM_PER_MONTH * monthsElapsed;
50
+ }
51
+ /**
52
+ * Returns the number of days from the Jewish epoch from the number of chalakim from the epoch passed in.
53
+ * @param chalakim the number of _chalakim_ since the beginning of Sunday prior to BaHaRaD
54
+ * @return the number of days from the Jewish epoch
55
+ */
56
+ function moladToAbsDate(chalakim) {
57
+ return Math.trunc(chalakim / CHALAKIM_PER_DAY) + JEWISH_EPOCH;
58
+ }
59
+ function calculateMolad(year, month) {
60
+ const chalakim = getChalakimSinceMoladTohu(year, month);
61
+ const absDate = moladToAbsDate(chalakim);
62
+ let hd = new HDate(absDate);
63
+ const conjunctionDay = Math.trunc(chalakim / CHALAKIM_PER_DAY);
64
+ const conjunctionParts = Math.trunc(chalakim - conjunctionDay * CHALAKIM_PER_DAY);
65
+ let adjustedChalakim = conjunctionParts;
66
+ let hour = Math.trunc(adjustedChalakim / CHALAKIM_PER_HOUR);
67
+ adjustedChalakim = adjustedChalakim - hour * CHALAKIM_PER_HOUR;
68
+ const minutes = Math.trunc(adjustedChalakim / CHALAKIM_PER_MINUTE);
69
+ if (hour >= 6) {
70
+ hd = hd.next();
71
+ }
72
+ hour = (hour + 18) % 24;
73
+ const m = {
74
+ hdate: hd,
75
+ hour,
76
+ minutes,
77
+ chalakim: adjustedChalakim - minutes * CHALAKIM_PER_MINUTE,
78
+ };
79
+ return m;
80
+ }
81
+
82
+ export { calculateMolad };
83
+ //# sourceMappingURL=moladBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moladBase.js","sources":["../../../src/moladBase.ts"],"sourcesContent":["import {HDate, isLeapYear} from '@hebcal/hdate';\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport type MoladBase = {\n /** Hebrew date */\n readonly hdate: HDate;\n /** hour of day (0-23) */\n readonly hour: number;\n /** minutes past hour (0-59) */\n readonly minutes: number;\n /** parts of a minute (0-17) */\n readonly chalakim: number;\n};\n\n/*\n * Includes code ported from KosherJava, copyright 2004 Eliyahu Hershfeld,\n * released under LGPL 2.1.\n */\n\n/**\n * the Jewish epoch using the RD (Rata Die/Fixed Date or Reingold Dershowitz) day used in Calendrical Calculations.\n * Day 1 is January 1, 0001 of the Gregorian calendar\n */\nconst JEWISH_EPOCH: number = -1373429;\n\n/** The number of _chalakim_ (18) in a minute. */\nconst CHALAKIM_PER_MINUTE: number = 18;\n\n/** The number of _chalakim_ (1080) in an hour. */\nconst CHALAKIM_PER_HOUR: number = 1080;\n\n/** The number of _chalakim_ (25,920) in a 24-hour day. */\nconst CHALAKIM_PER_DAY: number = 25920; // 24 * 1080\n\n/** The number of _chalakim_ in an average Jewish month. A month has 29 days, 12 hours and 793\n * _chalakim_ (44 minutes and 3.3 seconds) for a total of 765,433 _chalakim_ */\nconst CHALAKIM_PER_MONTH: number = 765433; // (29 * 24 + 12) * 1080 + 793\n\n/**\n * Days from the beginning of Sunday till _molad BaHaRaD_. Calculated as 1 day, 5 hours and 204 _chalakim_ =\n * (24 + 5) * 1080 + 204 = 31524\n */\nconst CHALAKIM_MOLAD_TOHU: number = 31524;\n\n/**\n * Converts the NISSAN-based constants used by this class to numeric month starting from\n * TISHREI. This is required for _molad_ calculations.\n */\nfunction getJewishMonthOfYear(year: number, month: number): number {\n const leap: boolean = isLeapYear(year);\n return ((month + (leap ? 6 : 5)) % (leap ? 13 : 12)) + 1;\n}\n\n/**\n * Returns the number of _chalakim_ (parts - 1080 to the hour) from\n * the original hypothetical _Molad Tohu_ to the year and month\n * passed in.\n */\nfunction getChalakimSinceMoladTohu(year: number, month: number): number {\n // Jewish lunar month = 29 days, 12 hours and 793 chalakim\n // chalakim since Molad Tohu BeHaRaD - 1 day, 5 hours and 204 chalakim\n const monthOfYear: number = getJewishMonthOfYear(year, month);\n const monthsElapsed: number =\n 235 * Math.trunc((year - 1) / 19) + // Months in complete 19-year lunar (Metonic) cycles so far\n 12 * ((year - 1) % 19) + // Regular months in this cycle\n Math.trunc((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle\n (monthOfYear - 1); // add elapsed months till the start of the molad of the month\n // return chalakim prior to BeHaRaD + number of chalakim since\n return CHALAKIM_MOLAD_TOHU + CHALAKIM_PER_MONTH * monthsElapsed;\n}\n\n/**\n * Returns the number of days from the Jewish epoch from the number of chalakim from the epoch passed in.\n * @param chalakim the number of _chalakim_ since the beginning of Sunday prior to BaHaRaD\n * @return the number of days from the Jewish epoch\n */\nfunction moladToAbsDate(chalakim: number): number {\n return Math.trunc(chalakim / CHALAKIM_PER_DAY) + JEWISH_EPOCH;\n}\n\nexport function calculateMolad(year: number, month: number): MoladBase {\n const chalakim = getChalakimSinceMoladTohu(year, month);\n const absDate = moladToAbsDate(chalakim);\n let hd = new HDate(absDate);\n const conjunctionDay: number = Math.trunc(chalakim / CHALAKIM_PER_DAY);\n const conjunctionParts: number = Math.trunc(\n chalakim - conjunctionDay * CHALAKIM_PER_DAY\n );\n\n let adjustedChalakim: number = conjunctionParts;\n let hour = Math.trunc(adjustedChalakim / CHALAKIM_PER_HOUR);\n adjustedChalakim = adjustedChalakim - hour * CHALAKIM_PER_HOUR;\n const minutes = Math.trunc(adjustedChalakim / CHALAKIM_PER_MINUTE);\n\n if (hour >= 6) {\n hd = hd.next();\n }\n hour = (hour + 18) % 24;\n\n const m: MoladBase = {\n hdate: hd,\n hour,\n minutes,\n chalakim: adjustedChalakim - minutes * CHALAKIM_PER_MINUTE,\n };\n\n return m;\n}\n"],"names":[],"mappings":";;;AAgBA;;;AAGG;AAEH;;;AAGG;AACH,MAAM,YAAY,GAAW,QAAQ;AAErC;AACA,MAAM,mBAAmB,GAAW,EAAE;AAEtC;AACA,MAAM,iBAAiB,GAAW,IAAI;AAEtC;AACA,MAAM,gBAAgB,GAAW,KAAK,CAAC;AAEvC;AAC+E;AAC/E,MAAM,kBAAkB,GAAW,MAAM,CAAC;AAE1C;;;AAGG;AACH,MAAM,mBAAmB,GAAW,KAAK;AAEzC;;;AAGG;AACH,SAAS,oBAAoB,CAAC,IAAY,EAAE,KAAa,EAAA;AACvD,IAAA,MAAM,IAAI,GAAY,UAAU,CAAC,IAAI,CAAC;AACtC,IAAA,OAAO,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,G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AA,gBAAgB,GAAG,gBAAgB,GAAG,IAAI,GAAG,iBAAiB;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAElE,IAAA,IAAI,IAAI,IAAI,CAAC,EAAE;AACb,QAAA,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;IAChB;IACA,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE;AAEvB,IAAA,MAAM,CAAC,GAAc;AACnB,QAAA,KAAK,EAAE,EAAE;QACT,IAAI;QACJ,OAAO;AACP,QAAA,QAAQ,EAAE,gBAAgB,GAAG,OAAO,GAAG,mBAAmB;KAC3D;AAED,IAAA,OAAO,CAAC;AACV;;;;"}
@@ -0,0 +1,12 @@
1
+ import 'temporal-polyfill/global';
2
+ import { MoladBase } from './moladBase';
3
+ /**
4
+ * Returns the molad in UTC as a Temporal.ZonedDateTime.
5
+ * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
6
+ * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
7
+ * intentionally uses standard time and not daylight savings time.
8
+ *
9
+ * @return the ZonedDateTime representing the moment of the molad in UTC
10
+
11
+ */
12
+ export declare function getMoladAsDate(molad: MoladBase): Temporal.ZonedDateTime;