@hebcal/core 5.3.11 → 5.3.13

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.
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
3
+ * Calculations are available for tzeit / tzais (nightfall),
4
+ * shkiah (sunset) and more.
5
+ *
6
+ * Zmanim are estimated using an algorithm published by the US National Oceanic
7
+ * and Atmospheric Administration. The NOAA solar calculator is based on equations
8
+ * from _Astronomical Algorithms_ by Jean Meeus.
9
+ *
10
+ * The sunrise and sunset results are theoretically accurate to within a minute for
11
+ * locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.
12
+ * However, due to variations in atmospheric composition, temperature, pressure and
13
+ * conditions, observed values may vary from calculations.
14
+ * https://gml.noaa.gov/grad/solcalc/calcdetails.html
15
+ *
16
+ * @example
17
+ * const {GeoLocation, Zmanim} = require('@hebcal/core');
18
+ * const latitude = 41.822232;
19
+ * const longitude = -71.448292;
20
+ * const tzid = 'America/New_York';
21
+ * const friday = new Date(2023, 8, 8);
22
+ * const gloc = new GeoLocation(null, latitude, longitude, 0, tzid);
23
+ * const zmanim = new Zmanim(gloc, friday, false);
24
+ * const candleLighting = zmanim.sunsetOffset(-18, true);
25
+ * const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
26
+ */
27
+ export class Zmanim {
28
+ /**
29
+ * Uses timeFormat to return a date like '20:34'
30
+ * @param {Date} dt
31
+ * @param {Intl.DateTimeFormat} timeFormat
32
+ * @return {string}
33
+ */
34
+ static formatTime(dt: Date, timeFormat: Intl.DateTimeFormat): string;
35
+ /**
36
+ * Discards seconds, rounding to nearest minute.
37
+ * @param {Date} dt
38
+ * @return {Date}
39
+ */
40
+ static roundTime(dt: Date): Date;
41
+ /**
42
+ * Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")
43
+ * @param {string} tzid
44
+ * @param {Date} date
45
+ * @return {string}
46
+ */
47
+ static timeZoneOffset(tzid: string, date: Date): string;
48
+ /**
49
+ * Returns a string like "2022-04-01T13:06:00-11:00"
50
+ * @param {string} tzid
51
+ * @param {Date} date
52
+ * @return {string}
53
+ */
54
+ static formatISOWithTimeZone(tzid: string, date: Date): string;
55
+ /**
56
+ * Initialize a Zmanim instance.
57
+ * @param {GeoLocation} gloc GeoLocation including latitude, longitude, and timezone
58
+ * @param {Date|HDate} date Regular or Hebrew Date. If `date` is a regular `Date`,
59
+ * hours, minutes, seconds and milliseconds are ignored.
60
+ * @param {boolean} useElevation use elevation for calculations (default `false`).
61
+ * If `true`, use elevation to affect the calculation of all sunrise/sunset based
62
+ * zmanim. Note: there are some zmanim such as degree-based zmanim that are driven
63
+ * by the amount of light in the sky and are not impacted by elevation.
64
+ * These zmanim intentionally do not support elevation adjustment.
65
+ */
66
+ constructor(gloc: GeoLocation, date: Date | HDate, useElevation: boolean);
67
+ date: any;
68
+ gloc: GeoLocation;
69
+ noaa: NOAACalculator;
70
+ useElevation: boolean;
71
+ /**
72
+ * Returns `true` if elevation adjustment is enabled
73
+ * for zmanim support elevation adjustment
74
+ * @return {boolean}
75
+ */
76
+ getUseElevation(): boolean;
77
+ /**
78
+ * Enables or disables elevation adjustment for zmanim support elevation adjustment
79
+ * @param {boolean} useElevation
80
+ */
81
+ setUseElevation(useElevation: boolean): void;
82
+ /**
83
+ * Convenience function to get the time when sun is above or below the horizon
84
+ * for a certain angle (in degrees).
85
+ * This function does not support elevation adjustment.
86
+ * @param {number} angle
87
+ * @param {boolean} rising
88
+ * @return {Date}
89
+ */
90
+ timeAtAngle(angle: number, rising: boolean): Date;
91
+ /**
92
+ * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon)
93
+ * If elevation is enabled, this function will include elevation in the calculation.
94
+ * @return {Date}
95
+ */
96
+ sunrise(): Date;
97
+ /**
98
+ * Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon).
99
+ * This function does not support elevation adjustment.
100
+ * @return {Date}
101
+ */
102
+ seaLevelSunrise(): Date;
103
+ /**
104
+ * When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
105
+ * If elevation is enabled, this function will include elevation in the calculation.
106
+ * @return {Date}
107
+ */
108
+ sunset(): Date;
109
+ /**
110
+ * When the upper edge of the Sun disappears below the horizon (0.833° below horizon).
111
+ * This function does not support elevation adjustment.
112
+ * @return {Date}
113
+ */
114
+ seaLevelSunset(): Date;
115
+ /**
116
+ * Civil dawn; Sun is 6° below the horizon in the morning.
117
+ * Because degree-based functions estimate the amount of light in the sky,
118
+ * the result is not impacted by elevation.
119
+ * @return {Date}
120
+ */
121
+ dawn(): Date;
122
+ /**
123
+ * Civil dusk; Sun is 6° below the horizon in the evening.
124
+ * Because degree-based functions estimate the amount of light in the sky,
125
+ * the result is not impacted by elevation.
126
+ * @return {Date}
127
+ */
128
+ dusk(): Date;
129
+ /**
130
+ * Returns sunset for the previous day.
131
+ * If elevation is enabled, this function will include elevation in the calculation.
132
+ * @return {Date}
133
+ */
134
+ gregEve(): Date;
135
+ /**
136
+ * @private
137
+ * @return {number}
138
+ */
139
+ private nightHour;
140
+ /**
141
+ * Midday – Chatzot; Sunrise plus 6 halachic hours
142
+ * @return {Date}
143
+ */
144
+ chatzot(): Date;
145
+ /**
146
+ * Midnight – Chatzot; Sunset plus 6 halachic hours.
147
+ * If elevation is enabled, this function will include elevation in the calculation.
148
+ * @return {Date}
149
+ */
150
+ chatzotNight(): Date;
151
+ /**
152
+ * Dawn – Alot haShachar; Sun is 16.1° below the horizon in the morning.
153
+ * Because degree-based functions estimate the amount of light in the sky,
154
+ * the result is not impacted by elevation.
155
+ * @return {Date}
156
+ */
157
+ alotHaShachar(): Date;
158
+ /**
159
+ * Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
160
+ * Because degree-based functions estimate the amount of light in the sky,
161
+ * the result is not impacted by elevation.
162
+ * @return {Date}
163
+ */
164
+ misheyakir(): Date;
165
+ /**
166
+ * Earliest talis & tefillin – Misheyakir Machmir; Sun is 10.2° below the horizon in the morning.
167
+ * Because degree-based functions estimate the amount of light in the sky,
168
+ * the result is not impacted by elevation.
169
+ * @return {Date}
170
+ */
171
+ misheyakirMachmir(): Date;
172
+ /**
173
+ * Utility method for using elevation-aware sunrise/sunset
174
+ * @private
175
+ * @param {number} hours
176
+ * @return {Date}
177
+ */
178
+ private getShaahZmanisBasedZman;
179
+ /**
180
+ * Latest Shema (Gra); Sunrise plus 3 halachic hours, according to the Gra.
181
+ * If elevation is enabled, this function will include elevation in the calculation.
182
+ * @return {Date}
183
+ */
184
+ sofZmanShma(): Date;
185
+ /**
186
+ * Latest Shacharit (Gra); Sunrise plus 4 halachic hours, according to the Gra.
187
+ * If elevation is enabled, this function will include elevation in the calculation.
188
+ * @return {Date}
189
+ */
190
+ sofZmanTfilla(): Date;
191
+ /**
192
+ * Returns an array with alot (Date) and ms in hour (number)
193
+ * @private
194
+ * @return {any[]}
195
+ */
196
+ private getTemporalHour72;
197
+ /**
198
+ * Returns an array with alot (Date) and ms in hour (number)
199
+ * @private
200
+ * @param {number} angle
201
+ * @return {any[]}
202
+ */
203
+ private getTemporalHourByDeg;
204
+ /**
205
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
206
+ * Based on the opinion of the MGA that the day is calculated from
207
+ * dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
208
+ * 72 minutes after sea-level sunset.
209
+ * @return {Date}
210
+ */
211
+ sofZmanShmaMGA(): Date;
212
+ /**
213
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
214
+ * Based on the opinion of the MGA that the day is calculated from
215
+ * dawn to nightfall with both being 16.1° below the horizon.
216
+ * @return {Date}
217
+ */
218
+ sofZmanShmaMGA16Point1(): Date;
219
+ /**
220
+ * Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
221
+ * Based on the opinion of the MGA that the day is calculated from
222
+ * dawn to nightfall with both being 19.8° below the horizon.
223
+ *
224
+ * This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
225
+ * around the equinox / equilux which calculates to 19.8° below geometric zenith.
226
+ * https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
227
+ * @return {Date}
228
+ */
229
+ sofZmanShmaMGA19Point8(): Date;
230
+ /**
231
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
232
+ * @return {Date}
233
+ */
234
+ sofZmanTfillaMGA(): Date;
235
+ /**
236
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
237
+ * Based on the opinion of the MGA that the day is calculated from
238
+ * dawn to nightfall with both being 16.1° below the horizon.
239
+ * @return {Date}
240
+ */
241
+ sofZmanTfillaMGA16Point1(): Date;
242
+ /**
243
+ * Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
244
+ * Based on the opinion of the MGA that the day is calculated from
245
+ * dawn to nightfall with both being 19.8° below the horizon.
246
+ *
247
+ * This calculation is based on the position of the sun 90 minutes after sunset in Jerusalem
248
+ * around the equinox / equilux which calculates to 19.8° below geometric zenith.
249
+ * https://kosherjava.com/2022/01/12/equinox-vs-equilux-zmanim-calculations/
250
+ * @return {Date}
251
+ */
252
+ sofZmanTfillaMGA19Point8(): Date;
253
+ /**
254
+ * Earliest Mincha – Mincha Gedola; Sunrise plus 6.5 halachic hours.
255
+ * If elevation is enabled, this function will include elevation in the calculation.
256
+ * @return {Date}
257
+ */
258
+ minchaGedola(): Date;
259
+ /**
260
+ * Preferable earliest time to recite Minchah – Mincha Ketana; Sunrise plus 9.5 halachic hours.
261
+ * If elevation is enabled, this function will include elevation in the calculation.
262
+ * @return {Date}
263
+ */
264
+ minchaKetana(): Date;
265
+ /**
266
+ * Plag haMincha; Sunrise plus 10.75 halachic hours.
267
+ * If elevation is enabled, this function will include elevation in the calculation.
268
+ * @return {Date}
269
+ */
270
+ plagHaMincha(): Date;
271
+ /**
272
+ * @param {number} [angle=8.5] optional time for solar depression.
273
+ * Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
274
+ * Because degree-based functions estimate the amount of light in the sky,
275
+ * the result is not impacted by elevation.
276
+ * @return {Date}
277
+ */
278
+ tzeit(angle?: number | undefined): Date;
279
+ /**
280
+ * Alias for sunrise
281
+ * @return {Date}
282
+ */
283
+ neitzHaChama(): Date;
284
+ /**
285
+ * Alias for sunset
286
+ * @return {Date}
287
+ */
288
+ shkiah(): Date;
289
+ /**
290
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
291
+ * between sunset and tzeis hakochavim.
292
+ * One opinion on how to calculate this time is that
293
+ * it is 13.5 minutes before tzies 7.083.
294
+ * Because degree-based functions estimate the amount of light in the sky,
295
+ * the result is not impacted by elevation.
296
+ * @return {Date}
297
+ */
298
+ beinHaShmashos(): Date;
299
+ /**
300
+ * Returns sunrise + `offset` minutes (either positive or negative).
301
+ * If elevation is enabled, this function will include elevation in the calculation
302
+ * unless `forceSeaLevel` is `true`.
303
+ * @param {number} offset minutes
304
+ * @param {boolean} roundMinute round time to nearest minute (default true)
305
+ * @param {boolean} forceSeaLevel use sea-level sunrise (default false)
306
+ * @return {Date}
307
+ */
308
+ sunriseOffset(offset: number, roundMinute?: boolean, forceSeaLevel?: boolean): Date;
309
+ /**
310
+ * Returns sunset + `offset` minutes (either positive or negative).
311
+ * If elevation is enabled, this function will include elevation in the calculation
312
+ * unless `forceSeaLevel` is `true`.
313
+ * @param {number} offset minutes
314
+ * @param {boolean} roundMinute round time to nearest minute (default true)
315
+ * @param {boolean} forceSeaLevel use sea-level sunset (default false)
316
+ * @return {Date}
317
+ */
318
+ sunsetOffset(offset: number, roundMinute?: boolean, forceSeaLevel?: boolean): Date;
319
+ }
320
+ import { NOAACalculator } from '@hebcal/noaa';
321
+ import { HDate } from './hdate.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.3.11",
3
+ "version": "5.3.13",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -27,9 +27,9 @@
27
27
  "exports": {
28
28
  "import": "./dist/index.mjs",
29
29
  "require": "./dist/index.cjs",
30
- "types": "./hebcal.d.ts"
30
+ "types": "./dist/index.d.ts"
31
31
  },
