jcal-zmanim 1.0.50 → 1.1.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 (83) hide show
  1. package/LICENSE +674 -674
  2. package/{build → dist}/JCal/Dafyomi.d.ts +4 -3
  3. package/dist/JCal/Dafyomi.d.ts.map +1 -0
  4. package/{build → dist}/JCal/Dafyomi.js +9 -8
  5. package/dist/JCal/Dafyomi.js.map +1 -0
  6. package/{build → dist}/JCal/Location.d.ts +4 -4
  7. package/dist/JCal/Location.d.ts.map +1 -0
  8. package/{build → dist}/JCal/Location.js +10 -12
  9. package/dist/JCal/Location.js.map +1 -0
  10. package/{build → dist}/JCal/Molad.d.ts +1 -2
  11. package/dist/JCal/Molad.d.ts.map +1 -0
  12. package/{build → dist}/JCal/Molad.js +16 -19
  13. package/dist/JCal/Molad.js.map +1 -0
  14. package/{build → dist}/JCal/PirkeiAvos.d.ts +1 -0
  15. package/dist/JCal/PirkeiAvos.d.ts.map +1 -0
  16. package/{build → dist}/JCal/PirkeiAvos.js +4 -3
  17. package/dist/JCal/PirkeiAvos.js.map +1 -0
  18. package/{build → dist}/JCal/Sedra.d.ts +2 -1
  19. package/dist/JCal/Sedra.d.ts.map +1 -0
  20. package/{build → dist}/JCal/Sedra.js +2 -1
  21. package/dist/JCal/Sedra.js.map +1 -0
  22. package/{build → dist}/JCal/Zmanim.d.ts +1 -0
  23. package/dist/JCal/Zmanim.d.ts.map +1 -0
  24. package/{build → dist}/JCal/Zmanim.js +16 -16
  25. package/dist/JCal/Zmanim.js.map +1 -0
  26. package/{build/AppUtils.d.ts → dist/JCal/ZmanimUtils.d.ts} +10 -47
  27. package/dist/JCal/ZmanimUtils.d.ts.map +1 -0
  28. package/{build/AppUtils.js → dist/JCal/ZmanimUtils.js} +56 -122
  29. package/dist/JCal/ZmanimUtils.js.map +1 -0
  30. package/{build → dist}/JCal/jDate.d.ts +4 -3
  31. package/dist/JCal/jDate.d.ts.map +1 -0
  32. package/{build → dist}/JCal/jDate.js +24 -24
  33. package/dist/JCal/jDate.js.map +1 -0
  34. package/dist/Locations.d.ts +31 -0
  35. package/dist/Locations.d.ts.map +1 -0
  36. package/dist/Locations.js +119 -0
  37. package/dist/Locations.js.map +1 -0
  38. package/dist/Notifications.d.ts +18 -0
  39. package/dist/Notifications.d.ts.map +1 -0
  40. package/{build → dist}/Notifications.js +112 -131
  41. package/dist/Notifications.js.map +1 -0
  42. package/dist/README.md +567 -0
  43. package/{build/JCal → dist}/Utils.d.ts +72 -10
  44. package/dist/Utils.d.ts.map +1 -0
  45. package/{build/JCal → dist}/Utils.js +176 -70
  46. package/dist/Utils.js.map +1 -0
  47. package/{build → dist}/ZmanTypes.d.ts +11 -4
  48. package/dist/ZmanTypes.d.ts.map +1 -0
  49. package/{build → dist}/ZmanTypes.js +12 -5
  50. package/dist/ZmanTypes.js.map +1 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +43 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/locations.json +1 -0
  56. package/package.json +43 -33
  57. package/README.md +0 -2
  58. package/build/GeneralUtils.d.ts +0 -43
  59. package/build/GeneralUtils.js +0 -93
  60. package/build/Locations.d.ts +0 -7
  61. package/build/Locations.js +0 -1308
  62. package/build/Notifications.d.ts +0 -14
  63. package/build/Settings.d.ts +0 -25
  64. package/build/Settings.js +0 -75
  65. package/build/index.d.ts +0 -1
  66. package/build/index.js +0 -59
  67. package/src/AppUtils.ts +0 -500
  68. package/src/GeneralUtils.ts +0 -84
  69. package/src/JCal/Dafyomi.ts +0 -139
  70. package/src/JCal/Location.ts +0 -100
  71. package/src/JCal/Molad.ts +0 -105
  72. package/src/JCal/PirkeiAvos.ts +0 -180
  73. package/src/JCal/Sedra.ts +0 -215
  74. package/src/JCal/Utils.ts +0 -732
  75. package/src/JCal/Zmanim.ts +0 -270
  76. package/src/JCal/jDate.ts +0 -714
  77. package/src/Locations.ts +0 -1303
  78. package/src/Notifications.ts +0 -1243
  79. package/src/Settings.ts +0 -103
  80. package/src/ZmanTypes.ts +0 -184
  81. package/src/index.ts +0 -31
  82. package/src/jcal-zmanim.d.ts +0 -4
  83. package/tsconfig.json +0 -109
