jcal-zmanim 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +674 -674
  2. package/dist/README.md +596 -566
  3. package/dist/index.cjs +13325 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +922 -0
  6. package/dist/index.d.ts +922 -2
  7. package/dist/index.js +3564 -35
  8. package/dist/index.js.map +1 -1
  9. package/package.json +48 -46
  10. package/dist/JCal/Dafyomi.d.ts +0 -28
  11. package/dist/JCal/Dafyomi.d.ts.map +0 -1
  12. package/dist/JCal/Dafyomi.js +0 -130
  13. package/dist/JCal/Dafyomi.js.map +0 -1
  14. package/dist/JCal/Location.d.ts +0 -33
  15. package/dist/JCal/Location.d.ts.map +0 -1
  16. package/dist/JCal/Location.js +0 -77
  17. package/dist/JCal/Location.js.map +0 -1
  18. package/dist/JCal/Molad.d.ts +0 -38
  19. package/dist/JCal/Molad.d.ts.map +0 -1
  20. package/dist/JCal/Molad.js +0 -90
  21. package/dist/JCal/Molad.js.map +0 -1
  22. package/dist/JCal/PirkeiAvos.d.ts +0 -14
  23. package/dist/JCal/PirkeiAvos.d.ts.map +0 -1
  24. package/dist/JCal/PirkeiAvos.js +0 -171
  25. package/dist/JCal/PirkeiAvos.js.map +0 -1
  26. package/dist/JCal/Sedra.d.ts +0 -64
  27. package/dist/JCal/Sedra.d.ts.map +0 -1
  28. package/dist/JCal/Sedra.js +0 -183
  29. package/dist/JCal/Sedra.js.map +0 -1
  30. package/dist/JCal/Zmanim.d.ts +0 -96
  31. package/dist/JCal/Zmanim.d.ts.map +0 -1
  32. package/dist/JCal/Zmanim.js +0 -223
  33. package/dist/JCal/Zmanim.js.map +0 -1
  34. package/dist/JCal/ZmanimUtils.d.ts +0 -72
  35. package/dist/JCal/ZmanimUtils.d.ts.map +0 -1
  36. package/dist/JCal/ZmanimUtils.js +0 -349
  37. package/dist/JCal/ZmanimUtils.js.map +0 -1
  38. package/dist/JCal/jDate.d.ts +0 -204
  39. package/dist/JCal/jDate.d.ts.map +0 -1
  40. package/dist/JCal/jDate.js +0 -648
  41. package/dist/JCal/jDate.js.map +0 -1
  42. package/dist/Locations.d.ts +0 -31
  43. package/dist/Locations.d.ts.map +0 -1
  44. package/dist/Locations.js +0 -153
  45. package/dist/Locations.js.map +0 -1
  46. package/dist/Notifications.d.ts +0 -18
  47. package/dist/Notifications.d.ts.map +0 -1
  48. package/dist/Notifications.js +0 -1039
  49. package/dist/Notifications.js.map +0 -1
  50. package/dist/Utils.d.ts +0 -287
  51. package/dist/Utils.d.ts.map +0 -1
  52. package/dist/Utils.js +0 -822
  53. package/dist/Utils.js.map +0 -1
  54. package/dist/ZmanTypes.d.ts +0 -41
  55. package/dist/ZmanTypes.d.ts.map +0 -1
  56. package/dist/ZmanTypes.js +0 -187
  57. package/dist/ZmanTypes.js.map +0 -1
  58. package/dist/index.d.ts.map +0 -1
  59. package/dist/locations.json +0 -1
