jcal-zmanim 1.0.4 → 1.0.6
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/build/Settings.d.ts +8 -0
- package/build/Settings.js +8 -0
- package/build/ZmanTypes.d.ts +10 -4
- package/build/ZmanTypes.js +11 -5
- package/package.json +8 -3
- package/src/AppUtils.ts +0 -500
- package/src/GeneralUtils.ts +0 -84
- package/src/JCal/Dafyomi.ts +0 -139
- package/src/JCal/Location.ts +0 -100
- package/src/JCal/Molad.ts +0 -105
- package/src/JCal/PirkeiAvos.ts +0 -180
- package/src/JCal/Sedra.ts +0 -215
- package/src/JCal/Utils.ts +0 -732
- package/src/JCal/Zmanim.ts +0 -270
- package/src/JCal/jDate.ts +0 -714
- package/src/Locations.ts +0 -1303
- package/src/Notifications.ts +0 -1243
- package/src/Settings.ts +0 -103
- package/src/ZmanTypes.ts +0 -184
- package/src/index.ts +0 -31
- package/src/jcal-zmanim.d.ts +0 -4
- package/tsconfig.json +0 -109
package/build/Settings.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Location from './JCal/Location';
|
|
2
2
|
import { ZmanToShow } from './jcal-zmanim';
|
|
3
|
+
/**
|
|
4
|
+
* Class that represents a set of Settings to use while generating zmanim, notifications etc.
|
|
5
|
+
* All the options are optional.
|
|
6
|
+
*/
|
|
3
7
|
export default class Settings {
|
|
4
8
|
zmanimToShow: ZmanToShow[];
|
|
5
9
|
location: Location;
|
|
@@ -21,5 +25,9 @@ export default class Settings {
|
|
|
21
25
|
* @param {boolean} [english] Show in English?
|
|
22
26
|
*/
|
|
23
27
|
constructor(zmanimToShow?: ZmanToShow[], location?: Location, showNotifications?: boolean, numberOfItemsToShow?: number, minToShowPassedZman?: number, showGaonShir?: boolean, showDafYomi?: boolean, english?: boolean);
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @returns {Settings} a copy of this Settings object.
|
|
31
|
+
*/
|
|
24
32
|
clone(): Settings;
|
|
25
33
|
}
|
package/build/Settings.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Locations_1 = require("./Locations");
|
|
4
4
|
const GeneralUtils_1 = require("./GeneralUtils");
|
|
5
5
|
const ZmanTypes_1 = require("./ZmanTypes");
|
|
6
|
+
/**
|
|
7
|
+
* Class that represents a set of Settings to use while generating zmanim, notifications etc.
|
|
8
|
+
* All the options are optional.
|
|
9
|
+
*/
|
|
6
10
|
class Settings {
|
|
7
11
|
/**
|
|
8
12
|
*
|
|
@@ -68,6 +72,10 @@ class Settings {
|
|
|
68
72
|
*/
|
|
69
73
|
this.english = (0, GeneralUtils_1.setDefault)(english, true);
|
|
70
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @returns {Settings} a copy of this Settings object.
|
|
78
|
+
*/
|
|
71
79
|
clone() {
|
|
72
80
|
return new Settings([...this.zmanimToShow], this.location, this.showNotifications, this.numberOfItemsToShow, this.minToShowPassedZman, this.showGaonShir, this.showDafYomi, this.english);
|
|
73
81
|
}
|
package/build/ZmanTypes.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ZmanToShow } from './jcal-zmanim';
|
|
2
|
+
/**
|
|
3
|
+
* List of ZmanTypeIds. Use as an enum.
|
|
4
|
+
*/
|
|
2
5
|
export declare const ZmanTypeIds: Readonly<{
|
|
3
6
|
ChatzosLayla: 0;
|
|
4
7
|
Alos90: 1;
|
|
@@ -25,10 +28,13 @@ export declare const ZmanTypeIds: Readonly<{
|
|
|
25
28
|
SofZmanEatingChometz: 22;
|
|
26
29
|
SofZmanBurnChometz: 23;
|
|
27
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* List of Zman Types. Used to acquire the Zmanim for a particular day.
|
|
33
|
+
*/
|
|
28
34
|
export declare const ZmanTypes: ZmanToShow[];
|
|
29
35
|
/**
|
|
30
|
-
* Get the ZmanType with the given id or
|
|
31
|
-
* @param {
|
|
32
|
-
* @returns {
|
|
36
|
+
* Get the ZmanType with the given id, name (Hebrew or English) or description.
|
|
37
|
+
* @param {number|string} idOrName
|
|
38
|
+
* @returns {ZmanToShow}
|
|
33
39
|
*/
|
|
34
|
-
export declare function getZmanType(
|
|
40
|
+
export declare function getZmanType(idOrName: number | string): ZmanToShow | undefined;
|
package/build/ZmanTypes.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getZmanType = exports.ZmanTypes = exports.ZmanTypeIds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* List of ZmanTypeIds. Use as an enum.
|
|
6
|
+
*/
|
|
4
7
|
exports.ZmanTypeIds = Object.freeze({
|
|
5
8
|
ChatzosLayla: 0,
|
|
6
9
|
Alos90: 1,
|
|
@@ -27,6 +30,9 @@ exports.ZmanTypeIds = Object.freeze({
|
|
|
27
30
|
SofZmanEatingChometz: 22,
|
|
28
31
|
SofZmanBurnChometz: 23,
|
|
29
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* List of Zman Types. Used to acquire the Zmanim for a particular day.
|
|
35
|
+
*/
|
|
30
36
|
exports.ZmanTypes = [
|
|
31
37
|
{
|
|
32
38
|
id: exports.ZmanTypeIds.ChatzosLayla,
|
|
@@ -174,11 +180,11 @@ exports.ZmanTypes = [
|
|
|
174
180
|
},
|
|
175
181
|
];
|
|
176
182
|
/**
|
|
177
|
-
* Get the ZmanType with the given id or
|
|
178
|
-
* @param {
|
|
179
|
-
* @returns {
|
|
183
|
+
* Get the ZmanType with the given id, name (Hebrew or English) or description.
|
|
184
|
+
* @param {number|string} idOrName
|
|
185
|
+
* @returns {ZmanToShow}
|
|
180
186
|
*/
|
|
181
|
-
function getZmanType(
|
|
182
|
-
return exports.ZmanTypes.find(zt => zt.id ===
|
|
187
|
+
function getZmanType(idOrName) {
|
|
188
|
+
return exports.ZmanTypes.find(zt => zt.id === idOrName || zt.eng === idOrName || zt.heb === idOrName || zt.desc === idOrName);
|
|
183
189
|
}
|
|
184
190
|
exports.getZmanType = getZmanType;
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcal-zmanim",
|
|
3
3
|
"description": "A very complete JavaScript library for the Jewish Calendar, Zmanim, Holidays, and daily Shul notes.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
+
"module": "build/index.mjs",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"build"
|
|
10
|
+
],
|
|
6
11
|
"devDependencies": {
|
|
7
12
|
"@types/node": "20.8.10",
|
|
8
13
|
"rimraf": "5.0.5",
|
|
@@ -15,7 +20,7 @@
|
|
|
15
20
|
},
|
|
16
21
|
"repository": {
|
|
17
22
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/cbsom/
|
|
23
|
+
"url": "git+https://github.com/cbsom/jcal-zmanim.git"
|
|
19
24
|
},
|
|
20
25
|
"keywords": [
|
|
21
26
|
"Calendar",
|
|
@@ -30,4 +35,4 @@
|
|
|
30
35
|
"url": "https://github.com/cbsom/jCal/issues"
|
|
31
36
|
},
|
|
32
37
|
"homepage": "https://github.com/cbsom/jCal#readme"
|
|
33
|
-
}
|
|
38
|
+
}
|
package/src/AppUtils.ts
DELETED
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
import Utils from './JCal/Utils';
|
|
2
|
-
import Zmanim from './JCal/Zmanim';
|
|
3
|
-
import Location from './JCal/Location';
|
|
4
|
-
import Settings from './Settings';
|
|
5
|
-
import jDate from './JCal/jDate';
|
|
6
|
-
import { ZmanTypes, ZmanTypeIds, getZmanType } from './ZmanTypes';
|
|
7
|
-
import { SunTimes, Time, ZmanToShow } from './jcal-zmanim';
|
|
8
|
-
|
|
9
|
-
type ZmanTime = {
|
|
10
|
-
date: Date,
|
|
11
|
-
location: Location,
|
|
12
|
-
sunrise: Time | undefined,
|
|
13
|
-
sunset: Time | undefined,
|
|
14
|
-
suntimesMishor: SunTimes | undefined,
|
|
15
|
-
sunriseMishor: Time | undefined,
|
|
16
|
-
sunsetMishor: Time | undefined,
|
|
17
|
-
mishorNeg90: Time | undefined,
|
|
18
|
-
chatzos: Time | undefined,
|
|
19
|
-
shaaZmanis: number | undefined,
|
|
20
|
-
shaaZmanisMga: number | undefined,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const DaysOfWeek = Object.freeze({
|
|
24
|
-
SUNDAY: 0,
|
|
25
|
-
MONDAY: 1,
|
|
26
|
-
TUESDAY: 2,
|
|
27
|
-
WEDNESDAY: 3,
|
|
28
|
-
THURSDAY: 4,
|
|
29
|
-
FRIDAY: 5,
|
|
30
|
-
SHABBOS: 6,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const WhichDaysFlags = Object.freeze({
|
|
34
|
-
SUNDAY: 1,
|
|
35
|
-
MONDAY: 2,
|
|
36
|
-
TUESDAY: 4,
|
|
37
|
-
WEDNESDAY: 8,
|
|
38
|
-
THURSDAY: 16,
|
|
39
|
-
FRIDAY: 32,
|
|
40
|
-
SHABBOS: 64,
|
|
41
|
-
YOMTOV: 128,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export default class AppUtils {
|
|
45
|
-
static zmanTimesCache: ZmanTime[] = [];
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Returns the date corrected time of the given zmanim on the given date at the given location
|
|
49
|
-
* If the zman is after or within 30 minutes of the given time, this days zman is returned, othwise tomorrows zman is returned.
|
|
50
|
-
* @param {Date} sdate
|
|
51
|
-
* @param {jDate} jdate
|
|
52
|
-
* @param {Time} time
|
|
53
|
-
* @param {Settings} settings
|
|
54
|
-
* @param {Time} sunset
|
|
55
|
-
* @returns {[{zmanType:ZmanToShow,time:Time, isTomorrow:boolean}]}
|
|
56
|
-
*/
|
|
57
|
-
static getCorrectZmanTimes(sdate: Date, jdate: jDate, time: Time, settings: Settings, sunset: Time) {
|
|
58
|
-
const correctedTimes = [],
|
|
59
|
-
zmanTypes = settings.zmanimToShow,
|
|
60
|
-
location = settings.location,
|
|
61
|
-
tomorrowJd = jdate.addDays(1),
|
|
62
|
-
tomorrowSd = Utils.addDaysToSdate(sdate, 1),
|
|
63
|
-
/* Candle lighting and chometz times are not shown after sunset.
|
|
64
|
-
This solves the issue of Candle lighting showing as having "passed 20 minutes ago"
|
|
65
|
-
Thursday evening after sunset - which shows as hasCandleLighting = true
|
|
66
|
-
as it is already Friday... */
|
|
67
|
-
zmanTimes = AppUtils.getZmanTimes(
|
|
68
|
-
zmanTypes.filter(
|
|
69
|
-
(zt) => ![21, 22, 23].includes(zt.id) || Utils.isTimeAfter(time, sunset),
|
|
70
|
-
),
|
|
71
|
-
sdate,
|
|
72
|
-
jdate,
|
|
73
|
-
location,
|
|
74
|
-
),
|
|
75
|
-
tomorrowTimes = AppUtils.getZmanTimes(
|
|
76
|
-
//Candle lighting tomorrow is never shown...
|
|
77
|
-
zmanTypes.filter((zt) => zt.id !== 21),
|
|
78
|
-
tomorrowSd,
|
|
79
|
-
tomorrowJd,
|
|
80
|
-
location,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
for (let zt of zmanTimes) {
|
|
84
|
-
let oTime = zt.time as Time,
|
|
85
|
-
isTomorrow = false,
|
|
86
|
-
diff = Utils.timeDiff(time, oTime, true);
|
|
87
|
-
if (
|
|
88
|
-
diff.sign < 1 &&
|
|
89
|
-
Utils.totalMinutes(diff) >= settings.minToShowPassedZman
|
|
90
|
-
) {
|
|
91
|
-
const tom = tomorrowTimes.find(
|
|
92
|
-
(t) => t.zmanType === zt.zmanType,
|
|
93
|
-
);
|
|
94
|
-
if (tom && tom.time) {
|
|
95
|
-
oTime = tom.time;
|
|
96
|
-
isTomorrow = true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
correctedTimes.push({
|
|
100
|
-
zmanType: zt.zmanType,
|
|
101
|
-
time: oTime,
|
|
102
|
-
isTomorrow,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return correctedTimes.sort(
|
|
106
|
-
(a, b) =>
|
|
107
|
-
(a.isTomorrow ? 1 : -1) - (b.isTomorrow ? 1 : -1) ||
|
|
108
|
-
Utils.totalSeconds(a.time) - Utils.totalSeconds(b.time),
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Gets the zmanim for all the types in the given list.
|
|
114
|
-
* @param {[ZmanToShow]} zmanTypes An array of ZmanTypes to get the zman for.
|
|
115
|
-
* @param {Date} date The secular date to get the zmanim for
|
|
116
|
-
* @param {jDate} jdate The jewish date to get the zmanim for
|
|
117
|
-
* @param {Location} location The location for which to get the zmanim
|
|
118
|
-
* @returns{[{zmanType:{id:number,offset:?number,desc:string,eng:string,heb:string },time:Time}]}
|
|
119
|
-
*/
|
|
120
|
-
static getZmanTimes(zmanTypes: ZmanToShow[], date: Date, jdate: jDate, location: Location): { zmanType: ZmanToShow, time?: Time }[] {
|
|
121
|
-
const mem = AppUtils.zmanTimesCache.find(
|
|
122
|
-
(z) =>
|
|
123
|
-
Utils.isSameSdate(z.date, date) &&
|
|
124
|
-
z.location.Name === location.Name,
|
|
125
|
-
),
|
|
126
|
-
zmanTimes: { zmanType: ZmanToShow, time?: Time }[] = [],
|
|
127
|
-
whichDay = AppUtils.getWhichDays(date, jdate, location);
|
|
128
|
-
let sunrise: Time | undefined,
|
|
129
|
-
sunset: Time | undefined,
|
|
130
|
-
suntimesMishor: SunTimes | undefined,
|
|
131
|
-
sunriseMishor: Time | undefined,
|
|
132
|
-
sunsetMishor: Time | undefined,
|
|
133
|
-
mishorNeg90: Time | undefined,
|
|
134
|
-
chatzos: Time | undefined,
|
|
135
|
-
shaaZmanis: number | undefined,
|
|
136
|
-
shaaZmanisMga: number | undefined;
|
|
137
|
-
if (mem) {
|
|
138
|
-
sunrise = mem.sunrise;
|
|
139
|
-
sunset = mem.sunset;
|
|
140
|
-
suntimesMishor = mem.suntimesMishor;
|
|
141
|
-
sunriseMishor = mem.sunriseMishor;
|
|
142
|
-
sunsetMishor = mem.sunsetMishor;
|
|
143
|
-
mishorNeg90 = mem.mishorNeg90;
|
|
144
|
-
chatzos = mem.chatzos;
|
|
145
|
-
shaaZmanis = mem.shaaZmanis;
|
|
146
|
-
shaaZmanisMga = mem.shaaZmanisMga;
|
|
147
|
-
} else {
|
|
148
|
-
const suntimes = Zmanim.getSunTimes(date, location, true);
|
|
149
|
-
sunrise = suntimes.sunrise;
|
|
150
|
-
sunset = suntimes.sunset;
|
|
151
|
-
suntimesMishor = Zmanim.getSunTimes(date, location, false);
|
|
152
|
-
sunriseMishor = suntimesMishor.sunrise;
|
|
153
|
-
sunsetMishor = suntimesMishor.sunset;
|
|
154
|
-
mishorNeg90 = Utils.addMinutes(sunriseMishor, -90);
|
|
155
|
-
chatzos =
|
|
156
|
-
sunriseMishor &&
|
|
157
|
-
sunsetMishor &&
|
|
158
|
-
Zmanim.getChatzosFromSuntimes(suntimesMishor);
|
|
159
|
-
shaaZmanis =
|
|
160
|
-
sunriseMishor &&
|
|
161
|
-
sunsetMishor &&
|
|
162
|
-
Zmanim.getShaaZmanisFromSunTimes(suntimesMishor);
|
|
163
|
-
shaaZmanisMga =
|
|
164
|
-
sunriseMishor &&
|
|
165
|
-
sunsetMishor &&
|
|
166
|
-
Zmanim.getShaaZmanisMga(suntimesMishor, true);
|
|
167
|
-
|
|
168
|
-
AppUtils.zmanTimesCache.push({
|
|
169
|
-
date,
|
|
170
|
-
location,
|
|
171
|
-
sunrise,
|
|
172
|
-
sunset,
|
|
173
|
-
suntimesMishor,
|
|
174
|
-
sunriseMishor,
|
|
175
|
-
sunsetMishor,
|
|
176
|
-
mishorNeg90,
|
|
177
|
-
chatzos,
|
|
178
|
-
shaaZmanis,
|
|
179
|
-
shaaZmanisMga,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
for (let zmanType of zmanTypes) {
|
|
183
|
-
const offset = zmanType.offset &&
|
|
184
|
-
(!zmanType.whichDaysFlags || zmanType.whichDaysFlags & whichDay)
|
|
185
|
-
? zmanType.offset
|
|
186
|
-
: 0;
|
|
187
|
-
switch (zmanType.id) {
|
|
188
|
-
case ZmanTypeIds.ChatzosLayla: // chatzosNight
|
|
189
|
-
zmanTimes.push({
|
|
190
|
-
zmanType,
|
|
191
|
-
time: Utils.addMinutes(chatzos, 720 + offset),
|
|
192
|
-
});
|
|
193
|
-
break;
|
|
194
|
-
case ZmanTypeIds.Alos90: // alos90
|
|
195
|
-
zmanTimes.push({
|
|
196
|
-
zmanType,
|
|
197
|
-
time: offset
|
|
198
|
-
? Utils.addMinutes(mishorNeg90, offset)
|
|
199
|
-
: mishorNeg90,
|
|
200
|
-
});
|
|
201
|
-
break;
|
|
202
|
-
case ZmanTypeIds.Alos72: // alos72
|
|
203
|
-
zmanTimes.push({
|
|
204
|
-
zmanType,
|
|
205
|
-
time: Utils.addMinutes(sunriseMishor, -72 + offset),
|
|
206
|
-
});
|
|
207
|
-
break;
|
|
208
|
-
case ZmanTypeIds.TalisTefillin: //talisTefillin
|
|
209
|
-
zmanTimes.push({
|
|
210
|
-
zmanType,
|
|
211
|
-
time: Utils.addMinutes(sunriseMishor, -36 + offset),
|
|
212
|
-
});
|
|
213
|
-
break;
|
|
214
|
-
case ZmanTypeIds.NetzAtElevation: //netzElevation
|
|
215
|
-
zmanTimes.push({
|
|
216
|
-
zmanType,
|
|
217
|
-
time: offset
|
|
218
|
-
? Utils.addMinutes(sunrise, offset)
|
|
219
|
-
: sunrise,
|
|
220
|
-
});
|
|
221
|
-
break;
|
|
222
|
-
case ZmanTypeIds.NetzMishor: // netzMishor:
|
|
223
|
-
zmanTimes.push({
|
|
224
|
-
zmanType,
|
|
225
|
-
time: offset
|
|
226
|
-
? Utils.addMinutes(sunriseMishor, offset)
|
|
227
|
-
: sunriseMishor,
|
|
228
|
-
});
|
|
229
|
-
break;
|
|
230
|
-
case ZmanTypeIds.szksMga: //szksMga
|
|
231
|
-
if (shaaZmanisMga)
|
|
232
|
-
zmanTimes.push({
|
|
233
|
-
zmanType,
|
|
234
|
-
time: Utils.addMinutes(
|
|
235
|
-
mishorNeg90,
|
|
236
|
-
Math.floor(shaaZmanisMga * 3) + offset,
|
|
237
|
-
),
|
|
238
|
-
});
|
|
239
|
-
break;
|
|
240
|
-
case ZmanTypeIds.szksGra: //szksGra
|
|
241
|
-
if (shaaZmanis)
|
|
242
|
-
zmanTimes.push({
|
|
243
|
-
zmanType,
|
|
244
|
-
time: Utils.addMinutes(
|
|
245
|
-
sunriseMishor,
|
|
246
|
-
Math.floor(shaaZmanis * 3) + offset,
|
|
247
|
-
),
|
|
248
|
-
});
|
|
249
|
-
break;
|
|
250
|
-
case ZmanTypeIds.sztMga: // sztMga
|
|
251
|
-
if (shaaZmanisMga)
|
|
252
|
-
zmanTimes.push({
|
|
253
|
-
zmanType,
|
|
254
|
-
time: Utils.addMinutes(
|
|
255
|
-
mishorNeg90,
|
|
256
|
-
Math.floor(shaaZmanisMga * 4) + offset,
|
|
257
|
-
),
|
|
258
|
-
});
|
|
259
|
-
break;
|
|
260
|
-
case ZmanTypeIds.sztGra: //sztGra
|
|
261
|
-
if (shaaZmanis)
|
|
262
|
-
zmanTimes.push({
|
|
263
|
-
zmanType,
|
|
264
|
-
time: Utils.addMinutes(
|
|
265
|
-
sunriseMishor,
|
|
266
|
-
Math.floor(shaaZmanis * 4) + offset,
|
|
267
|
-
),
|
|
268
|
-
});
|
|
269
|
-
break;
|
|
270
|
-
case ZmanTypeIds.chatzosDay: //chatzos
|
|
271
|
-
zmanTimes.push({
|
|
272
|
-
zmanType,
|
|
273
|
-
time: offset
|
|
274
|
-
? Utils.addMinutes(chatzos, offset)
|
|
275
|
-
: chatzos,
|
|
276
|
-
});
|
|
277
|
-
break;
|
|
278
|
-
case ZmanTypeIds.minGed: //minGed
|
|
279
|
-
if (shaaZmanis)
|
|
280
|
-
zmanTimes.push({
|
|
281
|
-
zmanType,
|
|
282
|
-
time: Utils.addMinutes(
|
|
283
|
-
chatzos,
|
|
284
|
-
shaaZmanis * 0.5 + offset,
|
|
285
|
-
),
|
|
286
|
-
});
|
|
287
|
-
break;
|
|
288
|
-
case ZmanTypeIds.minKet: //minKet
|
|
289
|
-
if (shaaZmanis)
|
|
290
|
-
zmanTimes.push({
|
|
291
|
-
zmanType,
|
|
292
|
-
time: Utils.addMinutes(
|
|
293
|
-
sunriseMishor,
|
|
294
|
-
shaaZmanis * 9.5 + offset,
|
|
295
|
-
),
|
|
296
|
-
});
|
|
297
|
-
break;
|
|
298
|
-
case ZmanTypeIds.plag: //plag
|
|
299
|
-
if (shaaZmanis)
|
|
300
|
-
zmanTimes.push({
|
|
301
|
-
zmanType,
|
|
302
|
-
time: Utils.addMinutes(
|
|
303
|
-
sunriseMishor,
|
|
304
|
-
shaaZmanis * 10.75 + offset,
|
|
305
|
-
),
|
|
306
|
-
});
|
|
307
|
-
break;
|
|
308
|
-
case ZmanTypeIds.shkiaAtSeaLevel: //shkiaMishor
|
|
309
|
-
zmanTimes.push({
|
|
310
|
-
zmanType,
|
|
311
|
-
time: offset
|
|
312
|
-
? Utils.addMinutes(sunsetMishor, offset)
|
|
313
|
-
: sunsetMishor,
|
|
314
|
-
});
|
|
315
|
-
break;
|
|
316
|
-
case ZmanTypeIds.shkiaElevation: //shkiaElevation
|
|
317
|
-
zmanTimes.push({
|
|
318
|
-
zmanType,
|
|
319
|
-
time: offset
|
|
320
|
-
? Utils.addMinutes(sunset, offset)
|
|
321
|
-
: sunset,
|
|
322
|
-
});
|
|
323
|
-
break;
|
|
324
|
-
case ZmanTypeIds.tzais45: // tzais45
|
|
325
|
-
zmanTimes.push({
|
|
326
|
-
zmanType,
|
|
327
|
-
time: Utils.addMinutes(sunset, 45 + offset),
|
|
328
|
-
});
|
|
329
|
-
break;
|
|
330
|
-
case ZmanTypeIds.tzais50: //tzais50
|
|
331
|
-
zmanTimes.push({
|
|
332
|
-
zmanType,
|
|
333
|
-
time: Utils.addMinutes(sunset, 50 + offset),
|
|
334
|
-
});
|
|
335
|
-
break;
|
|
336
|
-
case ZmanTypeIds.tzais72: //tzais72
|
|
337
|
-
zmanTimes.push({
|
|
338
|
-
zmanType,
|
|
339
|
-
time: Utils.addMinutes(sunset, 72 + offset),
|
|
340
|
-
});
|
|
341
|
-
break;
|
|
342
|
-
case ZmanTypeIds.rabbeinuTamZmanios: //tzais72Zmaniot
|
|
343
|
-
if (shaaZmanis)
|
|
344
|
-
zmanTimes.push({
|
|
345
|
-
zmanType,
|
|
346
|
-
time: Utils.addMinutes(
|
|
347
|
-
sunset,
|
|
348
|
-
shaaZmanis * 1.2 + offset,
|
|
349
|
-
),
|
|
350
|
-
});
|
|
351
|
-
break;
|
|
352
|
-
case ZmanTypeIds.rabbeinuTamZmaniosMga: //tzais72ZmaniotMA
|
|
353
|
-
if (shaaZmanisMga)
|
|
354
|
-
zmanTimes.push({
|
|
355
|
-
zmanType,
|
|
356
|
-
time: Utils.addMinutes(
|
|
357
|
-
sunset,
|
|
358
|
-
shaaZmanisMga * 1.2 + offset,
|
|
359
|
-
),
|
|
360
|
-
});
|
|
361
|
-
break;
|
|
362
|
-
case ZmanTypeIds.candleLighting: //candleLighting
|
|
363
|
-
if (sunset && jdate.hasCandleLighting()) {
|
|
364
|
-
zmanTimes.push({
|
|
365
|
-
zmanType,
|
|
366
|
-
time: Utils.addMinutes(
|
|
367
|
-
Zmanim.getCandleLightingFromSunset(
|
|
368
|
-
sunset,
|
|
369
|
-
location,
|
|
370
|
-
),
|
|
371
|
-
offset,
|
|
372
|
-
),
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
break;
|
|
376
|
-
case ZmanTypeIds.SofZmanEatingChometz: //Sof Zman Achilas Chometz
|
|
377
|
-
if (shaaZmanisMga && jdate.Month === 1 &&
|
|
378
|
-
jdate.Day === 14 &&
|
|
379
|
-
Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))) {
|
|
380
|
-
zmanTimes.push({
|
|
381
|
-
zmanType,
|
|
382
|
-
time: Utils.addMinutes(
|
|
383
|
-
sunrise,
|
|
384
|
-
-90 + offset + shaaZmanisMga * 4,
|
|
385
|
-
),
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
break;
|
|
389
|
-
case ZmanTypeIds.SofZmanBurnChometz: //Sof Zman Biur Chometz
|
|
390
|
-
if (shaaZmanisMga &&
|
|
391
|
-
jdate.Month === 1 &&
|
|
392
|
-
(jdate.Day === 14 ||
|
|
393
|
-
(jdate.DayOfWeek === DaysOfWeek.FRIDAY &&
|
|
394
|
-
jdate.Day === 13)) &&
|
|
395
|
-
Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))
|
|
396
|
-
) {
|
|
397
|
-
zmanTimes.push({
|
|
398
|
-
zmanType,
|
|
399
|
-
time: Utils.addMinutes(
|
|
400
|
-
sunrise,
|
|
401
|
-
-90 + offset + shaaZmanisMga * 5,
|
|
402
|
-
),
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return zmanTimes;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Get the WhichDaysFlags for the given secular date
|
|
412
|
-
* @param {Date} date
|
|
413
|
-
* @param {jDate} jdate
|
|
414
|
-
* @param {Location} location
|
|
415
|
-
*/
|
|
416
|
-
static getWhichDays(date: Date, jdate: jDate, location: Location) {
|
|
417
|
-
if (jdate.isYomTov(location.Israel)) {
|
|
418
|
-
return WhichDaysFlags.YOMTOV;
|
|
419
|
-
}
|
|
420
|
-
switch (date.getDay()) {
|
|
421
|
-
case DaysOfWeek.SUNDAY:
|
|
422
|
-
return WhichDaysFlags.SUNDAY;
|
|
423
|
-
case DaysOfWeek.MONDAY:
|
|
424
|
-
return WhichDaysFlags.MONDAY;
|
|
425
|
-
case DaysOfWeek.TUESDAY:
|
|
426
|
-
return WhichDaysFlags.TUESDAY;
|
|
427
|
-
case DaysOfWeek.WEDNESDAY:
|
|
428
|
-
return WhichDaysFlags.WEDNESDAY;
|
|
429
|
-
case DaysOfWeek.THURSDAY:
|
|
430
|
-
return WhichDaysFlags.THURSDAY;
|
|
431
|
-
case DaysOfWeek.FRIDAY:
|
|
432
|
-
return WhichDaysFlags.FRIDAY;
|
|
433
|
-
case DaysOfWeek.SHABBOS:
|
|
434
|
-
return WhichDaysFlags.SHABBOS;
|
|
435
|
-
}
|
|
436
|
-
return 0;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Returns the zmanim necessary for showing basic shul notifications: chatzosHayom, chatzosHalayla, alos
|
|
441
|
-
* @param {jDate} jdate
|
|
442
|
-
* @param {Date} sdate
|
|
443
|
-
* @param {Location} location
|
|
444
|
-
* @returns {{chatzosHayom:Time, chatzosHalayla:Time, alos:Time, shkia:Time }}
|
|
445
|
-
*/
|
|
446
|
-
static getBasicShulZmanim(jdate: jDate, sdate: Date,location: Location) {
|
|
447
|
-
const zmanim = AppUtils.getZmanTimes(
|
|
448
|
-
[
|
|
449
|
-
getZmanType(ZmanTypeIds.chatzosDay) as ZmanToShow, //Chatzos hayom
|
|
450
|
-
getZmanType(ZmanTypeIds.Alos90) as ZmanToShow, //alos90
|
|
451
|
-
getZmanType(ZmanTypeIds.shkiaElevation) as ZmanToShow, //shkiaElevation,
|
|
452
|
-
getZmanType(ZmanTypeIds.candleLighting) as ZmanToShow, //candleLighting,
|
|
453
|
-
],
|
|
454
|
-
sdate,
|
|
455
|
-
jdate,
|
|
456
|
-
location,
|
|
457
|
-
);
|
|
458
|
-
return {
|
|
459
|
-
chatzosHayom: zmanim[0].time,
|
|
460
|
-
chatzosHalayla: Utils.addMinutes(zmanim[0].time, 720),
|
|
461
|
-
alos: zmanim[1].time,
|
|
462
|
-
shkia: zmanim[2].time,
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Returns all the zmanim for the given day
|
|
468
|
-
* @param {jDate} jdate
|
|
469
|
-
* @param {Date} sdate
|
|
470
|
-
* @param {Location} location
|
|
471
|
-
* @returns {{zmanType:ZmanToShow, time?:Time }[]}
|
|
472
|
-
*/
|
|
473
|
-
static getAllZmanim(jdate: jDate, sdate: Date, location: Location) {
|
|
474
|
-
return AppUtils.getZmanTimes(ZmanTypes, sdate, jdate, location,);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Compares two zmanim for showing to see if they are the same
|
|
479
|
-
* @param {{id:number,offset:?Number, whichDaysFlags:?Number, desc: String, eng: String, heb: String }} zman1
|
|
480
|
-
* @param {{id:number,offset:?Number, whichDaysFlags:?Number, desc: String, eng: String, heb: String }} zman2
|
|
481
|
-
*/
|
|
482
|
-
static IsSameZmanToShow(zman1: ZmanToShow, zman2: ZmanToShow) {
|
|
483
|
-
return (
|
|
484
|
-
zman1.id === zman2.id &&
|
|
485
|
-
zman1.desc === zman2.desc &&
|
|
486
|
-
zman1.eng === zman2.eng &&
|
|
487
|
-
zman1.heb === zman2.heb &&
|
|
488
|
-
(zman1.offset || 0) === (zman2.offset || 0) &&
|
|
489
|
-
(zman1.whichDaysFlags || 0) === (zman2.whichDaysFlags || 0)
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Returns all available ZmanTypes - including baseTypes and custom added types
|
|
495
|
-
* @param {Settings} settings
|
|
496
|
-
*/
|
|
497
|
-
static AllZmanTypes(settings: Settings) {
|
|
498
|
-
return [...ZmanTypes]/*.concat(settings.customZmanim)*/;
|
|
499
|
-
}
|
|
500
|
-
}
|