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