jcal-zmanim 1.0.4
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.
- package/LICENSE +674 -0
- package/README.md +2 -0
- package/build/AppUtils.d.ts +109 -0
- package/build/AppUtils.js +394 -0
- package/build/GeneralUtils.d.ts +43 -0
- package/build/GeneralUtils.js +93 -0
- package/build/JCal/Dafyomi.d.ts +27 -0
- package/build/JCal/Dafyomi.js +131 -0
- package/build/JCal/Location.d.ts +33 -0
- package/build/JCal/Location.js +80 -0
- package/build/JCal/Molad.d.ts +39 -0
- package/build/JCal/Molad.js +95 -0
- package/build/JCal/PirkeiAvos.d.ts +13 -0
- package/build/JCal/PirkeiAvos.js +172 -0
- package/build/JCal/Sedra.d.ts +63 -0
- package/build/JCal/Sedra.js +186 -0
- package/build/JCal/Utils.d.ts +225 -0
- package/build/JCal/Utils.js +666 -0
- package/build/JCal/Zmanim.d.ts +95 -0
- package/build/JCal/Zmanim.js +224 -0
- package/build/JCal/jDate.d.ts +203 -0
- package/build/JCal/jDate.js +647 -0
- package/build/Locations.d.ts +7 -0
- package/build/Locations.js +1308 -0
- package/build/Notifications.d.ts +14 -0
- package/build/Notifications.js +1040 -0
- package/build/Settings.d.ts +25 -0
- package/build/Settings.js +75 -0
- package/build/ZmanTypes.d.ts +34 -0
- package/build/ZmanTypes.js +184 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +59 -0
- package/package.json +33 -0
- package/src/AppUtils.ts +500 -0
- package/src/GeneralUtils.ts +84 -0
- package/src/JCal/Dafyomi.ts +139 -0
- package/src/JCal/Location.ts +100 -0
- package/src/JCal/Molad.ts +105 -0
- package/src/JCal/PirkeiAvos.ts +180 -0
- package/src/JCal/Sedra.ts +215 -0
- package/src/JCal/Utils.ts +732 -0
- package/src/JCal/Zmanim.ts +270 -0
- package/src/JCal/jDate.ts +714 -0
- package/src/Locations.ts +1303 -0
- package/src/Notifications.ts +1243 -0
- package/src/Settings.ts +103 -0
- package/src/ZmanTypes.ts +184 -0
- package/src/index.ts +31 -0
- package/src/jcal-zmanim.d.ts +4 -0
- package/tsconfig.json +109 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jDate_js_1 = __importDefault(require("./jDate.js"));
|
|
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(new Date(), 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
|
+
class Sedra {
|
|
19
|
+
/**
|
|
20
|
+
* @param {jDate} jd
|
|
21
|
+
* @param {boolean} israel
|
|
22
|
+
*/
|
|
23
|
+
constructor(jd, israel) {
|
|
24
|
+
//If we are between the first day of Sukkos and Simchas Torah, the sedra will always be Vezos Habracha.
|
|
25
|
+
if (jd.Month === 7 && jd.Day >= 15 && jd.Day < (israel ? 23 : 24)) {
|
|
26
|
+
this.sedras = [Sedra.sedraList[53]];
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let sedraArray = [], sedraOrder = Sedra.getSedraOrder(jd.Year, israel), absDate = jd.Abs, index, weekNum;
|
|
30
|
+
/* find the first saturday on or after today's date */
|
|
31
|
+
absDate = Sedra.getDayOnOrBefore(6, absDate + 6);
|
|
32
|
+
weekNum = (absDate - sedraOrder.firstSatInYear) / 7;
|
|
33
|
+
if (sedraOrder.sedraArray && weekNum >= sedraOrder.sedraArray.length) {
|
|
34
|
+
const indexLast = sedraOrder.sedraArray[sedraOrder.sedraArray.length - 1];
|
|
35
|
+
if (indexLast < 0) {
|
|
36
|
+
/* advance 2 parashiyot ahead after a doubled week */
|
|
37
|
+
index = (-indexLast) + 2;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
index = indexLast + 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
index = (sedraOrder.sedraArray
|
|
45
|
+
? sedraOrder.sedraArray[weekNum]
|
|
46
|
+
: -1);
|
|
47
|
+
}
|
|
48
|
+
if (index >= 0) {
|
|
49
|
+
sedraArray = [Sedra.sedraList[index]];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const i = -index; /* undouble the sedra */
|
|
53
|
+
sedraArray = [Sedra.sedraList[i], Sedra.sedraList[i + 1]];
|
|
54
|
+
}
|
|
55
|
+
this.sedras = sedraArray;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the sedra/s as a string. If there are two, they are seperated by a " - "
|
|
59
|
+
*/
|
|
60
|
+
toString() {
|
|
61
|
+
return this.sedras.map(s => s.eng).join(' - ');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets the sedra/s as a string. If there are two, they are seperated by a " - "
|
|
65
|
+
*/
|
|
66
|
+
toStringHeb() {
|
|
67
|
+
return this.sedras.map(s => s.heb).join(' - ');
|
|
68
|
+
}
|
|
69
|
+
static getDayOnOrBefore(day_of_week, date) {
|
|
70
|
+
return date - ((date - day_of_week) % 7);
|
|
71
|
+
}
|
|
72
|
+
static getSedraOrder(year, israel) {
|
|
73
|
+
//If the last call is within the same year as this one, we reuse the data.
|
|
74
|
+
//If memory is an issue, remove these next few lines
|
|
75
|
+
if (Sedra.lastCalculatedYear != null &&
|
|
76
|
+
Sedra.lastCalculatedYear.year === year &&
|
|
77
|
+
Sedra.lastCalculatedYear.israel === israel) {
|
|
78
|
+
return Sedra.lastCalculatedYear;
|
|
79
|
+
}
|
|
80
|
+
const longCheshvon = jDate_js_1.default.isLongCheshvan(year), shortKislev = jDate_js_1.default.isShortKislev(year), roshHashana = jDate_js_1.default.absJd(year, 7, 1), roshHashanaDOW = Math.abs(roshHashana % 7), firstSatInYear = Sedra.getDayOnOrBefore(6, roshHashana + 6);
|
|
81
|
+
let yearType, sArray;
|
|
82
|
+
if (longCheshvon && !shortKislev)
|
|
83
|
+
yearType = 'complete';
|
|
84
|
+
else if (!longCheshvon && shortKislev)
|
|
85
|
+
yearType = 'incomplete';
|
|
86
|
+
else
|
|
87
|
+
yearType = 'regular';
|
|
88
|
+
if (!jDate_js_1.default.isJdLeapY(year)) {
|
|
89
|
+
switch (roshHashanaDOW) {
|
|
90
|
+
case 6:
|
|
91
|
+
if (yearType === 'incomplete') {
|
|
92
|
+
sArray = Sedra.shabbos_short;
|
|
93
|
+
}
|
|
94
|
+
else if (yearType === 'complete') {
|
|
95
|
+
sArray = Sedra.shabbos_long;
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case 1:
|
|
99
|
+
if (yearType === 'incomplete') {
|
|
100
|
+
sArray = Sedra.mon_short;
|
|
101
|
+
}
|
|
102
|
+
else if (yearType === 'complete') {
|
|
103
|
+
sArray = israel ? Sedra.mon_short : Sedra.mon_long;
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case 2:
|
|
107
|
+
if (yearType === 'regular') {
|
|
108
|
+
sArray = israel ? Sedra.mon_short : Sedra.mon_long;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case 4:
|
|
112
|
+
if (yearType === 'regular') {
|
|
113
|
+
sArray = israel ? Sedra.thu_normal_Israel : Sedra.thu_normal;
|
|
114
|
+
}
|
|
115
|
+
else if (yearType === 'complete') {
|
|
116
|
+
sArray = Sedra.thu_long;
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
throw 'improper sedra year type calculated.';
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else /* leap year */ {
|
|
124
|
+
switch (roshHashanaDOW) {
|
|
125
|
+
case 6:
|
|
126
|
+
if (yearType === 'incomplete') {
|
|
127
|
+
sArray = Sedra.shabbos_short_leap;
|
|
128
|
+
}
|
|
129
|
+
else if (yearType === 'complete') {
|
|
130
|
+
sArray = israel ? Sedra.shabbos_short_leap : Sedra.shabbos_long_leap;
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
case 1:
|
|
134
|
+
if (yearType === 'incomplete') {
|
|
135
|
+
sArray = israel ? Sedra.mon_short_leap_Israel : Sedra.mon_short_leap;
|
|
136
|
+
}
|
|
137
|
+
else if (yearType === 'complete') {
|
|
138
|
+
sArray = israel ? Sedra.mon_long_leap_Israel : Sedra.mon_long_leap;
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
case 2:
|
|
142
|
+
if (yearType === 'regular') {
|
|
143
|
+
sArray = israel ? Sedra.mon_long_leap_Israel : Sedra.mon_long_leap;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case 4:
|
|
147
|
+
if (yearType === 'incomplete') {
|
|
148
|
+
sArray = Sedra.thu_short_leap;
|
|
149
|
+
}
|
|
150
|
+
else if (yearType === 'complete') {
|
|
151
|
+
sArray = Sedra.thu_long_leap;
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
throw 'improper sedra year type calculated.';
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const retobj = {
|
|
159
|
+
firstSatInYear: firstSatInYear,
|
|
160
|
+
sedraArray: sArray,
|
|
161
|
+
year: year,
|
|
162
|
+
israel: israel
|
|
163
|
+
};
|
|
164
|
+
//Save the data in case the next call is for the same year
|
|
165
|
+
Sedra.lastCalculatedYear = retobj;
|
|
166
|
+
return retobj;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
Sedra.lastCalculatedYear = null;
|
|
170
|
+
Sedra.sedraList = [{ eng: 'Bereshis', heb: 'בראשית' }, { eng: 'Noach', heb: 'נח' }, { eng: 'Lech-Lecha', heb: 'לך לך' }, { eng: 'Vayera', heb: 'וירא' }, { eng: 'Chayei Sara', heb: 'חיי שרה' }, { eng: 'Toldos', heb: 'תולדות' }, { eng: 'Vayetzei', heb: 'ויצא' }, { eng: 'Vayishlach', heb: 'וישלח' }, { eng: 'Vayeishev', heb: 'וישב' }, { eng: 'Mikeitz', heb: 'מקץ' }, { eng: 'Vayigash', heb: 'ויגש' }, { eng: 'Vayechi', heb: 'ויחי' }, { eng: 'Shemos', heb: 'שמות' }, { eng: 'Va\'era', heb: 'וארא' }, { eng: 'Bo', heb: 'בא' }, { eng: 'Beshalach', heb: 'בשלח' }, { eng: 'Yisro', heb: 'יתרו' }, { eng: 'Mishpatim', heb: 'משפטים' }, { eng: 'Terumah', heb: 'תרומה' }, { eng: 'Tetzaveh', heb: 'תצוה' }, { eng: 'Ki Sisa', heb: 'כי תשא' }, { eng: 'Vayakhel', heb: 'ויקהל' }, { eng: 'Pekudei', heb: 'פקודי' }, { eng: 'Vayikra', heb: 'ויקרא' }, { eng: 'Tzav', heb: 'צו' }, { eng: 'Shmini', heb: 'שמיני' }, { eng: 'Tazria', heb: 'תזריע' }, { eng: 'Metzora', heb: 'מצורע' }, { eng: 'Achrei Mos', heb: 'אחרי מות' }, { eng: 'Kedoshim', heb: 'קדושים' }, { eng: 'Emor', heb: 'אמור' }, { eng: 'Behar', heb: 'בהר' }, { eng: 'Bechukosai', heb: 'בחקותי' }, { eng: 'Bamidbar', heb: 'במדבר' }, { eng: 'Nasso', heb: 'נשא' }, { eng: 'Beha\'aloscha', heb: 'בהעלתך' }, { eng: 'Sh\'lach', heb: 'שלח' }, { eng: 'Korach', heb: 'קרח' }, { eng: 'Chukas', heb: 'חקת' }, { eng: 'Balak', heb: 'בלק' }, { eng: 'Pinchas', heb: 'פינחס' }, { eng: 'Matos', heb: 'מטות' }, { eng: 'Masei', heb: 'מסעי' }, { eng: 'Devarim', heb: 'דברים' }, { eng: 'Va\'eschanan', heb: 'ואתחנן' }, { eng: 'Eikev', heb: 'עקב' }, { eng: 'Re\'eh', heb: 'ראה' }, { eng: 'Shoftim', heb: 'שופטים' }, { eng: 'Ki Seitzei', heb: 'כי תצא' }, { eng: 'Ki Savo', heb: 'כי תבא' }, { eng: 'Nitzavim', heb: 'נצבים' }, { eng: 'Vayeilech', heb: 'וילך' }, { eng: 'Ha\'Azinu', heb: 'האזינו' }, { eng: 'Vezos Habracha', heb: 'וזאת הברכה' }];
|
|
171
|
+
Sedra.shabbos_short = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
172
|
+
Sedra.shabbos_long = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
173
|
+
Sedra.mon_short = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
174
|
+
Sedra.mon_long = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
175
|
+
Sedra.thu_normal = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
176
|
+
Sedra.thu_normal_Israel = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
177
|
+
Sedra.thu_long = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
178
|
+
Sedra.shabbos_short_leap = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
179
|
+
Sedra.shabbos_long_leap = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
180
|
+
Sedra.mon_short_leap = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
181
|
+
Sedra.mon_short_leap_Israel = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
182
|
+
Sedra.mon_long_leap = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
183
|
+
Sedra.mon_long_leap_Israel = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
184
|
+
Sedra.thu_short_leap = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
|
|
185
|
+
Sedra.thu_long_leap = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, -50];
|
|
186
|
+
exports.default = Sedra;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import jDate from './jDate';
|
|
2
|
+
import Location from './Location';
|
|
3
|
+
import { Time } from '../jcal-zmanim';
|
|
4
|
+
export default class Utils {
|
|
5
|
+
static jMonthsEng: string[];
|
|
6
|
+
static jMonthsHeb: string[];
|
|
7
|
+
static sMonthsEng: string[];
|
|
8
|
+
static dowEng: string[];
|
|
9
|
+
static dowHeb: string[];
|
|
10
|
+
static jsd: string[];
|
|
11
|
+
static jtd: string[];
|
|
12
|
+
static jhd: string[];
|
|
13
|
+
static jsnum: string[];
|
|
14
|
+
static jtnum: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets the Jewish representation of a number (365 = שס"ה)
|
|
17
|
+
* Minimum number is 1 and maximum is 9999.
|
|
18
|
+
* @param {Number} number
|
|
19
|
+
*/
|
|
20
|
+
static toJNum(number: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the javascript date in the format: Thursday, the 3rd of January 2018.
|
|
23
|
+
* @param {Date} date
|
|
24
|
+
* @param {Boolean} hideDayOfWeek
|
|
25
|
+
* @param {Boolean} dontCapitalize
|
|
26
|
+
*/
|
|
27
|
+
static toStringDate(date: Date, hideDayOfWeek: boolean, dontCapitalize: boolean): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the javascript date in the format: 1/3/2020.
|
|
30
|
+
* @param {Date} date
|
|
31
|
+
* @param {Boolean} monthFirst
|
|
32
|
+
*/
|
|
33
|
+
static toShortStringDate(date: Date, monthFirst: boolean): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Add two character suffix to number. e.g. 21st, 102nd, 93rd, 500th
|
|
36
|
+
* @param {Number} num
|
|
37
|
+
*/
|
|
38
|
+
static toSuffixed(num: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns if the given full secular year has a February 29th
|
|
41
|
+
* @param {Number} year
|
|
42
|
+
*/
|
|
43
|
+
static isSecularLeapYear(year: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Get day of week using Javascripts getDay function.
|
|
46
|
+
* Important note: months starts at 1 not 0 like javascript
|
|
47
|
+
* The DOW returned has Sunday = 0
|
|
48
|
+
* @param {Number} year
|
|
49
|
+
* @param {Number} month
|
|
50
|
+
* @param {Number} day
|
|
51
|
+
*/
|
|
52
|
+
static getSdDOW(year: number, month: number, day: number): number;
|
|
53
|
+
/**
|
|
54
|
+
* Makes sure hour is between 0 and 23 and minute is between 0 and 59.
|
|
55
|
+
* Overlaps get added/subtracted.
|
|
56
|
+
* The argument needs to be an object in the format {hour : 12, minute : 42, second : 18}
|
|
57
|
+
* @param {Time} time
|
|
58
|
+
*/
|
|
59
|
+
static fixTime(time: Time): {
|
|
60
|
+
hour: number;
|
|
61
|
+
minute: number;
|
|
62
|
+
second: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Add the given number of minutes to the given time.
|
|
66
|
+
* The argument needs to be an object in the format {hour : 12, minute : 42, second : 18 }
|
|
67
|
+
*
|
|
68
|
+
* @param {Time} time
|
|
69
|
+
* @param {Number} minutes
|
|
70
|
+
*/
|
|
71
|
+
static addMinutes(time?: Time, minutes?: number): Time | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Add the given number of seconds to the given time.
|
|
74
|
+
* The argument needs to be an object in the format {hour : 12, minute :42, second : 18}
|
|
75
|
+
*
|
|
76
|
+
* @param {Time} time
|
|
77
|
+
* @param {Number} seconds
|
|
78
|
+
*/
|
|
79
|
+
static addSeconds(time: Time, seconds: number): {
|
|
80
|
+
hour: number;
|
|
81
|
+
minute: number;
|
|
82
|
+
second: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Gets the time difference between two times of day.
|
|
86
|
+
* If showNegative is falsey, assumes that the earlier time is always before the later time.
|
|
87
|
+
* So, if laterTime is less than earlierTime, the returned diff is until the next day.
|
|
88
|
+
* Both arguments need to be an object in the format {hour : 12, minute : 42, second : 18 }
|
|
89
|
+
* @param {Time} earlierTime
|
|
90
|
+
* @param {Time} laterTime
|
|
91
|
+
* @param {Boolean} [showNegative] show negative values or assume second value is next day?
|
|
92
|
+
* @returns{{hour:number, minute:number, second:number, sign:1|-1}}
|
|
93
|
+
*/
|
|
94
|
+
static timeDiff(earlierTime: Time, laterTime: Time, showNegative?: boolean): {
|
|
95
|
+
sign: number;
|
|
96
|
+
hour: number;
|
|
97
|
+
minute: number;
|
|
98
|
+
second: number;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Gets the total number of minutes in the given time.
|
|
102
|
+
* @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
|
|
103
|
+
*/
|
|
104
|
+
static totalMinutes(time: Time): number;
|
|
105
|
+
/**
|
|
106
|
+
* Gets the total number of seconds in the given time.
|
|
107
|
+
* @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
|
|
108
|
+
*/
|
|
109
|
+
static totalSeconds(time: Time): number;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the time of the given javascript date as an object in the format of {hour : 23, minute :42, second: 18 }
|
|
112
|
+
* @param {Date} sdate
|
|
113
|
+
* @returns {{hour :number, minute :number, second:number }}
|
|
114
|
+
*/
|
|
115
|
+
static timeFromDate(sdate: Date): {
|
|
116
|
+
hour: number;
|
|
117
|
+
minute: number;
|
|
118
|
+
second: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Determines if the second given time is after (or at) the first given time
|
|
122
|
+
* @param {{hour :number, minute :number, second:number }} beforeTime
|
|
123
|
+
* @param {{hour :number, minute :number, second:number }} afterTime
|
|
124
|
+
*/
|
|
125
|
+
static isTimeAfter(beforeTime?: Time, afterTime?: Time): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the given time interval in a formatted string.
|
|
128
|
+
* @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
129
|
+
*/
|
|
130
|
+
static getTimeIntervalTextStringHeb(time: Time): string;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the given time interval in a formatted string.
|
|
133
|
+
* @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
134
|
+
*/
|
|
135
|
+
static getTimeIntervalTextString(time: Time): string;
|
|
136
|
+
/**
|
|
137
|
+
* Returns the nusach for Sefiras Ha'omer for the given day and minhag
|
|
138
|
+
* @param {number} dayOfOmer The day of the Omer for which to get the nusach for
|
|
139
|
+
* @param {'ashkenaz'|'sefard'|'sefardi'} nusach Should it be La'Omer ("sefard") or Ba'Omer ("ashkenaz") or "sefardi" (Eidot Hamizrach)?
|
|
140
|
+
*/
|
|
141
|
+
static getOmerNusach(dayOfOmer: number, nusach: 'ashkenaz' | 'sefard' | 'sefardi'): string;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the given time in a formatted string.
|
|
144
|
+
* @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
145
|
+
* @param {1 | -1} [sign]
|
|
146
|
+
* @param {Boolean} [army] If falsey, the returned string will be: 11:42:18 PM otherwise it will be 23:42:18
|
|
147
|
+
* @param {Boolean} [roundUp] If falsey, the numbers will converted to a whole number by rounding down, otherwise, up.
|
|
148
|
+
*/
|
|
149
|
+
static getTimeString(time: Time, sign?: 1 | -1, army?: boolean, roundUp?: boolean): string;
|
|
150
|
+
/**
|
|
151
|
+
* Gets the UTC offset in whole hours for the users time zone.
|
|
152
|
+
* Note: this is not affected by DST - unlike javascripts getTimezoneOffset() function which gives you the current offset.
|
|
153
|
+
*/
|
|
154
|
+
static currUtcOffset(): number;
|
|
155
|
+
/** Determines if the given date is within DST on the users system */
|
|
156
|
+
static isDateDST(date: Date): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Determines if the given date is within DST in the given location
|
|
159
|
+
* Note: This may not be correct if the user has set the Location to a
|
|
160
|
+
* time zone outside Israel or the USA which is not the current system time zone.
|
|
161
|
+
*/
|
|
162
|
+
static isDST(location: Location, date: Date): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Determines if the given javascript date is during DST according to the USA rules
|
|
165
|
+
* @param {Date} date A javascript Date object
|
|
166
|
+
*/
|
|
167
|
+
static isUSA_DST(date: Date): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Determines if the given Javascript date is during DST according to the current (5776) Israeli rules
|
|
170
|
+
* @param {Date} date A Javascript Date object
|
|
171
|
+
*/
|
|
172
|
+
static isIsrael_DST(date: Date): boolean;
|
|
173
|
+
/** The current time in Israel - determined by the current users system time and time zone offset*/
|
|
174
|
+
static getSdNowInIsrael(): Date;
|
|
175
|
+
/**
|
|
176
|
+
* Adds the given number of days to the given javascript date and returns the new date
|
|
177
|
+
* @param {Date} sdate
|
|
178
|
+
* @param {Number} days
|
|
179
|
+
*/
|
|
180
|
+
static addDaysToSdate(sdate: Date, days: number): Date;
|
|
181
|
+
/**
|
|
182
|
+
* Compares two js dates to se if they both refer to the same day - time is ignored.
|
|
183
|
+
* @param {Date} sdate1
|
|
184
|
+
* @param {Date} sdate2
|
|
185
|
+
*/
|
|
186
|
+
static isSameSdate(sdate1: Date, sdate2: Date): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Compares two jDates to se if they both refer to the same day - time is ignored.
|
|
189
|
+
* @param {jDate} jdate1
|
|
190
|
+
* @param {jDate} jdate2
|
|
191
|
+
*/
|
|
192
|
+
static isSameJdate(jdate1: jDate, jdate2: jDate): boolean | 0;
|
|
193
|
+
/**
|
|
194
|
+
* Compares two jDates to see if they both refer to the same Jewish Month.
|
|
195
|
+
* @param {jDate} jdate1
|
|
196
|
+
* @param {jDate} jdate2
|
|
197
|
+
*/
|
|
198
|
+
static isSameJMonth(jdate1: jDate, jdate2: jDate): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Compares two dates to se if they both refer to the same Secular Month.
|
|
201
|
+
* @param {Date} sdate1
|
|
202
|
+
* @param {Date} sdate2
|
|
203
|
+
*/
|
|
204
|
+
static isSameSMonth(sdate1: Date, sdate2: Date): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Determines if the time of the given Date() is after sunset at the given Location
|
|
207
|
+
* @param {Date} sdate
|
|
208
|
+
* @param {Location} location
|
|
209
|
+
*/
|
|
210
|
+
static isAfterSunset(sdate: Date, location: Location): boolean | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Gets the current Jewish Date at the given Location
|
|
213
|
+
* @param {Location} location
|
|
214
|
+
*/
|
|
215
|
+
static nowAtLocation(location: Location): jDate;
|
|
216
|
+
/**
|
|
217
|
+
* Converts the given complex number to an integer by removing the decimal part.
|
|
218
|
+
* Returns same results as Math.floor for positive numbers and Math.ceil for negative ones.
|
|
219
|
+
* Almost identical functionality to Math.trunc and parseInt.
|
|
220
|
+
* The difference is if the argument is NaN. Math.trunc returns NaN while ths fuction returns 0.
|
|
221
|
+
* In performance tests, this function was found to be quicker than the alternatives.
|
|
222
|
+
* @param {Number} float The complex number to convert to an integer
|
|
223
|
+
*/
|
|
224
|
+
static toInt(float: number): number;
|
|
225
|
+
}
|