jcal-zmanim 1.1.5 → 1.1.7
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/dist/JCal/Dafyomi.js +9 -14
- package/dist/JCal/Dafyomi.js.map +1 -1
- package/dist/JCal/Location.js +1 -4
- package/dist/JCal/Location.js.map +1 -1
- package/dist/JCal/Molad.js +19 -25
- package/dist/JCal/Molad.js.map +1 -1
- package/dist/JCal/PirkeiAvos.js +7 -12
- package/dist/JCal/PirkeiAvos.js.map +1 -1
- package/dist/JCal/Sedra.js +4 -9
- package/dist/JCal/Sedra.js.map +1 -1
- package/dist/JCal/Zmanim.js +18 -24
- package/dist/JCal/Zmanim.js.map +1 -1
- package/dist/JCal/ZmanimUtils.js +86 -92
- package/dist/JCal/ZmanimUtils.js.map +1 -1
- package/dist/JCal/jDate.js +36 -42
- package/dist/JCal/jDate.js.map +1 -1
- package/dist/Locations.js +6 -15
- package/dist/Locations.js.map +1 -1
- package/dist/Notifications.js +109 -116
- package/dist/Notifications.js.map +1 -1
- package/dist/Utils.js +14 -21
- package/dist/Utils.js.map +1 -1
- package/dist/ZmanTypes.js +28 -32
- package/dist/ZmanTypes.js.map +1 -1
- package/dist/index.js +36 -39
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/JCal/ZmanimUtils.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WhichDaysFlags = void 0;
|
|
7
|
-
const Utils_1 = require("../Utils");
|
|
8
|
-
const Zmanim_1 = __importDefault(require("./Zmanim"));
|
|
9
|
-
const ZmanTypes_1 = require("../ZmanTypes");
|
|
10
|
-
exports.WhichDaysFlags = Object.freeze({
|
|
1
|
+
import { Utils, DaysOfWeek } from '../Utils';
|
|
2
|
+
import Zmanim from './Zmanim';
|
|
3
|
+
import { ZmanTypes, ZmanTypeIds, getZmanType } from '../ZmanTypes';
|
|
4
|
+
export const WhichDaysFlags = Object.freeze({
|
|
11
5
|
SUNDAY: 1,
|
|
12
6
|
MONDAY: 2,
|
|
13
7
|
TUESDAY: 4,
|
|
@@ -27,7 +21,7 @@ class ZmanimUtils {
|
|
|
27
21
|
* @returns{[{zmanType:{id:number,offset:?number,desc:string,eng:string,heb:string },time:Time}]}
|
|
28
22
|
*/
|
|
29
23
|
static getZmanTimes(zmanTypes, date, jdate, location) {
|
|
30
|
-
const mem = ZmanimUtils.zmanTimesCache.find((z) =>
|
|
24
|
+
const mem = ZmanimUtils.zmanTimesCache.find((z) => Utils.isSameSdate(z.date, date) &&
|
|
31
25
|
z.location.Name === location.Name), zmanTimes = [], whichDay = ZmanimUtils.getWhichDays(date, jdate, location);
|
|
32
26
|
let sunrise, sunset, suntimesMishor, sunriseMishor, sunsetMishor, mishorNeg90, chatzos, shaaZmanis, shaaZmanisMga;
|
|
33
27
|
if (mem) {
|
|
@@ -42,25 +36,25 @@ class ZmanimUtils {
|
|
|
42
36
|
shaaZmanisMga = mem.shaaZmanisMga;
|
|
43
37
|
}
|
|
44
38
|
else {
|
|
45
|
-
const suntimes =
|
|
39
|
+
const suntimes = Zmanim.getSunTimes(date, location, true);
|
|
46
40
|
sunrise = suntimes.sunrise;
|
|
47
41
|
sunset = suntimes.sunset;
|
|
48
|
-
suntimesMishor =
|
|
42
|
+
suntimesMishor = Zmanim.getSunTimes(date, location, false);
|
|
49
43
|
sunriseMishor = suntimesMishor.sunrise;
|
|
50
44
|
sunsetMishor = suntimesMishor.sunset;
|
|
51
|
-
mishorNeg90 =
|
|
45
|
+
mishorNeg90 = Utils.addMinutes(sunriseMishor, -90);
|
|
52
46
|
chatzos =
|
|
53
47
|
sunriseMishor &&
|
|
54
48
|
sunsetMishor &&
|
|
55
|
-
|
|
49
|
+
Zmanim.getChatzosFromSuntimes(suntimesMishor);
|
|
56
50
|
shaaZmanis =
|
|
57
51
|
sunriseMishor &&
|
|
58
52
|
sunsetMishor &&
|
|
59
|
-
|
|
53
|
+
Zmanim.getShaaZmanisFromSunTimes(suntimesMishor);
|
|
60
54
|
shaaZmanisMga =
|
|
61
55
|
sunriseMishor &&
|
|
62
56
|
sunsetMishor &&
|
|
63
|
-
|
|
57
|
+
Zmanim.getShaaZmanisMga(suntimesMishor, true);
|
|
64
58
|
ZmanimUtils.zmanTimesCache.push({
|
|
65
59
|
date,
|
|
66
60
|
location,
|
|
@@ -81,181 +75,181 @@ class ZmanimUtils {
|
|
|
81
75
|
? zmanType.offset
|
|
82
76
|
: 0;
|
|
83
77
|
switch (zmanType.id) {
|
|
84
|
-
case
|
|
78
|
+
case ZmanTypeIds.ChatzosLayla: // chatzosNight
|
|
85
79
|
zmanTimes.push({
|
|
86
80
|
zmanType,
|
|
87
|
-
time:
|
|
81
|
+
time: Utils.addMinutes(chatzos, 720 + offset),
|
|
88
82
|
});
|
|
89
83
|
break;
|
|
90
|
-
case
|
|
84
|
+
case ZmanTypeIds.Alos90: // alos90
|
|
91
85
|
zmanTimes.push({
|
|
92
86
|
zmanType,
|
|
93
87
|
time: offset
|
|
94
|
-
?
|
|
88
|
+
? Utils.addMinutes(mishorNeg90, offset)
|
|
95
89
|
: mishorNeg90,
|
|
96
90
|
});
|
|
97
91
|
break;
|
|
98
|
-
case
|
|
92
|
+
case ZmanTypeIds.Alos72: // alos72
|
|
99
93
|
zmanTimes.push({
|
|
100
94
|
zmanType,
|
|
101
|
-
time:
|
|
95
|
+
time: Utils.addMinutes(sunriseMishor, -72 + offset),
|
|
102
96
|
});
|
|
103
97
|
break;
|
|
104
|
-
case
|
|
98
|
+
case ZmanTypeIds.TalisTefillin: //talisTefillin
|
|
105
99
|
zmanTimes.push({
|
|
106
100
|
zmanType,
|
|
107
|
-
time:
|
|
101
|
+
time: Utils.addMinutes(sunriseMishor, -36 + offset),
|
|
108
102
|
});
|
|
109
103
|
break;
|
|
110
|
-
case
|
|
104
|
+
case ZmanTypeIds.NetzAtElevation: //netzElevation
|
|
111
105
|
zmanTimes.push({
|
|
112
106
|
zmanType,
|
|
113
107
|
time: offset
|
|
114
|
-
?
|
|
108
|
+
? Utils.addMinutes(sunrise, offset)
|
|
115
109
|
: sunrise,
|
|
116
110
|
});
|
|
117
111
|
break;
|
|
118
|
-
case
|
|
112
|
+
case ZmanTypeIds.NetzMishor: // netzMishor:
|
|
119
113
|
zmanTimes.push({
|
|
120
114
|
zmanType,
|
|
121
115
|
time: offset
|
|
122
|
-
?
|
|
116
|
+
? Utils.addMinutes(sunriseMishor, offset)
|
|
123
117
|
: sunriseMishor,
|
|
124
118
|
});
|
|
125
119
|
break;
|
|
126
|
-
case
|
|
120
|
+
case ZmanTypeIds.szksMga: //szksMga
|
|
127
121
|
if (shaaZmanisMga)
|
|
128
122
|
zmanTimes.push({
|
|
129
123
|
zmanType,
|
|
130
|
-
time:
|
|
124
|
+
time: Utils.addMinutes(mishorNeg90, Math.floor(shaaZmanisMga * 3) + offset),
|
|
131
125
|
});
|
|
132
126
|
break;
|
|
133
|
-
case
|
|
127
|
+
case ZmanTypeIds.szksGra: //szksGra
|
|
134
128
|
if (shaaZmanis)
|
|
135
129
|
zmanTimes.push({
|
|
136
130
|
zmanType,
|
|
137
|
-
time:
|
|
131
|
+
time: Utils.addMinutes(sunriseMishor, Math.floor(shaaZmanis * 3) + offset),
|
|
138
132
|
});
|
|
139
133
|
break;
|
|
140
|
-
case
|
|
134
|
+
case ZmanTypeIds.sztMga: // sztMga
|
|
141
135
|
if (shaaZmanisMga)
|
|
142
136
|
zmanTimes.push({
|
|
143
137
|
zmanType,
|
|
144
|
-
time:
|
|
138
|
+
time: Utils.addMinutes(mishorNeg90, Math.floor(shaaZmanisMga * 4) + offset),
|
|
145
139
|
});
|
|
146
140
|
break;
|
|
147
|
-
case
|
|
141
|
+
case ZmanTypeIds.sztGra: //sztGra
|
|
148
142
|
if (shaaZmanis)
|
|
149
143
|
zmanTimes.push({
|
|
150
144
|
zmanType,
|
|
151
|
-
time:
|
|
145
|
+
time: Utils.addMinutes(sunriseMishor, Math.floor(shaaZmanis * 4) + offset),
|
|
152
146
|
});
|
|
153
147
|
break;
|
|
154
|
-
case
|
|
148
|
+
case ZmanTypeIds.chatzosDay: //chatzos
|
|
155
149
|
zmanTimes.push({
|
|
156
150
|
zmanType,
|
|
157
151
|
time: offset
|
|
158
|
-
?
|
|
152
|
+
? Utils.addMinutes(chatzos, offset)
|
|
159
153
|
: chatzos,
|
|
160
154
|
});
|
|
161
155
|
break;
|
|
162
|
-
case
|
|
156
|
+
case ZmanTypeIds.minGed: //minGed
|
|
163
157
|
if (shaaZmanis)
|
|
164
158
|
zmanTimes.push({
|
|
165
159
|
zmanType,
|
|
166
|
-
time:
|
|
160
|
+
time: Utils.addMinutes(chatzos, shaaZmanis * 0.5 + offset),
|
|
167
161
|
});
|
|
168
162
|
break;
|
|
169
|
-
case
|
|
163
|
+
case ZmanTypeIds.minKet: //minKet
|
|
170
164
|
if (shaaZmanis)
|
|
171
165
|
zmanTimes.push({
|
|
172
166
|
zmanType,
|
|
173
|
-
time:
|
|
167
|
+
time: Utils.addMinutes(sunriseMishor, shaaZmanis * 9.5 + offset),
|
|
174
168
|
});
|
|
175
169
|
break;
|
|
176
|
-
case
|
|
170
|
+
case ZmanTypeIds.plag: //plag
|
|
177
171
|
if (shaaZmanis)
|
|
178
172
|
zmanTimes.push({
|
|
179
173
|
zmanType,
|
|
180
|
-
time:
|
|
174
|
+
time: Utils.addMinutes(sunriseMishor, shaaZmanis * 10.75 + offset),
|
|
181
175
|
});
|
|
182
176
|
break;
|
|
183
|
-
case
|
|
177
|
+
case ZmanTypeIds.shkiaAtSeaLevel: //shkiaMishor
|
|
184
178
|
zmanTimes.push({
|
|
185
179
|
zmanType,
|
|
186
180
|
time: offset
|
|
187
|
-
?
|
|
181
|
+
? Utils.addMinutes(sunsetMishor, offset)
|
|
188
182
|
: sunsetMishor,
|
|
189
183
|
});
|
|
190
184
|
break;
|
|
191
|
-
case
|
|
185
|
+
case ZmanTypeIds.shkiaElevation: //shkiaElevation
|
|
192
186
|
zmanTimes.push({
|
|
193
187
|
zmanType,
|
|
194
188
|
time: offset
|
|
195
|
-
?
|
|
189
|
+
? Utils.addMinutes(sunset, offset)
|
|
196
190
|
: sunset,
|
|
197
191
|
});
|
|
198
192
|
break;
|
|
199
|
-
case
|
|
193
|
+
case ZmanTypeIds.tzais45: // tzais45
|
|
200
194
|
zmanTimes.push({
|
|
201
195
|
zmanType,
|
|
202
|
-
time:
|
|
196
|
+
time: Utils.addMinutes(sunset, 45 + offset),
|
|
203
197
|
});
|
|
204
198
|
break;
|
|
205
|
-
case
|
|
199
|
+
case ZmanTypeIds.tzais50: //tzais50
|
|
206
200
|
zmanTimes.push({
|
|
207
201
|
zmanType,
|
|
208
|
-
time:
|
|
202
|
+
time: Utils.addMinutes(sunset, 50 + offset),
|
|
209
203
|
});
|
|
210
204
|
break;
|
|
211
|
-
case
|
|
205
|
+
case ZmanTypeIds.tzais72: //tzais72
|
|
212
206
|
zmanTimes.push({
|
|
213
207
|
zmanType,
|
|
214
|
-
time:
|
|
208
|
+
time: Utils.addMinutes(sunset, 72 + offset),
|
|
215
209
|
});
|
|
216
210
|
break;
|
|
217
|
-
case
|
|
211
|
+
case ZmanTypeIds.rabbeinuTamZmanios: //tzais72Zmaniot
|
|
218
212
|
if (shaaZmanis)
|
|
219
213
|
zmanTimes.push({
|
|
220
214
|
zmanType,
|
|
221
|
-
time:
|
|
215
|
+
time: Utils.addMinutes(sunset, shaaZmanis * 1.2 + offset),
|
|
222
216
|
});
|
|
223
217
|
break;
|
|
224
|
-
case
|
|
218
|
+
case ZmanTypeIds.rabbeinuTamZmaniosMga: //tzais72ZmaniotMA
|
|
225
219
|
if (shaaZmanisMga)
|
|
226
220
|
zmanTimes.push({
|
|
227
221
|
zmanType,
|
|
228
|
-
time:
|
|
222
|
+
time: Utils.addMinutes(sunset, shaaZmanisMga * 1.2 + offset),
|
|
229
223
|
});
|
|
230
224
|
break;
|
|
231
|
-
case
|
|
225
|
+
case ZmanTypeIds.candleLighting: //candleLighting
|
|
232
226
|
if (sunset && jdate.hasCandleLighting()) {
|
|
233
227
|
zmanTimes.push({
|
|
234
228
|
zmanType,
|
|
235
|
-
time:
|
|
229
|
+
time: Utils.addMinutes(Zmanim.getCandleLightingFromSunset(sunset, location), offset),
|
|
236
230
|
});
|
|
237
231
|
}
|
|
238
232
|
break;
|
|
239
|
-
case
|
|
233
|
+
case ZmanTypeIds.SofZmanEatingChometz: //Sof Zman Achilas Chometz
|
|
240
234
|
if (shaaZmanisMga && jdate.Month === 1 &&
|
|
241
235
|
jdate.Day === 14 &&
|
|
242
|
-
|
|
236
|
+
Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))) {
|
|
243
237
|
zmanTimes.push({
|
|
244
238
|
zmanType,
|
|
245
|
-
time:
|
|
239
|
+
time: Utils.addMinutes(sunrise, -90 + offset + shaaZmanisMga * 4),
|
|
246
240
|
});
|
|
247
241
|
}
|
|
248
242
|
break;
|
|
249
|
-
case
|
|
243
|
+
case ZmanTypeIds.SofZmanBurnChometz: //Sof Zman Biur Chometz
|
|
250
244
|
if (shaaZmanisMga &&
|
|
251
245
|
jdate.Month === 1 &&
|
|
252
246
|
(jdate.Day === 14 ||
|
|
253
|
-
(jdate.DayOfWeek ===
|
|
247
|
+
(jdate.DayOfWeek === DaysOfWeek.FRIDAY &&
|
|
254
248
|
jdate.Day === 13)) &&
|
|
255
|
-
|
|
249
|
+
Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))) {
|
|
256
250
|
zmanTimes.push({
|
|
257
251
|
zmanType,
|
|
258
|
-
time:
|
|
252
|
+
time: Utils.addMinutes(sunrise, -90 + offset + shaaZmanisMga * 5),
|
|
259
253
|
});
|
|
260
254
|
}
|
|
261
255
|
break;
|
|
@@ -271,23 +265,23 @@ class ZmanimUtils {
|
|
|
271
265
|
*/
|
|
272
266
|
static getWhichDays(date, jdate, location) {
|
|
273
267
|
if (jdate.isYomTov(!!location.Israel)) {
|
|
274
|
-
return
|
|
268
|
+
return WhichDaysFlags.YOMTOV;
|
|
275
269
|
}
|
|
276
270
|
switch (date.getDay()) {
|
|
277
|
-
case
|
|
278
|
-
return
|
|
279
|
-
case
|
|
280
|
-
return
|
|
281
|
-
case
|
|
282
|
-
return
|
|
283
|
-
case
|
|
284
|
-
return
|
|
285
|
-
case
|
|
286
|
-
return
|
|
287
|
-
case
|
|
288
|
-
return
|
|
289
|
-
case
|
|
290
|
-
return
|
|
271
|
+
case DaysOfWeek.SUNDAY:
|
|
272
|
+
return WhichDaysFlags.SUNDAY;
|
|
273
|
+
case DaysOfWeek.MONDAY:
|
|
274
|
+
return WhichDaysFlags.MONDAY;
|
|
275
|
+
case DaysOfWeek.TUESDAY:
|
|
276
|
+
return WhichDaysFlags.TUESDAY;
|
|
277
|
+
case DaysOfWeek.WEDNESDAY:
|
|
278
|
+
return WhichDaysFlags.WEDNESDAY;
|
|
279
|
+
case DaysOfWeek.THURSDAY:
|
|
280
|
+
return WhichDaysFlags.THURSDAY;
|
|
281
|
+
case DaysOfWeek.FRIDAY:
|
|
282
|
+
return WhichDaysFlags.FRIDAY;
|
|
283
|
+
case DaysOfWeek.SHABBOS:
|
|
284
|
+
return WhichDaysFlags.SHABBOS;
|
|
291
285
|
}
|
|
292
286
|
return 0;
|
|
293
287
|
}
|
|
@@ -298,16 +292,16 @@ class ZmanimUtils {
|
|
|
298
292
|
* @returns {{chatzosHayom:Time, chatzosHalayla:Time, alos:Time, shkia:Time }}
|
|
299
293
|
*/
|
|
300
294
|
static getBasicShulZmanim(date, location) {
|
|
301
|
-
const { sdate, jdate } =
|
|
295
|
+
const { sdate, jdate } = Utils.bothDates(date);
|
|
302
296
|
const zmanim = ZmanimUtils.getZmanTimes([
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
297
|
+
getZmanType(ZmanTypeIds.chatzosDay),
|
|
298
|
+
getZmanType(ZmanTypeIds.Alos90),
|
|
299
|
+
getZmanType(ZmanTypeIds.shkiaElevation),
|
|
300
|
+
getZmanType(ZmanTypeIds.candleLighting),
|
|
307
301
|
], sdate, jdate, location);
|
|
308
302
|
return {
|
|
309
303
|
chatzosHayom: zmanim[0].time,
|
|
310
|
-
chatzosHalayla:
|
|
304
|
+
chatzosHalayla: Utils.addMinutes(zmanim[0].time, 720),
|
|
311
305
|
alos: zmanim[1].time,
|
|
312
306
|
shkia: zmanim[2].time,
|
|
313
307
|
};
|
|
@@ -319,10 +313,10 @@ class ZmanimUtils {
|
|
|
319
313
|
* @returns {{zmanType:ZmanToShow, time?:Time }[]}
|
|
320
314
|
*/
|
|
321
315
|
static getAllZmanim(date, location) {
|
|
322
|
-
const { sdate, jdate } =
|
|
323
|
-
return ZmanimUtils.getZmanTimes(
|
|
316
|
+
const { sdate, jdate } = Utils.bothDates(date);
|
|
317
|
+
return ZmanimUtils.getZmanTimes(ZmanTypes, sdate, jdate, location);
|
|
324
318
|
}
|
|
325
319
|
}
|
|
326
320
|
ZmanimUtils.zmanTimesCache = [];
|
|
327
|
-
|
|
321
|
+
export default ZmanimUtils;
|
|
328
322
|
//# sourceMappingURL=ZmanimUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZmanimUtils.js","sourceRoot":"","sources":["../../src/JCal/ZmanimUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ZmanimUtils.js","sourceRoot":"","sources":["../../src/JCal/ZmanimUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgBnE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,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ACxB,CAAC;IACN,CAAC;IAED;;;;;MAKE;IACF,MAAM,CAAC,YAAY,CAAC,IAAkB,EAAE,QAAkB;QACtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,WAAW,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAE,CAAC;IACxE,CAAC;;AA7WM,0BAAc,GAAe,EAAE,CAAC;eADtB,WAAW"}
|
package/dist/JCal/jDate.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Utils_js_1 = require("../Utils.js");
|
|
7
|
-
const Sedra_js_1 = __importDefault(require("./Sedra.js"));
|
|
8
|
-
const PirkeiAvos_js_1 = __importDefault(require("./PirkeiAvos.js"));
|
|
9
|
-
const Zmanim_js_1 = __importDefault(require("./Zmanim.js"));
|
|
10
|
-
const Dafyomi_1 = __importDefault(require("./Dafyomi"));
|
|
1
|
+
import { Utils, DaysOfWeekEng, JewishMonthsEng, DaysOfWeekHeb, JewishMonthsHeb } from '../Utils.js';
|
|
2
|
+
import Sedra from './Sedra.js';
|
|
3
|
+
import PirkeiAvos from './PirkeiAvos.js';
|
|
4
|
+
import Zmanim from './Zmanim.js';
|
|
5
|
+
import DafYomi from './Dafyomi';
|
|
11
6
|
/** Keeps a "memcache" of years that have had their elapsed days previously calculated. Format: { year:5776, elapsed:2109283 } */
|
|
12
7
|
const _yearCache = [],
|
|
13
8
|
//The absolute date for the zero hour of all javascript date objects - 1/1/1970 0:00:00 UTC
|
|
@@ -22,7 +17,7 @@ JS_START_OFFSET = new Date(0).getTimezoneOffset();
|
|
|
22
17
|
* in Software---Practice & Experience, vol. 20, no. 9 (September, 1990), pp. 899--928.
|
|
23
18
|
* ****************************************************************************************************************/
|
|
24
19
|
/** Represents a single day in the Jewish Calendar. */
|
|
25
|
-
class jDate {
|
|
20
|
+
export default class jDate {
|
|
26
21
|
/**
|
|
27
22
|
* Create a new Jdate.
|
|
28
23
|
* new jDate() - Sets the Jewish Date for the current system date
|
|
@@ -54,7 +49,7 @@ class jDate {
|
|
|
54
49
|
this.fromAbs(jDate.absSd(new Date()));
|
|
55
50
|
}
|
|
56
51
|
else if (arg instanceof Date) {
|
|
57
|
-
if (
|
|
52
|
+
if (Utils.isValidDate(arg)) {
|
|
58
53
|
this.fromAbs(jDate.absSd(arg));
|
|
59
54
|
}
|
|
60
55
|
else {
|
|
@@ -69,9 +64,9 @@ class jDate {
|
|
|
69
64
|
(arg.length > 3 && arg[3]) ||
|
|
70
65
|
jDate.absJd(this.Year, this.Month, this.Day);
|
|
71
66
|
}
|
|
72
|
-
else if (arg &&
|
|
67
|
+
else if (arg && Utils.isString(arg)) {
|
|
73
68
|
const d = new Date(arg);
|
|
74
|
-
if (
|
|
69
|
+
if (Utils.isValidDate(d)) {
|
|
75
70
|
this.fromAbs(jDate.absSd(d));
|
|
76
71
|
}
|
|
77
72
|
else {
|
|
@@ -80,7 +75,7 @@ class jDate {
|
|
|
80
75
|
'" cannot be parsed into a Date');
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
|
-
else if (
|
|
78
|
+
else if (Utils.isNumber(arg)) {
|
|
84
79
|
//if no other arguments were supplied, we assume that the supplied number is an absolute date
|
|
85
80
|
if (arguments.length === 1) {
|
|
86
81
|
this.fromAbs(arg);
|
|
@@ -97,7 +92,7 @@ class jDate {
|
|
|
97
92
|
//If arg is an object that has a "year" property that contains a valid value...
|
|
98
93
|
else if (typeof arg === 'object') {
|
|
99
94
|
const argObj = arg;
|
|
100
|
-
if (
|
|
95
|
+
if (Utils.isNumber(argObj.year)) {
|
|
101
96
|
this.Day = argObj.day || 1;
|
|
102
97
|
this.Month = argObj.month || 7;
|
|
103
98
|
this.Year = argObj.year;
|
|
@@ -269,9 +264,9 @@ class jDate {
|
|
|
269
264
|
? dontCapitalize
|
|
270
265
|
? 't'
|
|
271
266
|
: 'T'
|
|
272
|
-
:
|
|
267
|
+
: DaysOfWeekEng[this.getDayOfWeek()] + ', t') +
|
|
273
268
|
'he ' +
|
|
274
|
-
|
|
269
|
+
Utils.toSuffixed(this.Day) +
|
|
275
270
|
' of ' +
|
|
276
271
|
this.monthName());
|
|
277
272
|
}
|
|
@@ -280,8 +275,8 @@ class jDate {
|
|
|
280
275
|
* @param {boolean} showDow - show day of week?
|
|
281
276
|
*/
|
|
282
277
|
toShortstring(showDow) {
|
|
283
|
-
return ((showDow ?
|
|
284
|
-
|
|
278
|
+
return ((showDow ? DaysOfWeekEng[this.getDayOfWeek()] + ' ' : '') +
|
|
279
|
+
JewishMonthsEng[this.Month] +
|
|
285
280
|
' ' +
|
|
286
281
|
this.Day.toString() +
|
|
287
282
|
', ' +
|
|
@@ -292,18 +287,18 @@ class jDate {
|
|
|
292
287
|
* @param {boolean} showYear - show the year number?
|
|
293
288
|
*/
|
|
294
289
|
monthName(showYear = true) {
|
|
295
|
-
return (
|
|
290
|
+
return (JewishMonthsEng[this.Month] +
|
|
296
291
|
(showYear ? ' ' + this.Year.toString() : ''));
|
|
297
292
|
}
|
|
298
293
|
/**Returns the current Jewish date in the format: יום חמישי כ"א כסלו תשע"ו.*/
|
|
299
294
|
toStringHeb() {
|
|
300
|
-
return (
|
|
295
|
+
return (DaysOfWeekHeb[this.getDayOfWeek()] +
|
|
301
296
|
' ' +
|
|
302
|
-
|
|
297
|
+
Utils.toJewishNumber(this.Day) +
|
|
303
298
|
' ' +
|
|
304
|
-
|
|
299
|
+
JewishMonthsHeb[this.Month] +
|
|
305
300
|
' ' +
|
|
306
|
-
|
|
301
|
+
Utils.toJewishNumber(this.Year % 1000));
|
|
307
302
|
}
|
|
308
303
|
/**Gets the day of the omer for the current Jewish date. If the date is not during sefira, 0 is returned.*/
|
|
309
304
|
getDayOfOmer() {
|
|
@@ -354,10 +349,10 @@ class jDate {
|
|
|
354
349
|
}
|
|
355
350
|
/**Is today Erev Yom Tov? (includes Erev second days of Sukkos and Pesach) */
|
|
356
351
|
isErevYomTov() {
|
|
357
|
-
return ((this.Month === 1 &&
|
|
352
|
+
return ((this.Month === 1 && Utils.has(this.Day, 14, 20)) ||
|
|
358
353
|
(this.Month === 3 && this.Day === 5) ||
|
|
359
354
|
(this.Month === 6 && this.Day === 29) ||
|
|
360
|
-
(this.Month === 7 &&
|
|
355
|
+
(this.Month === 7 && Utils.has(this.Day, 9, 14, 21)));
|
|
361
356
|
}
|
|
362
357
|
/**Does the current Jewish date have candle lighting before sunset?*/
|
|
363
358
|
hasCandleLighting() {
|
|
@@ -390,7 +385,7 @@ class jDate {
|
|
|
390
385
|
throw 'To get sunrise and sunset, the location needs to be supplied';
|
|
391
386
|
}
|
|
392
387
|
if (this.hasCandleLighting()) {
|
|
393
|
-
return
|
|
388
|
+
return Zmanim.getCandleLighting(this, location);
|
|
394
389
|
}
|
|
395
390
|
else if (nullIfNoCandles) {
|
|
396
391
|
return null;
|
|
@@ -401,11 +396,11 @@ class jDate {
|
|
|
401
396
|
}
|
|
402
397
|
/**Get the sedra of the week for the current Jewish date.*/
|
|
403
398
|
getSedra(israel) {
|
|
404
|
-
return new
|
|
399
|
+
return new Sedra(this, israel);
|
|
405
400
|
}
|
|
406
401
|
/**Get the prakim of Pirkei Avos for the current Jewish date.*/
|
|
407
402
|
getPirkeiAvos(israel) {
|
|
408
|
-
return
|
|
403
|
+
return PirkeiAvos.getPrakim(this, israel);
|
|
409
404
|
}
|
|
410
405
|
/**Gets sunrise and sunset time for the current Jewish date at the given Location.
|
|
411
406
|
*
|
|
@@ -414,7 +409,7 @@ class jDate {
|
|
|
414
409
|
if (!location) {
|
|
415
410
|
throw 'To get sunrise and sunset, the location needs to be supplied';
|
|
416
411
|
}
|
|
417
|
-
return
|
|
412
|
+
return Zmanim.getSunTimes(this, location, !ignoreElevation);
|
|
418
413
|
}
|
|
419
414
|
/**Gets Chatzos for both the day and the night for the current Jewish date at the given Location.
|
|
420
415
|
*
|
|
@@ -423,22 +418,22 @@ class jDate {
|
|
|
423
418
|
if (!location) {
|
|
424
419
|
throw 'To get Chatzos, the location needs to be supplied';
|
|
425
420
|
}
|
|
426
|
-
return
|
|
421
|
+
return Zmanim.getChatzos(this, location);
|
|
427
422
|
}
|
|
428
423
|
/**Gets the length of a single Sha'a Zmanis in minutes for the current Jewish date at the given Location.*/
|
|
429
424
|
getShaaZmanis(location, offset) {
|
|
430
425
|
if (!location) {
|
|
431
426
|
throw 'To get the Shaa Zmanis, the location needs to be supplied';
|
|
432
427
|
}
|
|
433
|
-
return
|
|
428
|
+
return Zmanim.getShaaZmanis(this, location, offset);
|
|
434
429
|
}
|
|
435
430
|
/**Returns the daily daf in English. For example: Sukkah, Daf 3.*/
|
|
436
431
|
getDafYomi() {
|
|
437
|
-
return
|
|
432
|
+
return DafYomi.toString(this) || '';
|
|
438
433
|
}
|
|
439
434
|
/**Gets the daily daf in Hebrew. For example: 'סוכה דף כ.*/
|
|
440
435
|
getDafyomiHeb() {
|
|
441
|
-
return
|
|
436
|
+
return DafYomi.toStringHeb(this) || '';
|
|
442
437
|
}
|
|
443
438
|
/**
|
|
444
439
|
* Converts its argument/s to a Jewish Date.
|
|
@@ -467,7 +462,7 @@ class jDate {
|
|
|
467
462
|
// If just the year is set, then the date is set to Rosh Hashana of that year.
|
|
468
463
|
// In the above scenario, we can't just pass the args along, as the constructor will treat it as an absolute date.
|
|
469
464
|
//...and that folks, is actually the whole point of this function...
|
|
470
|
-
else if (
|
|
465
|
+
else if (Utils.isNumber(arg) && arguments.length === 1) {
|
|
471
466
|
return new jDate(arg, 7, 1);
|
|
472
467
|
}
|
|
473
468
|
else {
|
|
@@ -480,7 +475,7 @@ class jDate {
|
|
|
480
475
|
/**Calculate the Jewish year, month and day for the given absolute date.*/
|
|
481
476
|
static fromAbs(absDay) {
|
|
482
477
|
//To save on calculations, start with a few years before date
|
|
483
|
-
let year = 3761 +
|
|
478
|
+
let year = 3761 + Utils.toInt(absDay / (absDay > 0 ? 366 : 300)), month, day;
|
|
484
479
|
// Search forward for year from the approximation year.
|
|
485
480
|
while (absDay >= jDate.absJd(year + 1, 7, 1)) {
|
|
486
481
|
year++;
|
|
@@ -589,13 +584,13 @@ class jDate {
|
|
|
589
584
|
if (cached) {
|
|
590
585
|
return cached.elapsed;
|
|
591
586
|
}
|
|
592
|
-
const months =
|
|
587
|
+
const months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle
|
|
593
588
|
12 * ((year - 1) % 19) + // Regular months in this cycle.
|
|
594
589
|
(7 * ((year - 1) % 19) + 1) / 19), // Months in complete cycles so far.
|
|
595
590
|
parts = 204 + 793 * (months % 1080), hours = 5 +
|
|
596
591
|
12 * months +
|
|
597
|
-
793 *
|
|
598
|
-
|
|
592
|
+
793 * Utils.toInt(months / 1080) +
|
|
593
|
+
Utils.toInt(parts / 1080), conjDay = Utils.toInt(1 + 29 * months + hours / 24), conjParts = 1080 * (hours % 24) + (parts % 1080);
|
|
599
594
|
let altDay;
|
|
600
595
|
/* at the end of a leap year - 15 hours, 589 parts or later... -
|
|
601
596
|
... or is on a Monday at... - ...of a common year, -
|
|
@@ -615,7 +610,7 @@ class jDate {
|
|
|
615
610
|
altDay = conjDay;
|
|
616
611
|
}
|
|
617
612
|
// A day is added if Rosh HaShanah would occur on Sunday, Friday or Wednesday,
|
|
618
|
-
if (
|
|
613
|
+
if (Utils.has(altDay % 7, 0, 3, 5)) {
|
|
619
614
|
altDay += 1;
|
|
620
615
|
}
|
|
621
616
|
//Add this year to the cache to save on calculations later on
|
|
@@ -643,5 +638,4 @@ class jDate {
|
|
|
643
638
|
return jDate.isJdLeapY(year) ? 13 : 12;
|
|
644
639
|
}
|
|
645
640
|
}
|
|
646
|
-
exports.default = jDate;
|
|
647
641
|
//# sourceMappingURL=jDate.js.map
|