jcal-zmanim 1.3.0 → 1.3.2

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,927 @@
1
+ type Time = { hour: number, minute: number, second?: number };
2
+ type SunTimes = { sunrise?: Time, sunset?: Time };
3
+ type ZmanToShow = { id: number, desc: string, eng: string, heb: string, offset?: number, whichDaysFlags?: number };
4
+ type ZmanTime$1 = { zmanType: ZmanToShow, time: Time, isTomorrow: boolean; };
5
+ type ShulZmanimType = { chatzosHayom?: Time, chatzosHalayla?: Time, alos?: Time, shkia?: Time };
6
+
7
+ /**
8
+ * Computes the Sedra/Sedras of the week for the given day.
9
+ * The property "sedras" an array of sedras (either one or two) for the given Jewish Date
10
+ * Sample of use to get todays sedra in Israel:
11
+ * const sedras = new Sedra(new jDate(), true).toString();
12
+ * The code was converted to javascript and tweaked by CBS.
13
+ * It is directly based on the C code in Danny Sadinoff's HebCal - Copyright (C) 1994.
14
+ * Portions of that code are Copyright (c) 2002 Michael J. Radwin. All Rights Reserved.
15
+ * Many of the algorithms were taken from hebrew calendar routines implemented by Nachum Dershowitz
16
+ * @property sedras {[{ eng: String, heb: String }]}
17
+ */
18
+ declare class Sedra {
19
+ sedras: {
20
+ eng: string;
21
+ heb: string;
22
+ }[];
23
+ /**
24
+ * @param {jDate} jd
25
+ * @param {boolean} israel
26
+ */
27
+ constructor(jd: jDate, israel: boolean);
28
+ /**
29
+ * Gets the sedra/s as a string. If there are two, they are seperated by a " - "
30
+ */
31
+ toString(): string;
32
+ /**
33
+ * Gets the sedra/s as a string. If there are two, they are seperated by a " - "
34
+ */
35
+ toStringHeb(): string;
36
+ static lastCalculatedYear: {
37
+ firstSatInYear: number;
38
+ sedraArray?: number[];
39
+ year: number;
40
+ israel: boolean;
41
+ } | null;
42
+ static sedraList: {
43
+ eng: string;
44
+ heb: string;
45
+ }[];
46
+ static shabbos_short: number[];
47
+ static shabbos_long: number[];
48
+ static mon_short: number[];
49
+ static mon_long: number[];
50
+ static thu_normal: number[];
51
+ static thu_normal_Israel: number[];
52
+ static thu_long: number[];
53
+ static shabbos_short_leap: number[];
54
+ static shabbos_long_leap: number[];
55
+ static mon_short_leap: number[];
56
+ static mon_short_leap_Israel: number[];
57
+ static mon_long_leap: number[];
58
+ static mon_long_leap_Israel: number[];
59
+ static thu_short_leap: number[];
60
+ static thu_long_leap: number[];
61
+ static getDayOnOrBefore(day_of_week: number, date: number): number;
62
+ static getSedraOrder(year: number, israel: boolean): {
63
+ firstSatInYear: number;
64
+ sedraArray?: number[] | undefined;
65
+ year: number;
66
+ israel: boolean;
67
+ };
68
+ }
69
+
70
+ /** Represents a geographic Location. Needed for calculating Zmanim.
71
+ If Israel is undefined, if the given coordinates are near the vicinity of Israel it will be assumed that it is in Israel.
72
+ UTCOffset is the time zone. Israel is always 2 and the US East coast is -5. England is 0 of course.
73
+ If UTCOffset is not specifically supplied, the longitude will be used to get a quasi-educated guess.*/
74
+ declare class Location {
75
+ Name: string;
76
+ NameHebrew?: string;
77
+ Israel: boolean;
78
+ Latitude: number;
79
+ Longitude: number;
80
+ UTCOffset: number;
81
+ Elevation: number;
82
+ CandleLighting?: number;
83
+ /**
84
+ * Describe a new Location.
85
+ * @param {String} name The name of the Location
86
+ * @param {String} nameHeb The name of the Location
87
+ * @param {Boolean} israel Is this Location in Israel?
88
+ * @param {Number} latitude
89
+ * @param {Number} longitude
90
+ * @param {Number} utcOffset The time zone. Israel is 2 and New York is -5.
91
+ * @param {Number} elevation Elevation in meters
92
+ * @param {Number} [candleLighting] Number of minutes before sunset the candles are lit on Friday
93
+ */
94
+ constructor(name: string, nameHeb: string | undefined, israel: boolean, latitude: number, longitude: number, utcOffset: number, elevation: number, candleLighting?: number);
95
+ static clone(location: Location): Location;
96
+ static getCandles(location: Location): number;
97
+ /**Gets the Location for Jerusalem.*/
98
+ static getJerusalem(): Location;
99
+ /**Gets the Location for Lakewood NJ*/
100
+ static getLakewood(): Location;
101
+ }
102
+
103
+ /** Represents a single day in the Jewish Calendar. */
104
+ declare class jDate {
105
+ Day: number;
106
+ Month: number;
107
+ Year: number;
108
+ Abs: number;
109
+ /**
110
+ * Create a new Jdate.
111
+ * new jDate() - Sets the Jewish Date for the current system date
112
+ * new jDate(javascriptDateObject) - Sets to the Jewish date on the given Gregorian date
113
+ * new jDate("January 1 2045") - Accepts any valid javascript Date string (uses javascripts new Date(string))
114
+ * new jDate(jewishYear, jewishMonth, jewishDay) - Months start at 1. Nissan is month 1 Adar Sheini is 13.
115
+ * new jDate(jewishYear, jewishMonth) - Same as above, with Day defaulting to 1
116
+ * new jDate( { year: 5776, month: 4, day: 5 } ) - same as new jDate(jewishYear, jewishMonth, jewishDay)
117
+ * new jDate( { year: 5776, month: 4 } ) - same as new jDate(jewishYear, jewishMonth)
118
+ * new jDate( { year: 5776 } ) - sets to the first day of Rosh Hashana on the given year
119
+ * new jDate(absoluteDate) - The number of days elapsed since the theoretical date Sunday, December 31, 0001 BCE
120
+ * new jDate(jewishYear, jewishMonth, jewishDay, absoluteDate) - Most efficient constructor. Needs no calculations at all.
121
+ * new jDate( { year: 5776, month: 4, day: 5, abs: 122548708 } ) - same as new jDate(jewishYear, jewishMonth, jewishDay, absoluteDate)
122
+ * @param {number | Date | string | {year:number,month:number,day:number} | [number, number, number, number]} [arg] The full Jewish year number OR Javascript Date object or string OR object or array of year, month, day
123
+ * @param {number} [month] The month of the Jewish date. Nissan is 1.
124
+ * @param {number} [day] The day of the month
125
+ * @param {number} [abs] The number of days that have passed since 12/31/0001
126
+ */
127
+ constructor(arg?: number | Date | string | {
128
+ year: number;
129
+ month: number;
130
+ day: number;
131
+ } | [number, number, number, number], month?: number, day?: number, abs?: number);
132
+ /**Sets the current Jewish date from the given absolute date*/
133
+ fromAbs(absolute: number): void;
134
+ /**Returns a valid javascript Date object that represents the Gregorian date
135
+ that starts at midnight of the current Jewish date.*/
136
+ getDate(): Date;
137
+ /**
138
+ * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6.
139
+ */
140
+ getDayOfWeek(): number;
141
+ /**
142
+ * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6
143
+ */
144
+ get DayOfWeek(): number;
145
+ /**Returns a new Jewish date represented by adding the given number of days to the current Jewish date.*/
146
+ addDays(days: number): jDate;
147
+ /**
148
+ * Returns a new Jewish date represented by adding the given number of
149
+ * Jewish Months to the current Jewish date.
150
+ * If the current Day is 30 and the new month only has 29 days,
151
+ * the 29th day of the month is returned.
152
+ * @param {number} months
153
+ */
154
+ addMonths(months: number): jDate;
155
+ /**
156
+ * Returns a new Jewish date represented by adding the
157
+ * given number of Jewish Years to the current Jewish date.
158
+ * If the current Day is 30 and the new dates month only has 29 days,
159
+ * the 29th day of the month is returned.
160
+ * @param {number} years
161
+ */
162
+ addYears(years: number): jDate;
163
+ addSecularMonths(months: number): jDate;
164
+ addSecularYears(years: number): jDate;
165
+ /**Gets the number of days separating this Jewish Date and the given one.
166
+ *
167
+ * If the given date is before this one, the number will be negative.
168
+ * @param {jDate} jd
169
+ * */
170
+ diffDays(jd: jDate): number;
171
+ /**Gets the number of months separating this Jewish Date and the given one.
172
+ *
173
+ * Ignores the Day property:
174
+ *
175
+ * jDate.toJDate(5777, 6, 29).diffMonths(jDate.toJDate(5778, 7, 1)) will return 1 even though they are a day apart.
176
+ *
177
+ * If the given date is before this one, the number will be negative.
178
+ * @param {jDate} jd
179
+ * */
180
+ diffMonths(jd: jDate): number;
181
+ /**Gets the number of full months separating this Jewish Date and the given one.
182
+ * If the given date is before this one, the number will be negative.
183
+ * @param {jDate} jd
184
+ * */
185
+ diffFullMonths(jd: jDate): number;
186
+ /**Gets the number of years separating this Jewish Date and the given one.
187
+ *
188
+ * Ignores the Day and Month properties:
189
+ *
190
+ * jDate.toJDate(5777, 6, 29).diffYears(jDate.toJDate(5778, 7, 1)) will return 1 even though they are a day apart.
191
+ *
192
+ * If the given date is before this one, the number will be negative.
193
+ * @param {jDate} jd*/
194
+ diffYears(jd: jDate): number;
195
+ /**Gets the number of full years separating this Jewish Date and the given one.
196
+ * If the given date is before this one, the number will be negative.
197
+ * @param {jDate} jd*/
198
+ diffFullYears(jd: jDate): number;
199
+ /**
200
+ * Returns the current Jewish date in the format: Thursday, the 3rd of Kislev 5776.
201
+ * @param {boolean} hideDayOfWeek
202
+ * @param {boolean} dontCapitalize
203
+ */
204
+ toString(hideDayOfWeek?: boolean, dontCapitalize?: boolean): string;
205
+ /**
206
+ * Returns the current Jewish date in the format "[Tuesday] Nissan 3, 5778"
207
+ * @param {boolean} showDow - show day of week?
208
+ */
209
+ toShortstring(showDow: boolean): string;
210
+ /**
211
+ * Returns the current Jewish date in the format "Nissan 5778"
212
+ * @param {boolean} showYear - show the year number?
213
+ */
214
+ monthName(showYear?: boolean): string;
215
+ /**
216
+ * Returns the current Jewish date in the format: יום חמישי כ"א כסלו תשע"ו
217
+ * @param hideDayOfWeek When set to truthy, hides the day of the week
218
+ */
219
+ toStringHeb(hideDayOfWeek?: boolean): string;
220
+ /**Gets the day of the omer for the current Jewish date. If the date is not during sefira, 0 is returned.*/
221
+ getDayOfOmer(): number;
222
+ /**
223
+ * Returns true if this day is yomtov or chol hamoed
224
+ * @param {boolean} israel
225
+ */
226
+ isYomTovOrCholHamoed(israel: boolean): boolean;
227
+ /**
228
+ * Returns true if this day is yomtov
229
+ * @param {boolean} israel
230
+ */
231
+ isYomTov(israel: boolean): boolean;
232
+ /**Is today Erev Yom Tov? (includes Erev second days of Sukkos and Pesach) */
233
+ isErevYomTov(): boolean;
234
+ /**Does the current Jewish date have candle lighting before sunset?*/
235
+ hasCandleLighting(): boolean;
236
+ /**Is the current Jewish Date the day before a yomtov that contains a Friday?*/
237
+ hasEiruvTavshilin(israel: boolean): boolean;
238
+ /**Gets the candle lighting time for the current Jewish date for the given Location object.*/
239
+ getCandleLighting(location: Location, nullIfNoCandles?: boolean): Time | null | undefined;
240
+ /**Get the sedra of the week for the current Jewish date.*/
241
+ getSedra(israel: boolean): Sedra;
242
+ /**Get the prakim of Pirkei Avos for the current Jewish date.*/
243
+ getPirkeiAvos(israel: boolean): number[];
244
+ /**Gets sunrise and sunset time for the current Jewish date at the given Location.
245
+ *
246
+ * Return format: {sunrise: {hour: 6, minute: 18}, sunset: {hour: 19, minute: 41}}*/
247
+ getSunriseSunset(location: Location, ignoreElevation?: boolean): SunTimes;
248
+ /**Gets Chatzos for both the day and the night for the current Jewish date at the given Location.
249
+ *
250
+ *Return format: {hour: 11, minute: 48}*/
251
+ getChatzos(location: Location): Time;
252
+ /**Gets the length of a single Sha'a Zmanis in minutes for the current Jewish date at the given Location.*/
253
+ getShaaZmanis(location: Location, offset: number): number;
254
+ /**Returns the daily daf in English. For example: Sukkah, Daf 3.*/
255
+ getDafYomi(): string;
256
+ /**Gets the daily daf in Hebrew. For example: 'סוכה דף כ.*/
257
+ getDafyomiHeb(): string;
258
+ /**
259
+ * Converts its argument/s to a Jewish Date.
260
+ * Samples of use:
261
+ * To get the current Jewish Date: jDate.toJDate(new Date()).
262
+ * To print out the current date in English: jDate.toJDate(new Date()).toString()
263
+ * To print out the current date in Hebrew: jDate.toJDate(new Date()).toStringHeb()
264
+ *
265
+ * Arguments to the jDate.toJDate function can be one of the following:
266
+ * jDate.toJDate() - Sets the Jewish Date for the current system date
267
+ * jDate.toJDate(Date) - Sets to the Jewish date on the given Javascript Date object
268
+ * jDate.toJDate("January 1 2045") - Accepts any valid Javascript Date string (uses string constructor of Date object)
269
+ * jDate.toJDate(jewishYear, jewishMonth, jewishDay) - Months start at 1. Nissan is month 1 Adara Sheini is 13.
270
+ * jDate.toJDate(jewishYear, jewishMonth) - Same as above, with Day defaulting to 1
271
+ * jDate.toJDate(jewishYear) - sets to the first day of Rosh Hashana on the given year
272
+ * jDate.toJDate( { year: 5776, month: 4, day: 5 } ) - Months start at 1. Nissan is month 1 Adara Sheini is 13.
273
+ * jDate.toJDate( { year: 5776, month: 4 } ) - Same as above, with Day defaulting to 1
274
+ * jDate.toJDate( { year: 5776 } ) - sets to the first day of Rosh Hashana on the given year
275
+ * jDate.toJDate(jewishYear, jewishMonth, jewishDay, absoluteDate) - Most efficient. Needs no calculations at all. The absoluteDate is the number of days elapsed since the theoretical date Sunday, December 31, 0001 BCE.
276
+ * jDate.toJDate( { year: 5776, month: 4, day: 5, abs: 122548708 } ) - same as jDate.toJDate(jewishYear, jewishMonth, jewishDay, absoluteDate)
277
+ ****************************************************************************************************************/
278
+ static toJDate(arg?: number | Date | string | {
279
+ year: number;
280
+ month: number;
281
+ day: number;
282
+ } | [number, number, number, number], month?: number, day?: number, abs?: number): jDate;
283
+ static now(): jDate;
284
+ /**Calculate the Jewish year, month and day for the given absolute date.*/
285
+ static fromAbs(absDay: number): {
286
+ year: number;
287
+ month: number;
288
+ day: number;
289
+ };
290
+ /**
291
+ * Gets the absolute date of the given javascript Date object.
292
+ * @param {Date} date
293
+ */
294
+ static absSd(date: Date): number;
295
+ /**Calculate the absolute date for the given Jewish Date.*/
296
+ static absJd(year: number, month: number, day: number): number;
297
+ /**
298
+ * Gets a javascript date from an absolute date
299
+ */
300
+ static sdFromAbs(abs: number): Date;
301
+ /**number of days in the given Jewish Month. Nissan is 1 and Adar Sheini is 13.*/
302
+ static daysJMonth(year: number, month: number): number;
303
+ /**Elapsed days since creation of the world until Rosh Hashana of the given year*/
304
+ static tDays(year: number): number;
305
+ /**number of days in the given Jewish Year.*/
306
+ static daysJYear(year: number): number;
307
+ /**Does Cheshvan for the given Jewish Year have 30 days?*/
308
+ static isLongCheshvan(year: number): boolean;
309
+ /**Does Kislev for the given Jewish Year have 29 days?*/
310
+ static isShortKislev(year: number): boolean;
311
+ /**Does the given Jewish Year have 13 months?*/
312
+ static isJdLeapY(year: number): boolean;
313
+ /**number of months in Jewish Year.*/
314
+ static monthsJYear(year: number): number;
315
+ }
316
+
317
+ declare const DaysOfWeek: Readonly<{
318
+ SUNDAY: 0;
319
+ MONDAY: 1;
320
+ TUESDAY: 2;
321
+ WEDNESDAY: 3;
322
+ THURSDAY: 4;
323
+ FRIDAY: 5;
324
+ SHABBOS: 6;
325
+ }>;
326
+ declare const JewishMonthsNames: Readonly<{
327
+ NISSAN: 1;
328
+ IYAR: 2;
329
+ SIVAN: 3;
330
+ TAMUZ: 4;
331
+ AV: 5;
332
+ ELLUL: 6;
333
+ TISHREI: 7;
334
+ CHESHVAN: 8;
335
+ KISLEV: 9;
336
+ TEVES: 10;
337
+ SHVAT: 11;
338
+ ADAR: 12;
339
+ ADAR_SHEINI: 13;
340
+ }>;
341
+ declare const JewishMonthsEng: string[];
342
+ declare const JewishMonthsHeb: string[];
343
+ declare const SecularMonthsEng: string[];
344
+ declare const DaysOfWeekEng: string[];
345
+ declare const DaysOfWeekHeb: string[];
346
+ declare class Utils {
347
+ static jsd: string[];
348
+ static jtd: string[];
349
+ static jhd: string[];
350
+ static jsnum: string[];
351
+ static jtnum: string[];
352
+ /**
353
+ * Gets the Jewish representation of a number (365 = שס"ה)
354
+ * Minimum number is 1 and maximum is 9999.
355
+ * @param {Number} number
356
+ */
357
+ static toJewishNumber(number: number): string;
358
+ /**
359
+ * Returns the javascript date in the format: Thursday, the 3rd of January 2018.
360
+ * @param {Date} date
361
+ * @param {Boolean} hideDayOfWeek
362
+ * @param {Boolean} dontCapitalize
363
+ */
364
+ static toStringDate(date: Date, hideDayOfWeek: boolean, dontCapitalize: boolean): string | undefined;
365
+ /**
366
+ * Returns the javascript date in the format: 1/3/2020.
367
+ * @param {Date} date
368
+ * @param {Boolean} monthFirst
369
+ */
370
+ static toShortStringDate(date: Date, monthFirst: boolean): string | undefined;
371
+ /**
372
+ * Add two character suffix to number. e.g. 21st, 102nd, 93rd, 500th
373
+ * @param {Number} num
374
+ */
375
+ static toSuffixed(num: number): string;
376
+ /**
377
+ * Returns if the given full secular year has a February 29th
378
+ * @param {Number} year
379
+ */
380
+ static isSecularLeapYear(year: number): boolean;
381
+ /**
382
+ * Get day of week using Javascripts getDay function.
383
+ * Important note: months starts at 1 not 0 like javascript
384
+ * The DOW returned has Sunday = 0
385
+ * @param {Number} year
386
+ * @param {Number} month
387
+ * @param {Number} day
388
+ */
389
+ static getSdDOW(year: number, month: number, day: number): number;
390
+ /**
391
+ * Makes sure hour is between 0 and 23 and minute is between 0 and 59.
392
+ * Overlaps get added/subtracted.
393
+ * The argument needs to be an object in the format {hour : 12, minute : 42, second : 18}
394
+ * @param {Time} time
395
+ */
396
+ static fixTime(time: Time): {
397
+ hour: number;
398
+ minute: number;
399
+ second: number;
400
+ };
401
+ /**
402
+ * Add the given number of minutes to the given time.
403
+ * The argument needs to be an object in the format {hour : 12, minute : 42, second : 18 }
404
+ *
405
+ * @param {Time} time
406
+ * @param {Number} minutes
407
+ */
408
+ static addMinutes(time?: Time, minutes?: number): Time | undefined;
409
+ /**
410
+ * Add the given number of seconds to the given time.
411
+ * The argument needs to be an object in the format {hour : 12, minute :42, second : 18}
412
+ *
413
+ * @param {Time} time
414
+ * @param {Number} seconds
415
+ */
416
+ static addSeconds(time: Time, seconds: number): {
417
+ hour: number;
418
+ minute: number;
419
+ second: number;
420
+ };
421
+ /**
422
+ * Gets the time difference between two times of day.
423
+ * If showNegative is falsey, assumes that the earlier time is always before the later time.
424
+ * So, if laterTime is less than earlierTime, the returned diff is until the next day.
425
+ * Both arguments need to be an object in the format {hour : 12, minute : 42, second : 18 }
426
+ * @param {Time} earlierTime
427
+ * @param {Time} laterTime
428
+ * @param {Boolean} [showNegative] show negative values or assume second value is next day?
429
+ * @returns{{hour:number, minute:number, second:number, sign:1|-1}}
430
+ */
431
+ static timeDiff(earlierTime: Time, laterTime: Time, showNegative?: boolean): {
432
+ sign: number;
433
+ hour: number;
434
+ minute: number;
435
+ second: number;
436
+ };
437
+ /**
438
+ * Gets the total number of minutes in the given time.
439
+ * @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
440
+ */
441
+ static totalMinutes(time: Time): number;
442
+ /**
443
+ * Gets the total number of seconds in the given time.
444
+ * @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
445
+ */
446
+ static totalSeconds(time: Time): number;
447
+ /**
448
+ * Returns the time of the given javascript date as an object in the format of {hour : 23, minute :42, second: 18 }
449
+ * @param {Date} sdate
450
+ * @returns {{hour :number, minute :number, second:number }}
451
+ */
452
+ static timeFromDate(sdate: Date): {
453
+ hour: number;
454
+ minute: number;
455
+ second: number;
456
+ };
457
+ /**
458
+ * Determines if the second given time is after (or at) the first given time
459
+ * @param {{hour :number, minute :number, second:number }} beforeTime
460
+ * @param {{hour :number, minute :number, second:number }} afterTime
461
+ */
462
+ static isTimeAfter(beforeTime?: Time, afterTime?: Time): boolean;
463
+ /**
464
+ * Returns the given time interval in a formatted string.
465
+ * @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
466
+ */
467
+ static getTimeIntervalTextStringHeb(time: Time): string;
468
+ /**
469
+ * Returns the given time interval in a formatted string.
470
+ * @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
471
+ */
472
+ static getTimeIntervalTextString(time: Time): string;
473
+ /**
474
+ * Returns the nusach for Sefiras Ha'omer for the given day and minhag
475
+ * @param {number} dayOfOmer The day of the Omer for which to get the nusach for
476
+ * @param {'ashkenaz'|'sefard'|'sefardi'} nusach Should it be La'Omer ("sefard") or Ba'Omer ("ashkenaz") or "sefardi" (Eidot Hamizrach)?
477
+ */
478
+ static getOmerNusach(dayOfOmer: number, nusach: 'ashkenaz' | 'sefard' | 'sefardi'): string;
479
+ /**
480
+ * Returns the given time in a formatted string.
481
+ * @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
482
+ * @param {1 | -1} [sign]
483
+ * @param {Boolean} [army] If falsey, the returned string will be: 11:42:18 PM otherwise it will be 23:42:18
484
+ * @param {Boolean} [roundUp] If falsey, the numbers will converted to a whole number by rounding down, otherwise, up.
485
+ */
486
+ static getTimeString(time: Time, sign?: 1 | -1, army?: boolean, roundUp?: boolean): string;
487
+ /**
488
+ * Gets the UTC offset in whole hours for the users time zone.
489
+ * Note: this is not affected by DST - unlike javascripts getTimezoneOffset() function which gives you the current offset.
490
+ */
491
+ static currUtcOffset(): number;
492
+ /** Determines if the given date is within DST on the users system */
493
+ static isDateDST(date: Date): boolean;
494
+ /**
495
+ * Determines if the given date is within DST in the given location
496
+ * Note: This may not be correct if the user has set the Location to a
497
+ * time zone outside Israel or the USA which is not the current system time zone.
498
+ */
499
+ static isDST(location: Location, date: Date): boolean;
500
+ /**
501
+ * Determines if the given javascript date is during DST according to the USA rules
502
+ * @param {Date} date A javascript Date object
503
+ */
504
+ static isUSA_DST(date: Date): boolean;
505
+ /**
506
+ * Determines if the given Javascript date is during DST according to the current (5776) Israeli rules
507
+ * @param {Date} date A Javascript Date object
508
+ */
509
+ static isIsrael_DST(date: Date): boolean;
510
+ /** The current time in Israel - determined by the current users system time and time zone offset*/
511
+ static getSdNowInIsrael(): Date;
512
+ /**
513
+ * Adds the given number of days to the given javascript date and returns the new date
514
+ * @param {Date} sdate
515
+ * @param {Number} days
516
+ */
517
+ static addDaysToSdate(sdate: Date, days: number): Date;
518
+ /**
519
+ * Compares two js dates to se if they both refer to the same day - time is ignored.
520
+ * @param {Date} sdate1
521
+ * @param {Date} sdate2
522
+ */
523
+ static isSameSdate(sdate1: Date, sdate2: Date): boolean;
524
+ /**
525
+ * Compares two jDates to se if they both refer to the same day - time is ignored.
526
+ * @param {jDate} jdate1
527
+ * @param {jDate} jdate2
528
+ */
529
+ static isSameJdate(jdate1: jDate, jdate2: jDate): boolean | 0;
530
+ /**
531
+ * Compares two jDates to see if they both refer to the same Jewish Month.
532
+ * @param {jDate} jdate1
533
+ * @param {jDate} jdate2
534
+ */
535
+ static isSameJMonth(jdate1: jDate, jdate2: jDate): boolean;
536
+ /**
537
+ * Compares two dates to se if they both refer to the same Secular Month.
538
+ * @param {Date} sdate1
539
+ * @param {Date} sdate2
540
+ */
541
+ static isSameSMonth(sdate1: Date, sdate2: Date): boolean;
542
+ /**
543
+ * Determines if the time of the given Date() is after sunset at the given Location
544
+ * @param {Date} sdate
545
+ * @param {Location} location
546
+ */
547
+ static isAfterSunset(sdate: Date, location: Location): boolean | undefined;
548
+ /**
549
+ * Gets the current Jewish Date at the given Location
550
+ * @param {Location} location
551
+ */
552
+ static nowAtLocation(location: Location): jDate;
553
+ /**
554
+ * Converts the given complex number to an integer by removing the decimal part.
555
+ * Returns same results as Math.floor for positive numbers and Math.ceil for negative ones.
556
+ * Almost identical functionality to Math.trunc and parseInt.
557
+ * The difference is if the argument is NaN. Math.trunc returns NaN while ths fuction returns 0.
558
+ * In performance tests, this function was found to be quicker than the alternatives.
559
+ * @param {Number} float The complex number to convert to an integer
560
+ */
561
+ static toInt(float: number): number;
562
+ /***
563
+ * Takes either a jDate or a Date and returns both
564
+ * @param date {Date |jDate}
565
+ * @returns {{ sdate:Date, jdate:jDate }}
566
+ */
567
+ static bothDates(date: Date | jDate): {
568
+ sdate: Date;
569
+ jdate: jDate;
570
+ };
571
+ /** Returns true if "thing" is either a string primitive or String object.*/
572
+ static isString(thing: unknown): boolean;
573
+ /** Returns true if "thing" is either a number primitive or a Number object.*/
574
+ static isNumber(thing: unknown): boolean;
575
+ /** Returns true if "thing" is a Date object containing a valid date.*/
576
+ static isValidDate(thing: unknown): boolean;
577
+ /** Returns whether or not the given, array, string, or argument list contains the given item or substring.
578
+ *
579
+ * This function is awfully similar to Array.includes, but has the added plus of accepting any number or type of arguments.*/
580
+ static has(o: unknown, ...arr: unknown[]): boolean;
581
+ /** Returns the first value unless it is undefined, null or NaN.
582
+ *
583
+ * This is very useful for boolean, string and integer parameters
584
+ * where we want to keep false, "" and 0 if they were supplied.
585
+ *
586
+ * Similar purpose to default parameters with the difference being that this function will return
587
+ * the second value if the first is NaN or null, while default params will give give you the NaN or the null.
588
+ */
589
+ static setDefault(paramValue: unknown, defValue: unknown): unknown;
590
+ /**
591
+ * Returns an array containing a range of integers.
592
+ * @param {Number} [start] The number to start at. The start number is included in the results.
593
+ * If only one argument is supplied, start will be set to 1.
594
+ * @param {Number} end The top end of the range.
595
+ * Unlike Pythons range function, The end number is included in the results.
596
+ * @returns {[Number]}
597
+ */
598
+ static range(start: number, end?: number): number[];
599
+ /**
600
+ * Log message to console
601
+ * @param {string} txt
602
+ */
603
+ static log(txt: string, ...optionalItems: any[]): void;
604
+ /**
605
+ * Warn message to console
606
+ * @param {string} txt
607
+ */
608
+ static warn(txt: string, ...optionalItems: any[]): void;
609
+ /**
610
+ * Error message to console
611
+ * @param {*} txt
612
+ */
613
+ static error(txt: string, ...optionalItems: any[]): void;
614
+ }
615
+
616
+ /**
617
+ * Computes the daily Zmanim for any single date at any location.
618
+ * The astronomical and mathematical calculations were directly adapted from the excellent
619
+ * Jewish calendar calculation in C# Copyright © by Ulrich and Ziporah Greve (2005)
620
+ */
621
+ declare class Zmanim {
622
+ /**
623
+ * Gets sunrise and sunset time for given date and Location.
624
+ * Accepts a javascript Date object, a string for creating a javascript date object or a jDate object.
625
+ * Location object is required.
626
+ * @returns {SunTimes}
627
+ * @param {Date | jDate} date A Javascript Date or Jewish Date for which to calculate the sun times.
628
+ * @param {Location} location Where on the globe to calculate the sun times for.
629
+ * @param {Boolean} considerElevation
630
+ */
631
+ static getSunTimes(date: Date | jDate, location: Location, considerElevation?: boolean): SunTimes;
632
+ /**
633
+ * @param {jDate | Date} date
634
+ * @param {Location} location
635
+ */
636
+ static getChatzos(date: jDate | Date, location: Location): Time;
637
+ /**
638
+ * @param {SunTimes} sunTimes
639
+ */
640
+ static getChatzosFromSuntimes(sunTimes: SunTimes): Time;
641
+ /**
642
+ * @param {jDate | Date} date
643
+ * @param {Location} location
644
+ * @param {any} offset
645
+ */
646
+ static getShaaZmanis(date: jDate | Date, location: Location, offset: number): number;
647
+ /**
648
+ * @param {{ sunrise: any; sunset: any; }} sunTimes
649
+ * @param {number} [offset]
650
+ */
651
+ static getShaaZmanisFromSunTimes(sunTimes: SunTimes, offset?: number): number;
652
+ /**
653
+ * @param {{ sunrise: any; sunset: any; }} sunTimes
654
+ * @param {boolean} israel
655
+ */
656
+ static getShaaZmanisMga(sunTimes: SunTimes, israel: boolean): number;
657
+ /**
658
+ * @param {jDate | Date} date
659
+ * @param {Location} location
660
+ */
661
+ static getCandleLighting(date: Date | jDate, location: Location): Time | undefined;
662
+ /**
663
+ * @param {SunTimes} sunTimes
664
+ * @param {any} location
665
+ */
666
+ static getCandleLightingFromSunTimes(sunTimes: SunTimes, location: Location): Time | undefined;
667
+ /**
668
+ * @param {Time} sunset
669
+ * @param {Location} location
670
+ */
671
+ static getCandleLightingFromSunset(sunset: Time, location: Location): Time | undefined;
672
+ /**
673
+ * @param {Date} date
674
+ */
675
+ static dayOfYear(date: Date): number;
676
+ /**
677
+ * @param {number} deg
678
+ * @param {number} min
679
+ */
680
+ static degToDec(deg: number, min: number): number;
681
+ /**
682
+ * @param {number} x
683
+ */
684
+ static M(x: number): number;
685
+ /**
686
+ * @param {number} x
687
+ */
688
+ static L(x: number): number;
689
+ /**
690
+ * @param {number} x
691
+ */
692
+ static adj(x: number): number;
693
+ /**
694
+ * @param {number} rad
695
+ */
696
+ static radToDeg(rad: number): number;
697
+ /**
698
+ * @param {number} time
699
+ * @param {Date} date
700
+ * @param {Location} location
701
+ */
702
+ static timeAdj(time: number, date: Date, location: Location): {
703
+ hour: number;
704
+ minute: number;
705
+ second: number;
706
+ };
707
+ }
708
+
709
+ /**
710
+ * NOTE: South and East are negative.
711
+ */
712
+ type Point = {
713
+ latitude: number;
714
+ longitude: number;
715
+ };
716
+ declare const Locations: Location[];
717
+ /**
718
+ * Find the Location (city) that is the closest to the given point of coordinates.
719
+ * @param {Point} point
720
+ * @returns
721
+ */
722
+ declare function closestDistanceMatch(point: Point): Location | undefined;
723
+ /**
724
+ * Find the Location (city) who's city name is the closest match to the given point of coordinates.
725
+ * @param {string} val
726
+ * @returns
727
+ */
728
+ declare function closestNameMatch(val: string): Location | undefined;
729
+ /**
730
+ * Option 1: Find a location with the given name
731
+ * Option 2: Find the location with the name that is most similar to the given name
732
+ * Option 3: Find the Location with the given coordinates
733
+ * Option 4: Find the location closest to the given coordinates
734
+ * @param {String|Point} nameOrCoordinates
735
+ */
736
+ declare function findLocation(nameOrCoordinates: string | Point): Location | undefined;
737
+
738
+ /**
739
+ * List of ZmanTypeIds. Use as an enum.
740
+ */
741
+ declare const ZmanTypeIds: Readonly<{
742
+ ChatzosLayla: 0;
743
+ Alos90: 1;
744
+ Alos72: 2;
745
+ TalisTefillin: 3;
746
+ NetzAtElevation: 4;
747
+ NetzMishor: 5;
748
+ szksMga: 6;
749
+ szksGra: 7;
750
+ sztMga: 8;
751
+ sztGra: 9;
752
+ chatzosDay: 10;
753
+ minGed: 11;
754
+ minKet: 12;
755
+ plag: 13;
756
+ shkiaAtSeaLevel: 14;
757
+ shkiaElevation: 15;
758
+ tzais45: 16;
759
+ tzais50: 17;
760
+ tzais72: 18;
761
+ rabbeinuTamZmanios: 19;
762
+ rabbeinuTamZmaniosMga: 20;
763
+ candleLighting: 21;
764
+ SofZmanEatingChometz: 22;
765
+ SofZmanBurnChometz: 23;
766
+ }>;
767
+ /**
768
+ * List of Zman Types. Used to acquire the Zmanim for a particular day.
769
+ */
770
+ declare const ZmanTypes: ZmanToShow[];
771
+ /**
772
+ * Get the ZmanType with the given id, name (Hebrew or English) or description.
773
+ * @param {number|string} idOrName
774
+ * @returns {ZmanToShow}
775
+ */
776
+ declare function getZmanType(idOrName: number | string): ZmanToShow | undefined;
777
+
778
+ /**
779
+ * Gets the molad for the given jewish month and year.
780
+ * Algorithm was adapted from Hebcal by Danny Sadinoff
781
+ *
782
+ * Example of use:
783
+ * const moladString = Molad.getString(5776, 10);
784
+ */
785
+ declare class Molad {
786
+ /**
787
+ * @param {Number} month
788
+ * @param {Number} year
789
+ * @returns {{jDate:jDate,time:Time,chalakim:number}}
790
+ */
791
+ static getMolad(month: number, year: number): {
792
+ jDate: jDate;
793
+ time: Time;
794
+ chalakim: number;
795
+ };
796
+ /**
797
+ * Returns the time of the molad as a string in the format: Monday Night, 8:33 PM and 12 Chalakim
798
+ * The molad is always in Jerusalem so we use the Jerusalem sunset times
799
+ * to determine whether to display "Night" or "Motzai Shabbos" etc. (check this...)
800
+ * @param {Number} year
801
+ * @param {Number} month
802
+ */
803
+ static getString(year: number, month: number): string;
804
+ /**
805
+ * Returns the time of the molad as a string in the format: ליל שני 20:33 12 חלקים
806
+ * The molad is always in Jerusalem so we use the Jerusalem sunset times
807
+ * to determine whether to display "ליל/יום" or "מוצאי שב"ק" etc.
808
+ * @param {Number} year
809
+ * @param {Number} month
810
+ */
811
+ static getStringHeb(year: number, month: number): string;
812
+ }
813
+
814
+ /****************************************************************************************************************
815
+ * Computes the Perek/Prakim of the week for the given Shabbos.
816
+ * Returns an array of prakim (integers) (either one or two) for the given Jewish Date
817
+ * Sample of use to get todays sedra in Israel:
818
+ * const prakim = PirkeiAvos.getPrakim(new jDate(), true);
819
+ * const str = 'Pirkei Avos: ' + prakim.map(s => `${Utils.toSuffixed(s)} Perek`).join(' and ');
820
+ * ***************************************************************************************************************/
821
+ declare class PirkeiAvos {
822
+ static getPrakim(jd: jDate, israel: boolean): number[];
823
+ static _get1stPerek: (jd: jDate, israel: boolean) => number;
824
+ static _ellul: (jd: jDate, israel: boolean) => number[];
825
+ }
826
+
827
+ /** *********************************************************************************************************
828
+ * Computes the Day Yomi for the given day.
829
+ * Sample of use - to get todays daf:
830
+ * const dafEng = Dafyomi.toString(jDate.now());
831
+ * const dafHeb = Dafyomi.toStringHeb(jDate.now());
832
+ * The code was converted to typescript and tweaked by CBS.
833
+ * It is directly based on the C code in Danny Sadinoff's HebCal - Copyright (C) 1994.
834
+ * The HebCal code for dafyomi was adapted by Aaron Peromsik from Bob Newell's public domain daf.el.
835
+ ***********************************************************************************************************/
836
+ declare class Dafyomi {
837
+ static masechtaList: {
838
+ eng: string;
839
+ heb: string;
840
+ daf: number;
841
+ }[];
842
+ static getDaf(jdate: jDate): {
843
+ masechet: {
844
+ eng: string;
845
+ heb: string;
846
+ daf: number;
847
+ };
848
+ daf: number;
849
+ } | null;
850
+ static toString(jd: jDate): string | undefined;
851
+ static toStringHeb(jd: jDate): string | undefined;
852
+ }
853
+
854
+ type ZmanTime = {
855
+ date: Date;
856
+ location: Location;
857
+ sunrise: Time | undefined;
858
+ sunset: Time | undefined;
859
+ suntimesMishor: SunTimes | undefined;
860
+ sunriseMishor: Time | undefined;
861
+ sunsetMishor: Time | undefined;
862
+ mishorNeg90: Time | undefined;
863
+ chatzos: Time | undefined;
864
+ shaaZmanis: number | undefined;
865
+ shaaZmanisMga: number | undefined;
866
+ };
867
+ declare class ZmanimUtils {
868
+ static zmanTimesCache: ZmanTime[];
869
+ /**
870
+ * Gets the zmanim for all the types in the given list.
871
+ * @param {[ZmanToShow]} zmanTypes An array of ZmanTypes to get the zman for.
872
+ * @param {Date} date The secular date to get the zmanim for
873
+ * @param {jDate} jdate The jewish date to get the zmanim for
874
+ * @param {Location} location The location for which to get the zmanim
875
+ * @returns{[{zmanType:{id:number,offset:?number,desc:string,eng:string,heb:string },time:Time}]}
876
+ */
877
+ static getZmanTimes(zmanTypes: ZmanToShow[], date: Date, jdate: jDate, location: Location): {
878
+ zmanType: ZmanToShow;
879
+ time?: Time;
880
+ }[];
881
+ /**
882
+ * Get the WhichDaysFlags for the given secular date
883
+ * @param {Date} date
884
+ * @param {jDate} jdate
885
+ * @param {Location} location
886
+ */
887
+ static getWhichDays(date: Date, jdate: jDate, location: Location): 0 | 1 | 2 | 4 | 8 | 32 | 16 | 64 | 128;
888
+ /**
889
+ * Returns the zmanim necessary for showing basic shul notifications: chatzosHayom, chatzosHalayla, alos
890
+ * @param {jDate|Date} date
891
+ * @param {Location} location
892
+ * @returns {{chatzosHayom:Time, chatzosHalayla:Time, alos:Time, shkia:Time }}
893
+ */
894
+ static getBasicShulZmanim(date: jDate | Date, location: Location): {
895
+ chatzosHayom: Time | undefined;
896
+ chatzosHalayla: Time | undefined;
897
+ alos: Time | undefined;
898
+ shkia: Time | undefined;
899
+ };
900
+ /**
901
+ * Returns all the zmanim for the given day
902
+ * @param {Date|jDate} date
903
+ * @param {Location} location
904
+ * @returns {{zmanType:ZmanToShow, time?:Time }[]}
905
+ */
906
+ static getAllZmanim(date: jDate | Date, location: Location): {
907
+ zmanType: ZmanToShow;
908
+ time?: Time | undefined;
909
+ }[];
910
+ }
911
+
912
+ /**
913
+ * Get shul notifications for the given date and location
914
+ * @param date
915
+ * @param time
916
+ * @param location
917
+ * @param english
918
+ * @param showGaonShir
919
+ * @param showDafYomi
920
+ * @returns {{ dayNotes: string[], tefillahNotes: string[]}}
921
+ */
922
+ declare function getNotifications(date: jDate | Date, time: Time, location: Location, english: boolean, showGaonShir?: boolean, showDafYomi?: boolean): {
923
+ dayNotes: string[];
924
+ tefillahNotes: string[];
925
+ };
926
+
927
+ export { Dafyomi, DaysOfWeek, DaysOfWeekEng, DaysOfWeekHeb, JewishMonthsEng, JewishMonthsHeb, JewishMonthsNames, Location, Locations, Molad, PirkeiAvos, SecularMonthsEng, Sedra, type ShulZmanimType, type SunTimes, type Time, Utils, type ZmanTime$1 as ZmanTime, type ZmanToShow, ZmanTypeIds, ZmanTypes, Zmanim, ZmanimUtils, closestDistanceMatch, closestNameMatch, findLocation, getNotifications, getZmanType, jDate };