@@ -1,223 +0,0 @@
1
- import { Utils } from '../Utils.js';
2
- import jDate from './jDate.js';
3
- /**
4
- * Computes the daily Zmanim for any single date at any location.
5
- * The astronomical and mathematical calculations were directly adapted from the excellent
6
- * Jewish calendar calculation in C# Copyright © by Ulrich and Ziporah Greve (2005)
7
- */
8
- var Zmanim = /** @class */ (function () {
9
- function Zmanim() {
10
- }
11
- /**
12
- * Gets sunrise and sunset time for given date and Location.
13
- * Accepts a javascript Date object, a string for creating a javascript date object or a jDate object.
14
- * Location object is required.
15
- * @returns {SunTimes}
16
- * @param {Date | jDate} date A Javascript Date or Jewish Date for which to calculate the sun times.
17
- * @param {Location} location Where on the globe to calculate the sun times for.
18
- * @param {Boolean} considerElevation
19
- */
20
- Zmanim.getSunTimes = function (date, location, considerElevation) {
21
- if (considerElevation === void 0) { considerElevation = true; }
22
- if (date instanceof jDate) {
23
- date = date.getDate();
24
- }
25
- else if (date instanceof String) {
26
- date = new Date(date);
27
- }
28
- if (!Utils.isValidDate(date)) {
29
- throw 'Zmanim.getSunTimes: supplied date parameter cannot be converted to a Date';
30
- }
31
- var sunrise, sunset, zenithDeg = 90, zenithMin = 50, lonHour = 0, longitude = 0, latitude = 0, cosLat = 0, sinLat = 0, cosZen = 0, sinDec = 0, cosDec = 0, xmRise = 0, xmSet = 0, xlRise = 0, xlSet = 0, aRise = 0, aSet = 0, ahrRise = 0, ahrSet = 0, hRise = 0, hSet = 0, tRise = 0, tSet = 0, utRise = 0, utSet = 0;
32
- var day = Zmanim.dayOfYear(date), earthRadius = 6356900, zenithAtElevation = Zmanim.degToDec(zenithDeg, zenithMin) +
33
- Zmanim.radToDeg(Math.acos(earthRadius / (earthRadius +
34
- (considerElevation ? location.Elevation : 0))));
35
- zenithDeg = Math.floor(zenithAtElevation);
36
- zenithMin = (zenithAtElevation - zenithDeg) * 60;
37
- cosZen = Math.cos(0.01745 * Zmanim.degToDec(zenithDeg, zenithMin));
38
- longitude = location.Longitude;
39
- lonHour = longitude / 15;
40
- latitude = location.Latitude;
41
- cosLat = Math.cos(0.01745 * latitude);
42
- sinLat = Math.sin(0.01745 * latitude);
43
- tRise = day + (6 + lonHour) / 24;
44
- tSet = day + (18 + lonHour) / 24;
45
- xmRise = Zmanim.M(tRise);
46
- xlRise = Zmanim.L(xmRise);
47
- xmSet = Zmanim.M(tSet);
48
- xlSet = Zmanim.L(xmSet);
49
- aRise = 57.29578 * Math.atan(0.91746 * Math.tan(0.01745 * xlRise));
50
- aSet = 57.29578 * Math.atan(0.91746 * Math.tan(0.01745 * xlSet));
51
- if (Math.abs(aRise + 360 - xlRise) > 90) {
52
- aRise += 180;
53
- }
54
- if (aRise > 360) {
55
- aRise -= 360;
56
- }
57
- if (Math.abs(aSet + 360 - xlSet) > 90) {
58
- aSet += 180;
59
- }
60
- if (aSet > 360) {
61
- aSet -= 360;
62
- }
63
- ahrRise = aRise / 15;
64
- sinDec = 0.39782 * Math.sin(0.01745 * xlRise);
65
- cosDec = Math.sqrt(1 - sinDec * sinDec);
66
- hRise = (cosZen - sinDec * sinLat) / (cosDec * cosLat);
67
- ahrSet = aSet / 15;
68
- sinDec = 0.39782 * Math.sin(0.01745 * xlSet);
69
- cosDec = Math.sqrt(1 - sinDec * sinDec);
70
- hSet = (cosZen - sinDec * sinLat) / (cosDec * cosLat);
71
- if (Math.abs(hRise) <= 1) {
72
- hRise = 57.29578 * Math.acos(hRise);
73
- utRise = ((360 - hRise) / 15) + ahrRise + Zmanim.adj(tRise) + lonHour;
74
- sunrise = Zmanim.timeAdj(utRise + location.UTCOffset, date, location);
75
- if (sunrise.hour > 12) {
76
- sunrise.hour -= 12;
77
- }
78
- }
79
- if (Math.abs(hSet) <= 1) {
80
- hSet = 57.29578 * Math.acos(hSet);
81
- utSet = (hRise / 15) + ahrSet + Zmanim.adj(tSet) + lonHour;
82
- sunset = Zmanim.timeAdj(utSet + location.UTCOffset, date, location);
83
- if (sunset.hour > 0 && sunset.hour < 12) {
84
- sunset.hour += 12;
85
- }
86
- }
87
- return { sunrise: sunrise, sunset: sunset };
88
- };
89
- /**
90
- * @param {jDate | Date} date
91
- * @param {Location} location
92
- */
93
- Zmanim.getChatzos = function (date, location) {
94
- return Zmanim.getChatzosFromSuntimes(Zmanim.getSunTimes(date, location, false));
95
- };
96
- /**
97
- * @param {SunTimes} sunTimes
98
- */
99
- Zmanim.getChatzosFromSuntimes = function (sunTimes) {
100
- var rise = sunTimes.sunrise, set = sunTimes.sunset;
101
- if (rise === undefined || isNaN(rise.hour) || set === undefined || isNaN(set.hour)) {
102
- return { hour: NaN, minute: NaN };
103
- }
104
- var chatz = Utils.toInt((Utils.totalSeconds(set) - Utils.totalSeconds(rise)) / 2);
105
- return Utils.addSeconds(rise, chatz);
106
- };
107
- /**
108
- * @param {jDate | Date} date
109
- * @param {Location} location
110
- * @param {any} offset
111
- */
112
- Zmanim.getShaaZmanis = function (date, location, offset) {
113
- return Zmanim.getShaaZmanisFromSunTimes(Zmanim.getSunTimes(date, location, false), offset);
114
- };
115
- /**
116
- * @param {{ sunrise: any; sunset: any; }} sunTimes
117
- * @param {number} [offset]
118
- */
119
- Zmanim.getShaaZmanisFromSunTimes = function (sunTimes, offset) {
120
- if (!sunTimes || !sunTimes.sunrise || !sunTimes.sunset) {
121
- return 0;
122
- }
123
- var rise = sunTimes.sunrise, set = sunTimes.sunset;
124
- if (!rise || isNaN(rise.hour) || !set || isNaN(set.hour)) {
125
- return NaN;
126
- }
127
- if (offset) {
128
- rise = Utils.addMinutes(rise, -offset);
129
- set = Utils.addMinutes(set, offset);
130
- }
131
- return (Utils.totalSeconds(set) - Utils.totalSeconds(rise)) / 720;
132
- };
133
- /**
134
- * @param {{ sunrise: any; sunset: any; }} sunTimes
135
- * @param {boolean} israel
136
- */
137
- Zmanim.getShaaZmanisMga = function (sunTimes, israel) {
138
- var minutes = israel ? 90 : 72;
139
- var rise = sunTimes.sunrise && Utils.addMinutes(sunTimes.sunrise, -minutes), set = sunTimes.sunset && Utils.addMinutes(sunTimes.sunset, minutes);
140
- if (!rise || isNaN(rise.hour) || !set || isNaN(set.hour)) {
141
- return NaN;
142
- }
143
- return (Utils.totalSeconds(set) - Utils.totalSeconds(rise)) / 720;
144
- };
145
- /**
146
- * @param {jDate | Date} date
147
- * @param {Location} location
148
- */
149
- Zmanim.getCandleLighting = function (date, location) {
150
- return Zmanim.getCandleLightingFromSunTimes(Zmanim.getSunTimes(date, location), location);
151
- };
152
- /**
153
- * @param {SunTimes} sunTimes
154
- * @param {any} location
155
- */
156
- Zmanim.getCandleLightingFromSunTimes = function (sunTimes, location) {
157
- return sunTimes.sunset && Zmanim.getCandleLightingFromSunset(sunTimes.sunset, location);
158
- };
159
- /**
160
- * @param {Time} sunset
161
- * @param {Location} location
162
- */
163
- Zmanim.getCandleLightingFromSunset = function (sunset, location) {
164
- return Utils.addMinutes(sunset, -(location.CandleLighting || 0));
165
- };
166
- /**
167
- * @param {Date} date
168
- */
169
- Zmanim.dayOfYear = function (date) {
170
- var month = date.getMonth(), isLeap = function () { return Utils.isSecularLeapYear(date.getFullYear()); }, yearDay = [0, 1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
171
- return yearDay[month + 1] + date.getDate() + ((month > 1 && isLeap()) ? 1 : 0);
172
- };
173
- /**
174
- * @param {number} deg
175
- * @param {number} min
176
- */
177
- Zmanim.degToDec = function (deg, min) {
178
- return (deg + min / 60);
179
- };
180
- /**
181
- * @param {number} x
182
- */
183
- Zmanim.M = function (x) {
184
- return (0.9856 * x - 3.251);
185
- };
186
- /**
187
- * @param {number} x
188
- */
189
- Zmanim.L = function (x) {
190
- return (x + 1.916 * Math.sin(0.01745 * x) + 0.02 * Math.sin(2 * 0.01745 * x) + 282.565);
191
- };
192
- /**
193
- * @param {number} x
194
- */
195
- Zmanim.adj = function (x) {
196
- return (-0.06571 * x - 6.62);
197
- };
198
- /**
199
- * @param {number} rad
200
- */
201
- Zmanim.radToDeg = function (rad) {
202
- return 57.29578 * rad;
203
- };
204
- /**
205
- * @param {number} time
206
- * @param {Date} date
207
- * @param {Location} location
208
- */
209
- Zmanim.timeAdj = function (time, date, location) {
210
- if (time < 0) {
211
- time += 24;
212
- }
213
- var hour = Utils.toInt(time);
214
- var minFloat = (time - hour) * 60 + 0.5, min = Utils.toInt(minFloat), sec = Math.round(60.0 * (minFloat - min));
215
- if (Utils.isDST(location, date)) {
216
- hour++;
217
- }
218
- return Utils.fixTime({ hour: hour, minute: min, second: sec });
219
- };
220
- return Zmanim;
221
- }());
222
- export default Zmanim;
223
- //# sourceMappingURL=Zmanim.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Zmanim.js","sourceRoot":"","sources":["../../src/JCal/Zmanim.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,MAAM,YAAY,CAAC;AAI/B;;;;GAIG;AACH;IAAA;IAiQA,CAAC;IAhQG;;;;;;;;OAQG;IACI,kBAAW,GAAlB,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IAC5F,CAAC;IAED;;OAEG;IACI,UAAG,GAAV,UAAW,CAAS;QAChB,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,eAAQ,GAAf,UAAgB,GAAW;QACvB,OAAO,QAAQ,GAAG,GAAG,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,cAAO,GAAd,UAAe,IAAY,EAAE,IAAU,EAAE,QAAkB;QACvD,IAAI,IAAI,GAAG,CAAC,EAAE;YACV,IAAI,IAAI,EAAE,CAAC;SACd;QACD,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAM,QAAQ,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EACrC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAC3B,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC;QAE9C,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE;YAC7B,IAAI,EAAE,CAAC;SACV;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC;IACL,aAAC;AAAD,CAAC,AAjQD,IAiQC"}
@@ -1,72 +0,0 @@
1
- import Location from './Location.js';
2
- import jDate from './jDate.js';
3
- import { SunTimes, Time, ZmanToShow } from '../jcal-zmanim.js';
4
- type ZmanTime = {
5
- date: Date;
6
- location: Location;
7
- sunrise: Time | undefined;
8
- sunset: Time | undefined;
9
- suntimesMishor: SunTimes | undefined;
10
- sunriseMishor: Time | undefined;
11
- sunsetMishor: Time | undefined;
12
- mishorNeg90: Time | undefined;
13
- chatzos: Time | undefined;
14
- shaaZmanis: number | undefined;
15
- shaaZmanisMga: number | undefined;
16
- };
17
- export declare const WhichDaysFlags: Readonly<{
18
- SUNDAY: 1;
19
- MONDAY: 2;
20
- TUESDAY: 4;
21
- WEDNESDAY: 8;
22
- THURSDAY: 16;
23
- FRIDAY: 32;
24
- SHABBOS: 64;
25
- YOMTOV: 128;
26
- }>;
27
- export default class ZmanimUtils {
28
- static zmanTimesCache: ZmanTime[];
29
- /**
30
- * Gets the zmanim for all the types in the given list.
31
- * @param {[ZmanToShow]} zmanTypes An array of ZmanTypes to get the zman for.
32
- * @param {Date} date The secular date to get the zmanim for
33
- * @param {jDate} jdate The jewish date to get the zmanim for
34
- * @param {Location} location The location for which to get the zmanim
35
- * @returns{[{zmanType:{id:number,offset:?number,desc:string,eng:string,heb:string },time:Time}]}
36
- */
37
- static getZmanTimes(zmanTypes: ZmanToShow[], date: Date, jdate: jDate, location: Location): {
38
- zmanType: ZmanToShow;
39
- time?: Time;
40
- }[];
41
- /**
42
- * Get the WhichDaysFlags for the given secular date
43
- * @param {Date} date
44
- * @param {jDate} jdate
45
- * @param {Location} location
46
- */
47
- static getWhichDays(date: Date, jdate: jDate, location: Location): 2 | 0 | 1 | 4 | 8 | 16 | 32 | 64 | 128;
48
- /**
49
- * Returns the zmanim necessary for showing basic shul notifications: chatzosHayom, chatzosHalayla, alos
50
- * @param {jDate|Date} date
51
- * @param {Location} location
52
- * @returns {{chatzosHayom:Time, chatzosHalayla:Time, alos:Time, shkia:Time }}
53
- */
54
- static getBasicShulZmanim(date: jDate | Date, location: Location): {
55
- chatzosHayom: Time | undefined;
56
- chatzosHalayla: Time | undefined;
57
- alos: Time | undefined;
58
- shkia: Time | undefined;
59
- };
60
- /**
61
- * Returns all the zmanim for the given day
62
- * @param {Date|jDate} date
63
- * @param {Location} location
64
- * @returns {{zmanType:ZmanToShow, time?:Time }[]}
65
- */
66
- static getAllZmanim(date: jDate | Date, location: Location): {
67
- zmanType: ZmanToShow;
68
- time?: Time | undefined;
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AE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ;IAuBhE;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ;;;;;;IAqBhE;;;;;MAKE;IACF,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ;;;;CAI7D"}
@@ -1,349 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- import { Utils, DaysOfWeek } from '../Utils.js';
13
- import Zmanim from './Zmanim.js';
14
- import { ZmanTypes, ZmanTypeIds, getZmanType } from '../ZmanTypes.js';
15
- export var WhichDaysFlags = Object.freeze({
16
- SUNDAY: 1,
17
- MONDAY: 2,
18
- TUESDAY: 4,
19
- WEDNESDAY: 8,
20
- THURSDAY: 16,
21
- FRIDAY: 32,
22
- SHABBOS: 64,
23
- YOMTOV: 128,
24
- });
25
- var ZmanimUtils = /** @class */ (function () {
26
- function ZmanimUtils() {
27
- }
28
- /**
29
- * Gets the zmanim for all the types in the given list.
30
- * @param {[ZmanToShow]} zmanTypes An array of ZmanTypes to get the zman for.
31
- * @param {Date} date The secular date to get the zmanim for
32
- * @param {jDate} jdate The jewish date to get the zmanim for
33
- * @param {Location} location The location for which to get the zmanim
34
- * @returns{[{zmanType:{id:number,offset:?number,desc:string,eng:string,heb:string },time:Time}]}
35
- */
36
- ZmanimUtils.getZmanTimes = function (zmanTypes, date, jdate, location) {
37
- var e_1, _a;
38
- var mem = ZmanimUtils.zmanTimesCache.find(function (z) {
39
- return Utils.isSameSdate(z.date, date) &&
40
- z.location.Name === location.Name;
41
- }), zmanTimes = [], whichDay = ZmanimUtils.getWhichDays(date, jdate, location);
42
- var sunrise, sunset, suntimesMishor, sunriseMishor, sunsetMishor, mishorNeg90, chatzos, shaaZmanis, shaaZmanisMga;
43
- if (mem) {
44
- sunrise = mem.sunrise;
45
- sunset = mem.sunset;
46
- suntimesMishor = mem.suntimesMishor;
47
- sunriseMishor = mem.sunriseMishor;
48
- sunsetMishor = mem.sunsetMishor;
49
- mishorNeg90 = mem.mishorNeg90;
50
- chatzos = mem.chatzos;
51
- shaaZmanis = mem.shaaZmanis;
52
- shaaZmanisMga = mem.shaaZmanisMga;
53
- }
54
- else {
55
- var suntimes = Zmanim.getSunTimes(date, location, true);
56
- sunrise = suntimes.sunrise;
57
- sunset = suntimes.sunset;
58
- suntimesMishor = Zmanim.getSunTimes(date, location, false);
59
- sunriseMishor = suntimesMishor.sunrise;
60
- sunsetMishor = suntimesMishor.sunset;
61
- mishorNeg90 = Utils.addMinutes(sunriseMishor, -90);
62
- chatzos =
63
- sunriseMishor &&
64
- sunsetMishor &&
65
- Zmanim.getChatzosFromSuntimes(suntimesMishor);
66
- shaaZmanis =
67
- sunriseMishor &&
68
- sunsetMishor &&
69
- Zmanim.getShaaZmanisFromSunTimes(suntimesMishor);
70
- shaaZmanisMga =
71
- sunriseMishor &&
72
- sunsetMishor &&
73
- Zmanim.getShaaZmanisMga(suntimesMishor, true);
74
- ZmanimUtils.zmanTimesCache.push({
75
- date: date,
76
- location: location,
77
- sunrise: sunrise,
78
- sunset: sunset,
79
- suntimesMishor: suntimesMishor,
80
- sunriseMishor: sunriseMishor,
81
- sunsetMishor: sunsetMishor,
82
- mishorNeg90: mishorNeg90,
83
- chatzos: chatzos,
84
- shaaZmanis: shaaZmanis,
85
- shaaZmanisMga: shaaZmanisMga,
86
- });
87
- }
88
- try {
89
- for (var zmanTypes_1 = __values(zmanTypes), zmanTypes_1_1 = zmanTypes_1.next(); !zmanTypes_1_1.done; zmanTypes_1_1 = zmanTypes_1.next()) {
90
- var zmanType = zmanTypes_1_1.value;
91
- var offset = zmanType.offset &&
92
- (!zmanType.whichDaysFlags || zmanType.whichDaysFlags & whichDay)
93
- ? zmanType.offset
94
- : 0;
95
- switch (zmanType.id) {
96
- case ZmanTypeIds.ChatzosLayla: // chatzosNight
97
- zmanTimes.push({
98
- zmanType: zmanType,
99
- time: Utils.addMinutes(chatzos, 720 + offset),
100
- });
101
- break;
102
- case ZmanTypeIds.Alos90: // alos90
103
- zmanTimes.push({
104
- zmanType: zmanType,
105
- time: offset
106
- ? Utils.addMinutes(mishorNeg90, offset)
107
- : mishorNeg90,
108
- });
109
- break;
110
- case ZmanTypeIds.Alos72: // alos72
111
- zmanTimes.push({
112
- zmanType: zmanType,
113
- time: Utils.addMinutes(sunriseMishor, -72 + offset),
114
- });
115
- break;
116
- case ZmanTypeIds.TalisTefillin: //talisTefillin
117
- zmanTimes.push({
118
- zmanType: zmanType,
119
- time: Utils.addMinutes(sunriseMishor, -36 + offset),
120
- });
121
- break;
122
- case ZmanTypeIds.NetzAtElevation: //netzElevation
123
- zmanTimes.push({
124
- zmanType: zmanType,
125
- time: offset
126
- ? Utils.addMinutes(sunrise, offset)
127
- : sunrise,
128
- });
129
- break;
130
- case ZmanTypeIds.NetzMishor: // netzMishor:
131
- zmanTimes.push({
132
- zmanType: zmanType,
133
- time: offset
134
- ? Utils.addMinutes(sunriseMishor, offset)
135
- : sunriseMishor,
136
- });
137
- break;
138
- case ZmanTypeIds.szksMga: //szksMga
139
- if (shaaZmanisMga)
140
- zmanTimes.push({
141
- zmanType: zmanType,
142
- time: Utils.addMinutes(mishorNeg90, Math.floor(shaaZmanisMga * 3) + offset),
143
- });
144
- break;
145
- case ZmanTypeIds.szksGra: //szksGra
146
- if (shaaZmanis)
147
- zmanTimes.push({
148
- zmanType: zmanType,
149
- time: Utils.addMinutes(sunriseMishor, Math.floor(shaaZmanis * 3) + offset),
150
- });
151
- break;
152
- case ZmanTypeIds.sztMga: // sztMga
153
- if (shaaZmanisMga)
154
- zmanTimes.push({
155
- zmanType: zmanType,
156
- time: Utils.addMinutes(mishorNeg90, Math.floor(shaaZmanisMga * 4) + offset),
157
- });
158
- break;
159
- case ZmanTypeIds.sztGra: //sztGra
160
- if (shaaZmanis)
161
- zmanTimes.push({
162
- zmanType: zmanType,
163
- time: Utils.addMinutes(sunriseMishor, Math.floor(shaaZmanis * 4) + offset),
164
- });
165
- break;
166
- case ZmanTypeIds.chatzosDay: //chatzos
167
- zmanTimes.push({
168
- zmanType: zmanType,
169
- time: offset
170
- ? Utils.addMinutes(chatzos, offset)
171
- : chatzos,
172
- });
173
- break;
174
- case ZmanTypeIds.minGed: //minGed
175
- if (shaaZmanis)
176
- zmanTimes.push({
177
- zmanType: zmanType,
178
- time: Utils.addMinutes(chatzos, shaaZmanis * 0.5 + offset),
179
- });
180
- break;
181
- case ZmanTypeIds.minKet: //minKet
182
- if (shaaZmanis)
183
- zmanTimes.push({
184
- zmanType: zmanType,
185
- time: Utils.addMinutes(sunriseMishor, shaaZmanis * 9.5 + offset),
186
- });
187
- break;
188
- case ZmanTypeIds.plag: //plag
189
- if (shaaZmanis)
190
- zmanTimes.push({
191
- zmanType: zmanType,
192
- time: Utils.addMinutes(sunriseMishor, shaaZmanis * 10.75 + offset),
193
- });
194
- break;
195
- case ZmanTypeIds.shkiaAtSeaLevel: //shkiaMishor
196
- zmanTimes.push({
197
- zmanType: zmanType,
198
- time: offset
199
- ? Utils.addMinutes(sunsetMishor, offset)
200
- : sunsetMishor,
201
- });
202
- break;
203
- case ZmanTypeIds.shkiaElevation: //shkiaElevation
204
- zmanTimes.push({
205
- zmanType: zmanType,
206
- time: offset
207
- ? Utils.addMinutes(sunset, offset)
208
- : sunset,
209
- });
210
- break;
211
- case ZmanTypeIds.tzais45: // tzais45
212
- zmanTimes.push({
213
- zmanType: zmanType,
214
- time: Utils.addMinutes(sunset, 45 + offset),
215
- });
216
- break;
217
- case ZmanTypeIds.tzais50: //tzais50
218
- zmanTimes.push({
219
- zmanType: zmanType,
220
- time: Utils.addMinutes(sunset, 50 + offset),
221
- });
222
- break;
223
- case ZmanTypeIds.tzais72: //tzais72
224
- zmanTimes.push({
225
- zmanType: zmanType,
226
- time: Utils.addMinutes(sunset, 72 + offset),
227
- });
228
- break;
229
- case ZmanTypeIds.rabbeinuTamZmanios: //tzais72Zmaniot
230
- if (shaaZmanis)
231
- zmanTimes.push({
232
- zmanType: zmanType,
233
- time: Utils.addMinutes(sunset, shaaZmanis * 1.2 + offset),
234
- });
235
- break;
236
- case ZmanTypeIds.rabbeinuTamZmaniosMga: //tzais72ZmaniotMA
237
- if (shaaZmanisMga)
238
- zmanTimes.push({
239
- zmanType: zmanType,
240
- time: Utils.addMinutes(sunset, shaaZmanisMga * 1.2 + offset),
241
- });
242
- break;
243
- case ZmanTypeIds.candleLighting: //candleLighting
244
- if (sunset && jdate.hasCandleLighting()) {
245
- zmanTimes.push({
246
- zmanType: zmanType,
247
- time: Utils.addMinutes(Zmanim.getCandleLightingFromSunset(sunset, location), offset),
248
- });
249
- }
250
- break;
251
- case ZmanTypeIds.SofZmanEatingChometz: //Sof Zman Achilas Chometz
252
- if (shaaZmanisMga && jdate.Month === 1 &&
253
- jdate.Day === 14 &&
254
- Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))) {
255
- zmanTimes.push({
256
- zmanType: zmanType,
257
- time: Utils.addMinutes(sunrise, -90 + offset + shaaZmanisMga * 4),
258
- });
259
- }
260
- break;
261
- case ZmanTypeIds.SofZmanBurnChometz: //Sof Zman Biur Chometz
262
- if (shaaZmanisMga &&
263
- jdate.Month === 1 &&
264
- (jdate.Day === 14 ||
265
- (jdate.DayOfWeek === DaysOfWeek.FRIDAY &&
266
- jdate.Day === 13)) &&
267
- Utils.isTimeAfter(sunrise, Utils.timeFromDate(date))) {
268
- zmanTimes.push({
269
- zmanType: zmanType,
270
- time: Utils.addMinutes(sunrise, -90 + offset + shaaZmanisMga * 5),
271
- });
272
- }
273
- break;
274
- }
275
- }
276
- }
277
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
278
- finally {
279
- try {
280
- if (zmanTypes_1_1 && !zmanTypes_1_1.done && (_a = zmanTypes_1.return)) _a.call(zmanTypes_1);
281
- }
282
- finally { if (e_1) throw e_1.error; }
283
- }
284
- return zmanTimes;
285
- };
286
- /**
287
- * Get the WhichDaysFlags for the given secular date
288
- * @param {Date} date
289
- * @param {jDate} jdate
290
- * @param {Location} location
291
- */
292
- ZmanimUtils.getWhichDays = function (date, jdate, location) {
293
- if (jdate.isYomTov(!!location.Israel)) {
294
- return WhichDaysFlags.YOMTOV;
295
- }
296
- switch (date.getDay()) {
297
- case DaysOfWeek.SUNDAY:
298
- return WhichDaysFlags.SUNDAY;
299
- case DaysOfWeek.MONDAY:
300
- return WhichDaysFlags.MONDAY;
301
- case DaysOfWeek.TUESDAY:
302
- return WhichDaysFlags.TUESDAY;
303
- case DaysOfWeek.WEDNESDAY:
304
- return WhichDaysFlags.WEDNESDAY;
305
- case DaysOfWeek.THURSDAY:
306
- return WhichDaysFlags.THURSDAY;
307
- case DaysOfWeek.FRIDAY:
308
- return WhichDaysFlags.FRIDAY;
309
- case DaysOfWeek.SHABBOS:
310
- return WhichDaysFlags.SHABBOS;
311
- }
312
- return 0;
313
- };
314
- /**
315
- * Returns the zmanim necessary for showing basic shul notifications: chatzosHayom, chatzosHalayla, alos
316
- * @param {jDate|Date} date
317
- * @param {Location} location
318
- * @returns {{chatzosHayom:Time, chatzosHalayla:Time, alos:Time, shkia:Time }}
319
- */
320
- ZmanimUtils.getBasicShulZmanim = function (date, location) {
321
- var _a = Utils.bothDates(date), sdate = _a.sdate, jdate = _a.jdate;
322
- var zmanim = ZmanimUtils.getZmanTimes([
323
- getZmanType(ZmanTypeIds.chatzosDay),
324
- getZmanType(ZmanTypeIds.Alos90),
325
- getZmanType(ZmanTypeIds.shkiaElevation),
326
- getZmanType(ZmanTypeIds.candleLighting),
327
- ], sdate, jdate, location);
328
- return {
329
- chatzosHayom: zmanim[0].time,
330
- chatzosHalayla: Utils.addMinutes(zmanim[0].time, 720),
331
- alos: zmanim[1].time,
332
- shkia: zmanim[2].time,
333
- };
334
- };
335
- /**
336
- * Returns all the zmanim for the given day
337
- * @param {Date|jDate} date
338
- * @param {Location} location
339
- * @returns {{zmanType:ZmanToShow, time?:Time }[]}
340
- */
341
- ZmanimUtils.getAllZmanim = function (date, location) {
342
- var _a = Utils.bothDates(date), sdate = _a.sdate, jdate = _a.jdate;
343
- return ZmanimUtils.getZmanTimes(ZmanTypes, sdate, jdate, location);
344
- };
345
- ZmanimUtils.zmanTimesCache = [];
346
- return ZmanimUtils;
347
- }());
348
- export default ZmanimUtils;
349
- //# sourceMappingURL=ZmanimUtils.js.map