32
- "typings": "hebcal.d.ts",
32
+ "typings": "./dist/index.d.ts",
33
33
  "engines": {
34
34
  "node": ">= 16.0.0"
35
35
  },
@@ -42,12 +42,11 @@
42
42
  },
43
43
  "files": [
44
44
  "dist",
45
- "hebcal.d.ts",
46
45
  "po"
47
46
  ],
48
47
  "scripts": {
49
48
  "build:rollup": "rollup -c",
50
- "build": "npm run po2json && npm run version && npm run build:rollup",
49
+ "build": "npm run po2json && npm run version && npm run build:rollup --production",
51
50
  "prepublish": "npm run build",
52
51
  "po2json": "node ./po2json.cjs po/*.po",
53
52
  "version": "node ./version.cjs package.json src/pkgVersion.js",
@@ -74,13 +73,14 @@
74
73
  "@babel/core": "^7.24.5",
75
74
  "@babel/preset-env": "^7.24.5",
76
75
  "@babel/register": "^7.23.7",
77
- "@hebcal/hdate": "^0.9.3",
76
+ "@hebcal/hdate": "^0.9.6",
78
77
  "@hebcal/noaa": "^0.8.14",
79
78
  "@rollup/plugin-babel": "^6.0.4",
80
- "@rollup/plugin-commonjs": "^25.0.7",
79
+ "@rollup/plugin-commonjs": "^25.0.8",
81
80
  "@rollup/plugin-json": "^6.1.0",
82
81
  "@rollup/plugin-node-resolve": "^15.2.3",
83
82
  "@rollup/plugin-terser": "^0.4.4",
83
+ "@rollup/plugin-typescript": "^11.1.6",
84
84
  "ava": "^6.1.3",
85
85
  "core-js": "^3.37.1",
86
86
  "eslint": "^8.57.0",
@@ -89,7 +89,11 @@
89
89
  "jsdoc-to-markdown": "^8.0.1",
90
90
  "nyc": "^15.1.0",
91
91
  "quick-lru": "^7.0.0",
92
- "rollup": "^4.17.2",
93
- "ttag-cli": "^1.10.12"
92
+ "rollup": "^4.18.0",
93
+ "ttag-cli": "^1.10.12",
94
+ "typescript": "^5.4.5"
95
+ },
96
+ "dependencies": {
97
+ "tslib": "^2.6.2"
94
98
  }
95
99
  }