jcal-zmanim 1.0.50 → 1.1.0
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 -674
- package/{build → dist}/JCal/Dafyomi.d.ts +4 -3
- package/dist/JCal/Dafyomi.d.ts.map +1 -0
- package/{build → dist}/JCal/Dafyomi.js +9 -8
- package/dist/JCal/Dafyomi.js.map +1 -0
- package/{build → dist}/JCal/Location.d.ts +4 -4
- package/dist/JCal/Location.d.ts.map +1 -0
- package/{build → dist}/JCal/Location.js +10 -12
- package/dist/JCal/Location.js.map +1 -0
- package/{build → dist}/JCal/Molad.d.ts +1 -2
- package/dist/JCal/Molad.d.ts.map +1 -0
- package/{build → dist}/JCal/Molad.js +16 -19
- package/dist/JCal/Molad.js.map +1 -0
- package/{build → dist}/JCal/PirkeiAvos.d.ts +1 -0
- package/dist/JCal/PirkeiAvos.d.ts.map +1 -0
- package/{build → dist}/JCal/PirkeiAvos.js +4 -3
- package/dist/JCal/PirkeiAvos.js.map +1 -0
- package/{build → dist}/JCal/Sedra.d.ts +2 -1
- package/dist/JCal/Sedra.d.ts.map +1 -0
- package/{build → dist}/JCal/Sedra.js +2 -1
- package/dist/JCal/Sedra.js.map +1 -0
- package/{build → dist}/JCal/Zmanim.d.ts +1 -0
- package/dist/JCal/Zmanim.d.ts.map +1 -0
- package/{build → dist}/JCal/Zmanim.js +16 -16
- package/dist/JCal/Zmanim.js.map +1 -0
- package/{build/AppUtils.d.ts → dist/JCal/ZmanimUtils.d.ts} +10 -47
- package/dist/JCal/ZmanimUtils.d.ts.map +1 -0
- package/{build/AppUtils.js → dist/JCal/ZmanimUtils.js} +56 -122
- package/dist/JCal/ZmanimUtils.js.map +1 -0
- package/{build → dist}/JCal/jDate.d.ts +4 -3
- package/dist/JCal/jDate.d.ts.map +1 -0
- package/{build → dist}/JCal/jDate.js +24 -24
- package/dist/JCal/jDate.js.map +1 -0
- package/dist/Locations.d.ts +31 -0
- package/dist/Locations.d.ts.map +1 -0
- package/dist/Locations.js +119 -0
- package/dist/Locations.js.map +1 -0
- package/dist/Notifications.d.ts +18 -0
- package/dist/Notifications.d.ts.map +1 -0
- package/{build → dist}/Notifications.js +111 -130
- package/dist/Notifications.js.map +1 -0
- package/dist/README.md +521 -0
- package/{build/JCal → dist}/Utils.d.ts +72 -10
- package/dist/Utils.d.ts.map +1 -0
- package/{build/JCal → dist}/Utils.js +176 -70
- package/dist/Utils.js.map +1 -0
- package/{build → dist}/ZmanTypes.d.ts +11 -4
- package/dist/ZmanTypes.d.ts.map +1 -0
- package/{build → dist}/ZmanTypes.js +12 -5
- package/dist/ZmanTypes.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/locations.json +1 -0
- package/package.json +43 -33
- package/README.md +0 -2
- package/build/GeneralUtils.d.ts +0 -43
- package/build/GeneralUtils.js +0 -93
- package/build/Locations.d.ts +0 -7
- package/build/Locations.js +0 -1308
- package/build/Notifications.d.ts +0 -14
- package/build/Settings.d.ts +0 -25
- package/build/Settings.js +0 -75
- package/build/index.d.ts +0 -1
- package/build/index.js +0 -59
- 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/Notifications.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Settings from './Settings';
|
|
2
|
-
import jDate from './JCal/jDate';
|
|
3
|
-
import { Time } from './jcal-zmanim';
|
|
4
|
-
/**
|
|
5
|
-
* Get shul notifications for the given date and location
|
|
6
|
-
* @param {jDate} jdate
|
|
7
|
-
* @param {Date} sdate
|
|
8
|
-
* @param {Time} time
|
|
9
|
-
* @param {Settings} settings
|
|
10
|
-
*/
|
|
11
|
-
export default function getNotifications(jdate: jDate, sdate: Date, time: Time, settings: Settings): {
|
|
12
|
-
dayNotes: string[];
|
|
13
|
-
tefillahNotes: string[];
|
|
14
|
-
};
|
package/build/Settings.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Location from './JCal/Location';
|
|
2
|
-
import { ZmanToShow } from './jcal-zmanim';
|
|
3
|
-
export default class Settings {
|
|
4
|
-
zmanimToShow: ZmanToShow[];
|
|
5
|
-
location: Location;
|
|
6
|
-
showNotifications: boolean;
|
|
7
|
-
numberOfItemsToShow: number;
|
|
8
|
-
minToShowPassedZman: number;
|
|
9
|
-
showGaonShir: boolean;
|
|
10
|
-
showDafYomi: boolean;
|
|
11
|
-
english: boolean;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {[ZmanToShow]} [zmanimToShow] List of which zmanim to show
|
|
15
|
-
* @param {Location} [location]
|
|
16
|
-
* @param {boolean} [showNotifications] Show shul notifications?
|
|
17
|
-
* @param {number} [numberOfItemsToShow] Number of zmanim to show on the main screen
|
|
18
|
-
* @param {number} [minToShowPassedZman] Number of minutes to continue showing zmanim that have passed
|
|
19
|
-
* @param {boolean} [showGaonShir] Show the Shir Shel Yom of the Gr"a?
|
|
20
|
-
* @param {boolean} [showDafYomi] Show the Daf Yomi?
|
|
21
|
-
* @param {boolean} [english] Show in English?
|
|
22
|
-
*/
|
|
23
|
-
constructor(zmanimToShow?: ZmanToShow[], location?: Location, showNotifications?: boolean, numberOfItemsToShow?: number, minToShowPassedZman?: number, showGaonShir?: boolean, showDafYomi?: boolean, english?: boolean);
|
|
24
|
-
clone(): Settings;
|
|
25
|
-
}
|
package/build/Settings.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Locations_1 = require("./Locations");
|
|
4
|
-
const GeneralUtils_1 = require("./GeneralUtils");
|
|
5
|
-
const ZmanTypes_1 = require("./ZmanTypes");
|
|
6
|
-
class Settings {
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {[ZmanToShow]} [zmanimToShow] List of which zmanim to show
|
|
10
|
-
* @param {Location} [location]
|
|
11
|
-
* @param {boolean} [showNotifications] Show shul notifications?
|
|
12
|
-
* @param {number} [numberOfItemsToShow] Number of zmanim to show on the main screen
|
|
13
|
-
* @param {number} [minToShowPassedZman] Number of minutes to continue showing zmanim that have passed
|
|
14
|
-
* @param {boolean} [showGaonShir] Show the Shir Shel Yom of the Gr"a?
|
|
15
|
-
* @param {boolean} [showDafYomi] Show the Daf Yomi?
|
|
16
|
-
* @param {boolean} [english] Show in English?
|
|
17
|
-
*/
|
|
18
|
-
constructor(zmanimToShow, location, showNotifications, numberOfItemsToShow, minToShowPassedZman, showGaonShir, showDafYomi, english) {
|
|
19
|
-
/**
|
|
20
|
-
* @property {[ZmanToShow]} zmanimToShow List of which zmanim to show
|
|
21
|
-
*/
|
|
22
|
-
this.zmanimToShow = (zmanimToShow || [
|
|
23
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.ChatzosLayla),
|
|
24
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.Alos72),
|
|
25
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.TalisTefillin),
|
|
26
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.NetzMishor),
|
|
27
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.szksMga),
|
|
28
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.szksGra),
|
|
29
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.sztMga),
|
|
30
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.sztGra),
|
|
31
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.chatzosDay),
|
|
32
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.minGed),
|
|
33
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.minKet),
|
|
34
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.plag),
|
|
35
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.shkiaElevation),
|
|
36
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.tzais50),
|
|
37
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.tzais72),
|
|
38
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.candleLighting),
|
|
39
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.SofZmanEatingChometz),
|
|
40
|
-
(0, ZmanTypes_1.getZmanType)(ZmanTypes_1.ZmanTypeIds.SofZmanBurnChometz), //Sof Zman burn Chometz
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* @property {Location} location
|
|
44
|
-
*/
|
|
45
|
-
this.location = (location || (0, Locations_1.findLocation)('Lakewood NJ'));
|
|
46
|
-
/**
|
|
47
|
-
* @property {boolean} showNotifications Show shul notifications?
|
|
48
|
-
*/
|
|
49
|
-
this.showNotifications = (0, GeneralUtils_1.setDefault)(showNotifications, true);
|
|
50
|
-
/**
|
|
51
|
-
* @property {number} numberOfItemsToShow Number of zmanim to show on the main screen
|
|
52
|
-
*/
|
|
53
|
-
this.numberOfItemsToShow = (0, GeneralUtils_1.setDefault)(numberOfItemsToShow, 5);
|
|
54
|
-
/**
|
|
55
|
-
* @property {number} minToShowPassedZman Number of minutes to continue showing zmanim that have passed
|
|
56
|
-
*/
|
|
57
|
-
this.minToShowPassedZman = (0, GeneralUtils_1.setDefault)(minToShowPassedZman, 15);
|
|
58
|
-
/**
|
|
59
|
-
* @property {boolean} [showGaonShir] Show the Shir Shel Yom of the Gr"a?
|
|
60
|
-
*/
|
|
61
|
-
this.showGaonShir = (0, GeneralUtils_1.setDefault)(showGaonShir, false);
|
|
62
|
-
/**
|
|
63
|
-
* @property {boolean} [showDafYomi] Show Daf Yomi?
|
|
64
|
-
*/
|
|
65
|
-
this.showDafYomi = (0, GeneralUtils_1.setDefault)(showDafYomi, true);
|
|
66
|
-
/**
|
|
67
|
-
* @property {boolean} [english] Should the language be English?
|
|
68
|
-
*/
|
|
69
|
-
this.english = (0, GeneralUtils_1.setDefault)(english, true);
|
|
70
|
-
}
|
|
71
|
-
clone() {
|
|
72
|
-
return new Settings([...this.zmanimToShow], this.location, this.showNotifications, this.numberOfItemsToShow, this.minToShowPassedZman, this.showGaonShir, this.showDafYomi, this.english);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.default = Settings;
|
package/build/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const Utils_js_1 = __importDefault(require("./JCal/Utils.js"));
|
|
30
|
-
const Zmanim_js_1 = __importDefault(require("./JCal/Zmanim.js"));
|
|
31
|
-
const Settings_js_1 = __importDefault(require("./Settings.js"));
|
|
32
|
-
const jDate_js_1 = __importDefault(require("./JCal/jDate.js"));
|
|
33
|
-
const Location_js_1 = __importDefault(require("./JCal/Location.js"));
|
|
34
|
-
const Locations_js_1 = require("./Locations.js");
|
|
35
|
-
const ZmanTypes_js_1 = require("./ZmanTypes.js");
|
|
36
|
-
const Molad_js_1 = __importDefault(require("./JCal/Molad.js"));
|
|
37
|
-
const PirkeiAvos_js_1 = __importDefault(require("./JCal/PirkeiAvos.js"));
|
|
38
|
-
const Dafyomi_js_1 = __importDefault(require("./JCal/Dafyomi.js"));
|
|
39
|
-
const Sedra_js_1 = __importDefault(require("./JCal/Sedra.js"));
|
|
40
|
-
const AppUtils_js_1 = __importStar(require("./AppUtils.js"));
|
|
41
|
-
const Notifications_js_1 = __importDefault(require("./Notifications.js"));
|
|
42
|
-
module.exports = {
|
|
43
|
-
Utils: Utils_js_1.default,
|
|
44
|
-
AppUtils: AppUtils_js_1.default,
|
|
45
|
-
DaysOfWeek: AppUtils_js_1.DaysOfWeek,
|
|
46
|
-
getNotifications: Notifications_js_1.default,
|
|
47
|
-
Locations: Locations_js_1.Locations,
|
|
48
|
-
findLocation: Locations_js_1.findLocation,
|
|
49
|
-
ZmanTypes: ZmanTypes_js_1.ZmanTypes,
|
|
50
|
-
ZmanTypeIds: ZmanTypes_js_1.ZmanTypeIds,
|
|
51
|
-
Zmanim: Zmanim_js_1.default,
|
|
52
|
-
Location: Location_js_1.default,
|
|
53
|
-
Settings: Settings_js_1.default,
|
|
54
|
-
jDate: jDate_js_1.default,
|
|
55
|
-
Molad: Molad_js_1.default,
|
|
56
|
-
PirkeiAvos: PirkeiAvos_js_1.default,
|
|
57
|
-
Dafyomi: Dafyomi_js_1.default,
|
|
58
|
-
Sedra: Sedra_js_1.default
|
|
59
|
-
};
|
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
|
-
}
|