package/src/JCal/Sedra.ts DELETED
@@ -1,215 +0,0 @@
1
- import jDate from './jDate.js';
2
-
3
- /**
4
- * Computes the Sedra/Sedras of the week for the given day.
5
- * The property "sedras" an array of sedras (either one or two) for the given Jewish Date
6
- * Sample of use to get todays sedra in Israel:
7
- * const sedras = new Sedra(new jDate(new Date(), true)).toString();
8
- * The code was converted to javascript and tweaked by CBS.
9
- * It is directly based on the C code in Danny Sadinoff's HebCal - Copyright (C) 1994.
10
- * Portions of that code are Copyright (c) 2002 Michael J. Radwin. All Rights Reserved.
11
- * Many of the algorithms were taken from hebrew calendar routines implemented by Nachum Dershowitz
12
- * @property sedras {[{ eng: String, heb: String }]}
13
- */
14
- export default class Sedra {
15
- sedras: { eng: string, heb: string}[];
16
- /**
17
- * @param {jDate} jd
18
- * @param {boolean} israel
19
- */
20
- constructor(jd:jDate, israel:boolean) {
21
- //If we are between the first day of Sukkos and Simchas Torah, the sedra will always be Vezos Habracha.
22
- if (jd.Month === 7 && jd.Day >= 15 && jd.Day < (israel ? 23 : 24)) {
23
- this.sedras = [Sedra.sedraList[53]];
24
- return;
25
- }
26
-
27
- let sedraArray:{ eng: string, heb: string}[] = [],
28
- sedraOrder = Sedra.getSedraOrder(jd.Year, israel),
29
- absDate = jd.Abs,
30
- index:number,
31
- weekNum:number;
32
-
33
- /* find the first saturday on or after today's date */
34
- absDate = Sedra.getDayOnOrBefore(6, absDate + 6);
35
-
36
- weekNum = (absDate - sedraOrder.firstSatInYear) / 7;
37
-
38
- if (sedraOrder.sedraArray && weekNum >= sedraOrder.sedraArray.length) {
39
- const indexLast = sedraOrder.sedraArray[sedraOrder.sedraArray.length - 1];
40
- if (indexLast < 0) {
41
- /* advance 2 parashiyot ahead after a doubled week */
42
- index = (-indexLast) + 2;
43
- }
44
- else {
45
- index = indexLast + 1;
46
- }
47
- }
48
- else {
49
- index = (sedraOrder.sedraArray
50
- ?sedraOrder.sedraArray[weekNum]
51
- :-1);
52
- }
53
-
54
- if (index >= 0) {
55
- sedraArray = [Sedra.sedraList[index]];
56
- }
57
- else {
58
- const i = -index; /* undouble the sedra */
59
- sedraArray = [Sedra.sedraList[i], Sedra.sedraList[i + 1]];
60
- }
61
- this.sedras = sedraArray;
62
- }
63
-
64
- /**
65
- * Gets the sedra/s as a string. If there are two, they are seperated by a " - "
66
- */
67
- toString() {
68
- return this.sedras.map(s => s.eng).join(' - ');
69
- }
70
-
71
- /**
72
- * Gets the sedra/s as a string. If there are two, they are seperated by a " - "
73
- */
74
- toStringHeb() {
75
- return this.sedras.map(s => s.heb).join(' - ');
76
- }
77
-
78
- static lastCalculatedYear:{firstSatInYear:number,sedraArray?: number[],year: number,israel: boolean}|null = null;
79
- static sedraList = [{ eng: 'Bereshis', heb: 'בראשית' }, { eng: 'Noach', heb: 'נח' }, { eng: 'Lech-Lecha', heb: 'לך לך' }, { eng: 'Vayera', heb: 'וירא' }, { eng: 'Chayei Sara', heb: 'חיי שרה' }, { eng: 'Toldos', heb: 'תולדות' }, { eng: 'Vayetzei', heb: 'ויצא' }, { eng: 'Vayishlach', heb: 'וישלח' }, { eng: 'Vayeishev', heb: 'וישב' }, { eng: 'Mikeitz', heb: 'מקץ' }, { eng: 'Vayigash', heb: 'ויגש' }, { eng: 'Vayechi', heb: 'ויחי' }, { eng: 'Shemos', heb: 'שמות' }, { eng: 'Va\'era', heb: 'וארא' }, { eng: 'Bo', heb: 'בא' }, { eng: 'Beshalach', heb: 'בשלח' }, { eng: 'Yisro', heb: 'יתרו' }, { eng: 'Mishpatim', heb: 'משפטים' }, { eng: 'Terumah', heb: 'תרומה' }, { eng: 'Tetzaveh', heb: 'תצוה' }, { eng: 'Ki Sisa', heb: 'כי תשא' }, { eng: 'Vayakhel', heb: 'ויקהל' }, { eng: 'Pekudei', heb: 'פקודי' }, { eng: 'Vayikra', heb: 'ויקרא' }, { eng: 'Tzav', heb: 'צו' }, { eng: 'Shmini', heb: 'שמיני' }, { eng: 'Tazria', heb: 'תזריע' }, { eng: 'Metzora', heb: 'מצורע' }, { eng: 'Achrei Mos', heb: 'אחרי מות' }, { eng: 'Kedoshim', heb: 'קדושים' }, { eng: 'Emor', heb: 'אמור' }, { eng: 'Behar', heb: 'בהר' }, { eng: 'Bechukosai', heb: 'בחקותי' }, { eng: 'Bamidbar', heb: 'במדבר' }, { eng: 'Nasso', heb: 'נשא' }, { eng: 'Beha\'aloscha', heb: 'בהעלתך' }, { eng: 'Sh\'lach', heb: 'שלח' }, { eng: 'Korach', heb: 'קרח' }, { eng: 'Chukas', heb: 'חקת' }, { eng: 'Balak', heb: 'בלק' }, { eng: 'Pinchas', heb: 'פינחס' }, { eng: 'Matos', heb: 'מטות' }, { eng: 'Masei', heb: 'מסעי' }, { eng: 'Devarim', heb: 'דברים' }, { eng: 'Va\'eschanan', heb: 'ואתחנן' }, { eng: 'Eikev', heb: 'עקב' }, { eng: 'Re\'eh', heb: 'ראה' }, { eng: 'Shoftim', heb: 'שופטים' }, { eng: 'Ki Seitzei', heb: 'כי תצא' }, { eng: 'Ki Savo', heb: 'כי תבא' }, { eng: 'Nitzavim', heb: 'נצבים' }, { eng: 'Vayeilech', heb: 'וילך' }, { eng: 'Ha\'Azinu', heb: 'האזינו' }, { eng: 'Vezos Habracha', heb: 'וזאת הברכה' }];
80
- static shabbos_short = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
81
- static shabbos_long = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
82
- static mon_short = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
83
- static mon_long = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
84
- static thu_normal = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
85
- static thu_normal_Israel = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
86
- static thu_long = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
87
- static shabbos_short_leap = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
88
- static shabbos_long_leap = [52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
89
- static mon_short_leap = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
90
- static mon_short_leap_Israel = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50];
91
- static mon_long_leap = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50];
92
- static mon_long_leap_Israel = [51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
93
- static thu_short_leap = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
94
- static thu_long_leap = [52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, -50];
95
-
96
- static getDayOnOrBefore(day_of_week:number, date:number) {
97
- return date - ((date - day_of_week) % 7);
98
- }
99
-
100
- static getSedraOrder(year:number, israel:boolean) {
101
- //If the last call is within the same year as this one, we reuse the data.
102
- //If memory is an issue, remove these next few lines
103
- if (Sedra.lastCalculatedYear != null &&
104
- Sedra.lastCalculatedYear.year === year &&
105
- Sedra.lastCalculatedYear.israel === israel) {
106
- return Sedra.lastCalculatedYear;
107
- }
108
-
109
- const longCheshvon = jDate.isLongCheshvan(year),
110
- shortKislev = jDate.isShortKislev(year),
111
- roshHashana = jDate.absJd(year, 7, 1),
112
- roshHashanaDOW = Math.abs(roshHashana % 7),
113
- firstSatInYear = Sedra.getDayOnOrBefore(6, roshHashana + 6);
114
- let yearType,
115
- sArray;
116
-
117
- if (longCheshvon && !shortKislev)
118
- yearType = 'complete';
119
- else if (!longCheshvon && shortKislev)
120
- yearType = 'incomplete';
121
- else
122
- yearType = 'regular';
123
-
124
- if (!jDate.isJdLeapY(year)) {
125
- switch (roshHashanaDOW) {
126
- case 6:
127
- if (yearType === 'incomplete') {
128
- sArray = Sedra.shabbos_short;
129
- }
130
- else if (yearType === 'complete') {
131
- sArray = Sedra.shabbos_long;
132
- }
133
- break;
134
-
135
- case 1:
136
- if (yearType === 'incomplete') {
137
- sArray = Sedra.mon_short;
138
- }
139
- else if (yearType === 'complete') {
140
- sArray = israel ? Sedra.mon_short : Sedra.mon_long;
141
- }
142
- break;
143
-
144
- case 2:
145
- if (yearType === 'regular') {
146
- sArray = israel ? Sedra.mon_short : Sedra.mon_long;
147
- }
148
- break;
149
-
150
- case 4:
151
- if (yearType === 'regular') {
152
- sArray = israel ? Sedra.thu_normal_Israel : Sedra.thu_normal;
153
- }
154
- else if (yearType === 'complete') {
155
- sArray = Sedra.thu_long;
156
- }
157
- break;
158
-
159
- default:
160
- throw 'improper sedra year type calculated.';
161
- }
162
- }
163
- else /* leap year */ {
164
- switch (roshHashanaDOW) {
165
- case 6:
166
- if (yearType === 'incomplete') {
167
- sArray = Sedra.shabbos_short_leap;
168
- }
169
- else if (yearType === 'complete') {
170
- sArray = israel ? Sedra.shabbos_short_leap : Sedra.shabbos_long_leap;
171
- }
172
- break;
173
-
174
- case 1:
175
- if (yearType === 'incomplete') {
176
- sArray = israel ? Sedra.mon_short_leap_Israel : Sedra.mon_short_leap;
177
- }
178
- else if (yearType === 'complete') {
179
- sArray = israel ? Sedra.mon_long_leap_Israel : Sedra.mon_long_leap;
180
- }
181
- break;
182
-
183
- case 2:
184
- if (yearType === 'regular') {
185
- sArray = israel ? Sedra.mon_long_leap_Israel : Sedra.mon_long_leap;
186
- }
187
- break;
188
-
189
- case 4:
190
- if (yearType === 'incomplete') {
191
- sArray = Sedra.thu_short_leap;
192
- }
193
- else if (yearType === 'complete') {
194
- sArray = Sedra.thu_long_leap;
195
- }
196
- break;
197
-
198
- default:
199
- throw 'improper sedra year type calculated.';
200
- }
201
- }
202
-
203
- const retobj = {
204
- firstSatInYear: firstSatInYear,
205
- sedraArray: sArray,
206
- year: year,
207
- israel: israel
208
- };
209
-
210
- //Save the data in case the next call is for the same year
211
- Sedra.lastCalculatedYear = retobj;
212
-
213
- return retobj;
214
- }
215
- }