jcal-zmanim 1.2.0 → 1.2.1

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 (58) hide show
  1. package/dist/index.cjs +13273 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +898 -0
  4. package/dist/index.d.ts +898 -2
  5. package/dist/index.js +3519 -35
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -9
  8. package/dist/JCal/Dafyomi.d.ts +0 -28
  9. package/dist/JCal/Dafyomi.d.ts.map +0 -1
  10. package/dist/JCal/Dafyomi.js +0 -130
  11. package/dist/JCal/Dafyomi.js.map +0 -1
  12. package/dist/JCal/Location.d.ts +0 -33
  13. package/dist/JCal/Location.d.ts.map +0 -1
  14. package/dist/JCal/Location.js +0 -77
  15. package/dist/JCal/Location.js.map +0 -1
  16. package/dist/JCal/Molad.d.ts +0 -38
  17. package/dist/JCal/Molad.d.ts.map +0 -1
  18. package/dist/JCal/Molad.js +0 -90
  19. package/dist/JCal/Molad.js.map +0 -1
  20. package/dist/JCal/PirkeiAvos.d.ts +0 -14
  21. package/dist/JCal/PirkeiAvos.d.ts.map +0 -1
  22. package/dist/JCal/PirkeiAvos.js +0 -171
  23. package/dist/JCal/PirkeiAvos.js.map +0 -1
  24. package/dist/JCal/Sedra.d.ts +0 -64
  25. package/dist/JCal/Sedra.d.ts.map +0 -1
  26. package/dist/JCal/Sedra.js +0 -183
  27. package/dist/JCal/Sedra.js.map +0 -1
  28. package/dist/JCal/Zmanim.d.ts +0 -96
  29. package/dist/JCal/Zmanim.d.ts.map +0 -1
  30. package/dist/JCal/Zmanim.js +0 -223
  31. package/dist/JCal/Zmanim.js.map +0 -1
  32. package/dist/JCal/ZmanimUtils.d.ts +0 -72
  33. package/dist/JCal/ZmanimUtils.d.ts.map +0 -1
  34. package/dist/JCal/ZmanimUtils.js +0 -349
  35. package/dist/JCal/ZmanimUtils.js.map +0 -1
  36. package/dist/JCal/jDate.d.ts +0 -204
  37. package/dist/JCal/jDate.d.ts.map +0 -1
  38. package/dist/JCal/jDate.js +0 -648
  39. package/dist/JCal/jDate.js.map +0 -1
  40. package/dist/Locations.d.ts +0 -31
  41. package/dist/Locations.d.ts.map +0 -1
  42. package/dist/Locations.js +0 -153
  43. package/dist/Locations.js.map +0 -1
  44. package/dist/Notifications.d.ts +0 -18
  45. package/dist/Notifications.d.ts.map +0 -1
  46. package/dist/Notifications.js +0 -1039
  47. package/dist/Notifications.js.map +0 -1
  48. package/dist/README.md +0 -567
  49. package/dist/Utils.d.ts +0 -287
  50. package/dist/Utils.d.ts.map +0 -1
  51. package/dist/Utils.js +0 -822
  52. package/dist/Utils.js.map +0 -1
  53. package/dist/ZmanTypes.d.ts +0 -41
  54. package/dist/ZmanTypes.d.ts.map +0 -1
  55. package/dist/ZmanTypes.js +0 -187
  56. package/dist/ZmanTypes.js.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/locations.json +0 -1
@@ -1,648 +0,0 @@
1
- import { Utils, DaysOfWeekEng, JewishMonthsEng, DaysOfWeekHeb, JewishMonthsHeb } from '../Utils.js';
2
- import Sedra from './Sedra.js';
3
- import PirkeiAvos from './PirkeiAvos.js';
4
- import Zmanim from './Zmanim.js';
5
- import DafYomi from './Dafyomi.js';
6
- /** Keeps a "memcache" of years that have had their elapsed days previously calculated. Format: { year:5776, elapsed:2109283 } */
7
- var _yearCache = [],
8
- //The absolute date for the zero hour of all javascript date objects - 1/1/1970 0:00:00 UTC
9
- JS_START_DATE_ABS = 719163,
10
- //The number of milliseconds in everyday
11
- MS_PER_DAY = 8.64e7,
12
- //The time zone offset (in minutes) for 1/1/1970 0:00:00 UTC at the current users time zone
13
- JS_START_OFFSET = new Date(0).getTimezoneOffset();
14
- /* ****************************************************************************************************************
15
- * Many of the date conversion algorithms in the jDate class are based on the C code which was translated from Lisp
16
- * in "Calendrical Calculations" by Nachum Dershowitz and Edward M. Reingold
17
- * in Software---Practice & Experience, vol. 20, no. 9 (September, 1990), pp. 899--928.
18
- * ****************************************************************************************************************/
19
- /** Represents a single day in the Jewish Calendar. */
20
- var jDate = /** @class */ (function () {
21
- /**
22
- * Create a new Jdate.
23
- * new jDate() - Sets the Jewish Date for the current system date
24
- * new jDate(javascriptDateObject) - Sets to the Jewish date on the given Gregorian date
25
- * new jDate("January 1 2045") - Accepts any valid javascript Date string (uses javascripts new Date(string))
26
- * new jDate(jewishYear, jewishMonth, jewishDay) - Months start at 1. Nissan is month 1 Adar Sheini is 13.
27
- * new jDate(jewishYear, jewishMonth) - Same as above, with Day defaulting to 1
28
- * new jDate( { year: 5776, month: 4, day: 5 } ) - same as new jDate(jewishYear, jewishMonth, jewishDay)
29
- * new jDate( { year: 5776, month: 4 } ) - same as new jDate(jewishYear, jewishMonth)
30
- * new jDate( { year: 5776 } ) - sets to the first day of Rosh Hashana on the given year
31
- * new jDate(absoluteDate) - The number of days elapsed since the theoretical date Sunday, December 31, 0001 BCE
32
- * new jDate(jewishYear, jewishMonth, jewishDay, absoluteDate) - Most efficient constructor. Needs no calculations at all.
33
- * new jDate( { year: 5776, month: 4, day: 5, abs: 122548708 } ) - same as new jDate(jewishYear, jewishMonth, jewishDay, absoluteDate)
34
- * @param {number | Date | string | {year:number,month:number,day:number} | [number, number, number, number]} [arg] The full Jewish year number OR Javascript Date object or string OR object or array of year, month, day
35
- * @param {number} [month] The month of the Jewish date. Nissan is 1.
36
- * @param {number} [day] The day of the month
37
- * @param {number} [abs] The number of days that have passed since 12/31/0001
38
- */
39
- function jDate(arg, month, day, abs) {
40
- //The day of the Jewish Month
41
- this.Day = NaN;
42
- //The Jewish Month. As in the Torah, Nissan is 1 and Adara Sheini is 13
43
- this.Month = NaN;
44
- //The number of years since the creation of the world
45
- this.Year = NaN;
46
- //The number of days since the theoretical date: Dec. 31, 0001 BCE
47
- this.Abs = NaN;
48
- if (arguments.length === 0) {
49
- this.fromAbs(jDate.absSd(new Date()));
50
- }
51
- else if (arg instanceof Date) {
52
- if (Utils.isValidDate(arg)) {
53
- this.fromAbs(jDate.absSd(arg));
54
- }
55
- else {
56
- throw 'jDate constructor: The given Date is not a valid javascript Date';
57
- }
58
- }
59
- else if (Array.isArray(arg) && arg.length >= 3) {
60
- this.Day = arg[0];
61
- this.Month = arg[1];
62
- this.Year = arg[2];
63
- this.Abs =
64
- (arg.length > 3 && arg[3]) ||
65
- jDate.absJd(this.Year, this.Month, this.Day);
66
- }
67
- else if (arg && Utils.isString(arg)) {
68
- var d = new Date(arg);
69
- if (Utils.isValidDate(d)) {
70
- this.fromAbs(jDate.absSd(d));
71
- }
72
- else {
73
- throw ('jDate constructor: The given string "' +
74
- arg +
75
- '" cannot be parsed into a Date');
76
- }
77
- }
78
- else if (Utils.isNumber(arg)) {
79
- //if no other arguments were supplied, we assume that the supplied number is an absolute date
80
- if (arguments.length === 1) {
81
- this.fromAbs(arg);
82
- }
83
- //If the year and any other number is supplied, we set the year and create the date using either the supplied values or the defaults
84
- else {
85
- this.Year = arg;
86
- this.Month = month || 7; //If no month was supplied, we take Tishrei
87
- this.Day = day || 1; //If no day was supplied, we take the first day of the month
88
- //If the absolute date was also supplied (very efficient), we use the supplied value, otherwise we calculate it.
89
- this.Abs = abs || jDate.absJd(this.Year, this.Month, this.Day);
90
- }
91
- }
92
- //If arg is an object that has a "year" property that contains a valid value...
93
- else if (typeof arg === 'object') {
94
- var argObj = arg;
95
- if (Utils.isNumber(argObj.year)) {
96
- this.Day = argObj.day || 1;
97
- this.Month = argObj.month || 7;
98
- this.Year = argObj.year;
99
- this.Abs = argObj.abs || jDate.absJd(this.Year, this.Month, this.Day);
100
- }
101
- }
102
- }
103
- /**Sets the current Jewish date from the given absolute date*/
104
- jDate.prototype.fromAbs = function (absolute) {
105
- var ymd = jDate.fromAbs(absolute);
106
- this.Year = ymd.year;
107
- this.Month = ymd.month;
108
- this.Day = ymd.day;
109
- this.Abs = absolute;
110
- };
111
- /**Returns a valid javascript Date object that represents the Gregorian date
112
- that starts at midnight of the current Jewish date.*/
113
- jDate.prototype.getDate = function () {
114
- return jDate.sdFromAbs(this.Abs);
115
- };
116
- /**
117
- * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6.
118
- */
119
- jDate.prototype.getDayOfWeek = function () {
120
- return Math.abs(this.Abs % 7);
121
- };
122
- Object.defineProperty(jDate.prototype, "DayOfWeek", {
123
- /**
124
- * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6
125
- */
126
- get: function () {
127
- return this.getDayOfWeek();
128
- },
129
- enumerable: false,
130
- configurable: true
131
- });
132
- /**Returns a new Jewish date represented by adding the given number of days to the current Jewish date.*/
133
- jDate.prototype.addDays = function (days) {
134
- return new jDate(this.Abs + days);
135
- };
136
- /**
137
- * Returns a new Jewish date represented by adding the given number of
138
- * Jewish Months to the current Jewish date.
139
- * If the current Day is 30 and the new month only has 29 days,
140
- * the 29th day of the month is returned.
141
- * @param {number} months
142
- */
143
- jDate.prototype.addMonths = function (months) {
144
- var year = this.Year, month = this.Month, day = this.Day, miy = jDate.monthsJYear(year);
145
- for (var i = 0; i < Math.abs(months); i++) {
146
- if (months > 0) {
147
- month += 1;
148
- if (month > miy) {
149
- month = 1;
150
- }
151
- if (month === 7) {
152
- year += 1;
153
- miy = jDate.monthsJYear(year);
154
- }
155
- }
156
- else if (months < 0) {
157
- month -= 1;
158
- if (month === 0) {
159
- month = miy;
160
- }
161
- if (month === 6) {
162
- year -= 1;
163
- miy = jDate.monthsJYear(year);
164
- }
165
- }
166
- }
167
- if (day === 30 && jDate.daysJMonth(year, month) === 29) {
168
- day = 29;
169
- }
170
- return new jDate(year, month, day);
171
- };
172
- /**
173
- * Returns a new Jewish date represented by adding the
174
- * given number of Jewish Years to the current Jewish date.
175
- * If the current Day is 30 and the new dates month only has 29 days,
176
- * the 29th day of the month is returned.
177
- * @param {number} years
178
- */
179
- jDate.prototype.addYears = function (years) {
180
- var year = this.Year + years, month = this.Month, day = this.Day;
181
- if (month === 13 && !jDate.isJdLeapY(year)) {
182
- month = 12;
183
- }
184
- else if (month === 8 && day === 30 && !jDate.isLongCheshvan(year)) {
185
- month = 9;
186
- day = 1;
187
- }
188
- else if (month === 9 && day === 30 && jDate.isShortKislev(year)) {
189
- month = 10;
190
- day = 1;
191
- }
192
- if (day === 30 && jDate.daysJMonth(year, month) === 29) {
193
- day = 29;
194
- }
195
- return new jDate(year, month, day);
196
- };
197
- jDate.prototype.addSecularMonths = function (months) {
198
- var secDate = new Date(this.getDate().valueOf());
199
- secDate.setMonth(secDate.getMonth() + months);
200
- return new jDate(secDate);
201
- };
202
- jDate.prototype.addSecularYears = function (years) {
203
- var secDate = new Date(this.getDate().valueOf());
204
- secDate.setFullYear(secDate.getFullYear() + years);
205
- return new jDate(secDate);
206
- };
207
- /**Gets the number of days separating this Jewish Date and the given one.
208
- *
209
- * If the given date is before this one, the number will be negative.
210
- * @param {jDate} jd
211
- * */
212
- jDate.prototype.diffDays = function (jd) {
213
- return jd.Abs - this.Abs;
214
- };
215
- /**Gets the number of months separating this Jewish Date and the given one.
216
- *
217
- * Ignores the Day property:
218
- *
219
- * jDate.toJDate(5777, 6, 29).diffMonths(jDate.toJDate(5778, 7, 1)) will return 1 even though they are a day apart.
220
- *
221
- * If the given date is before this one, the number will be negative.
222
- * @param {jDate} jd
223
- * */
224
- jDate.prototype.diffMonths = function (jd) {
225
- var month = jd.Month, year = jd.Year, months = 0;
226
- while (!(year === this.Year && month === this.Month)) {
227
- if (this.Abs > jd.Abs) {
228
- months--;
229
- month++;
230
- if (month > jDate.monthsJYear(year)) {
231
- month = 1;
232
- }
233
- else if (month === 7) {
234
- year++;
235
- }
236
- }
237
- else {
238
- months++;
239
- month--;
240
- if (month < 1) {
241
- month = jDate.monthsJYear(year);
242
- }
243
- else if (month === 6) {
244
- year--;
245
- }
246
- }
247
- }
248
- return months;
249
- };
250
- /**Gets the number of years separating this Jewish Date and the given one.
251
- *
252
- * Ignores the Day and Month properties:
253
- *
254
- * jDate.toJDate(5777, 6, 29).diffYears(jDate.toJDate(5778, 7, 1)) will return 1 even though they are a day apart.
255
- *
256
- * If the given date is before this one, the number will be negative.
257
- * @param {jDate} jd*/
258
- jDate.prototype.diffYears = function (jd) {
259
- return jd.Year - this.Year;
260
- };
261
- /**
262
- * Returns the current Jewish date in the format: Thursday, the 3rd of Kislev 5776.
263
- * @param {boolean} hideDayOfWeek
264
- * @param {boolean} dontCapitalize
265
- */
266
- jDate.prototype.toString = function (hideDayOfWeek, dontCapitalize) {
267
- return ((hideDayOfWeek
268
- ? dontCapitalize
269
- ? 't'
270
- : 'T'
271
- : DaysOfWeekEng[this.getDayOfWeek()] + ', t') +
272
- 'he ' +
273
- Utils.toSuffixed(this.Day) +
274
- ' of ' +
275
- this.monthName());
276
- };
277
- /**
278
- * Returns the current Jewish date in the format "[Tuesday] Nissan 3, 5778"
279
- * @param {boolean} showDow - show day of week?
280
- */
281
- jDate.prototype.toShortstring = function (showDow) {
282
- return ((showDow ? DaysOfWeekEng[this.getDayOfWeek()] + ' ' : '') +
283
- JewishMonthsEng[this.Month] +
284
- ' ' +
285
- this.Day.toString() +
286
- ', ' +
287
- this.Year.toString());
288
- };
289
- /**
290
- * Returns the current Jewish date in the format "Nissan 5778"
291
- * @param {boolean} showYear - show the year number?
292
- */
293
- jDate.prototype.monthName = function (showYear) {
294
- if (showYear === void 0) { showYear = true; }
295
- return (JewishMonthsEng[this.Month] +
296
- (showYear ? ' ' + this.Year.toString() : ''));
297
- };
298
- /**Returns the current Jewish date in the format: יום חמישי כ"א כסלו תשע"ו.*/
299
- jDate.prototype.toStringHeb = function () {
300
- return (DaysOfWeekHeb[this.getDayOfWeek()] +
301
- ' ' +
302
- Utils.toJewishNumber(this.Day) +
303
- ' ' +
304
- JewishMonthsHeb[this.Month] +
305
- ' ' +
306
- Utils.toJewishNumber(this.Year % 1000));
307
- };
308
- /**Gets the day of the omer for the current Jewish date. If the date is not during sefira, 0 is returned.*/
309
- jDate.prototype.getDayOfOmer = function () {
310
- var dayOfOmer = 0;
311
- if ((this.Month === 1 && this.Day > 15) ||
312
- this.Month === 2 ||
313
- (this.Month === 3 && this.Day < 6)) {
314
- var first = new jDate(this.Year, 1, 15);
315
- dayOfOmer = first.diffDays(this);
316
- }
317
- return dayOfOmer;
318
- };
319
- /**
320
- * Returns true if this day is yomtov or chol hamoed
321
- * @param {boolean} israel
322
- */
323
- jDate.prototype.isYomTovOrCholHamoed = function (israel) {
324
- return (this.isYomTov(israel) ||
325
- (this.Month === 1 && [16, 17, 18, 19, 20].includes(this.Day)) ||
326
- (this.Month === 7 && [16, 17, 18, 19, 20, 21].includes(this.Day)));
327
- };
328
- /**
329
- * Returns true if this day is yomtov
330
- * @param {boolean} israel
331
- */
332
- jDate.prototype.isYomTov = function (israel) {
333
- var day = this.Day;
334
- switch (this.Month) {
335
- case 1:
336
- if (day === 15 || day === 21)
337
- return true;
338
- if (!israel && (day === 16 || day === 22))
339
- return true;
340
- break;
341
- case 3:
342
- if (day === 6 || (!israel && day === 7))
343
- return true;
344
- break;
345
- case 7:
346
- if ([1, 2, 10, 15, 22].includes(day)) {
347
- return true;
348
- }
349
- if (!israel && (day === 16 || day === 23))
350
- return true;
351
- break;
352
- }
353
- return false;
354
- };
355
- /**Is today Erev Yom Tov? (includes Erev second days of Sukkos and Pesach) */
356
- jDate.prototype.isErevYomTov = function () {
357
- return ((this.Month === 1 && Utils.has(this.Day, 14, 20)) ||
358
- (this.Month === 3 && this.Day === 5) ||
359
- (this.Month === 6 && this.Day === 29) ||
360
- (this.Month === 7 && Utils.has(this.Day, 9, 14, 21)));
361
- };
362
- /**Does the current Jewish date have candle lighting before sunset?*/
363
- jDate.prototype.hasCandleLighting = function () {
364
- var dow = this.getDayOfWeek();
365
- if (dow === 5) {
366
- return true;
367
- }
368
- else if (dow === 6) {
369
- //there is no "candle lighting time" - even if yom tov is on Motzai Shabbos
370
- return false;
371
- }
372
- return this.isErevYomTov();
373
- };
374
- /**Is the current Jewish Date the day before a yomtov that contains a Friday?*/
375
- jDate.prototype.hasEiruvTavshilin = function (israel) {
376
- var dow = this.getDayOfWeek();
377
- return (
378
- //Eiruv Tavshilin is only on Wednesday or Thursday
379
- [3, 4].includes(dow) &&
380
- //today is Erev Yomtov
381
- this.isErevYomTov() &&
382
- //Thursday OR Wednesday when in Chu"l or Erev Rosh Hashana anywhere
383
- (dow === 4 || (dow === 3 && (!israel || this.Month === 6))) &&
384
- //No Eiruv Tavshilin on Erev yom kippur
385
- this.Day !== 9);
386
- };
387
- /**Gets the candle lighting time for the current Jewish date for the given Location object.*/
388
- jDate.prototype.getCandleLighting = function (location, nullIfNoCandles) {
389
- if (!location) {
390
- throw 'To get sunrise and sunset, the location needs to be supplied';
391
- }
392
- if (this.hasCandleLighting()) {
393
- return Zmanim.getCandleLighting(this, location);
394
- }
395
- else if (nullIfNoCandles) {
396
- return null;
397
- }
398
- else {
399
- throw 'No candle lighting on ' + this.toString();
400
- }
401
- };
402
- /**Get the sedra of the week for the current Jewish date.*/
403
- jDate.prototype.getSedra = function (israel) {
404
- return new Sedra(this, israel);
405
- };
406
- /**Get the prakim of Pirkei Avos for the current Jewish date.*/
407
- jDate.prototype.getPirkeiAvos = function (israel) {
408
- return PirkeiAvos.getPrakim(this, israel);
409
- };
410
- /**Gets sunrise and sunset time for the current Jewish date at the given Location.
411
- *
412
- * Return format: {sunrise: {hour: 6, minute: 18}, sunset: {hour: 19, minute: 41}}*/
413
- jDate.prototype.getSunriseSunset = function (location, ignoreElevation) {
414
- if (!location) {
415
- throw 'To get sunrise and sunset, the location needs to be supplied';
416
- }
417
- return Zmanim.getSunTimes(this, location, !ignoreElevation);
418
- };
419
- /**Gets Chatzos for both the day and the night for the current Jewish date at the given Location.
420
- *
421
- *Return format: {hour: 11, minute: 48}*/
422
- jDate.prototype.getChatzos = function (location) {
423
- if (!location) {
424
- throw 'To get Chatzos, the location needs to be supplied';
425
- }
426
- return Zmanim.getChatzos(this, location);
427
- };
428
- /**Gets the length of a single Sha'a Zmanis in minutes for the current Jewish date at the given Location.*/
429
- jDate.prototype.getShaaZmanis = function (location, offset) {
430
- if (!location) {
431
- throw 'To get the Shaa Zmanis, the location needs to be supplied';
432
- }
433
- return Zmanim.getShaaZmanis(this, location, offset);
434
- };
435
- /**Returns the daily daf in English. For example: Sukkah, Daf 3.*/
436
- jDate.prototype.getDafYomi = function () {
437
- return DafYomi.toString(this) || '';
438
- };
439
- /**Gets the daily daf in Hebrew. For example: 'סוכה דף כ.*/
440
- jDate.prototype.getDafyomiHeb = function () {
441
- return DafYomi.toStringHeb(this) || '';
442
- };
443
- /**
444
- * Converts its argument/s to a Jewish Date.
445
- * Samples of use:
446
- * To get the current Jewish Date: jDate.toJDate(new Date()).
447
- * To print out the current date in English: jDate.toJDate(new Date()).toString()
448
- * To print out the current date in Hebrew: jDate.toJDate(new Date()).toStringHeb()
449
- *
450
- * Arguments to the jDate.toJDate function can be one of the following:
451
- * jDate.toJDate() - Sets the Jewish Date for the current system date
452
- * jDate.toJDate(Date) - Sets to the Jewish date on the given Javascript Date object
453
- * jDate.toJDate("January 1 2045") - Accepts any valid Javascript Date string (uses string constructor of Date object)
454
- * jDate.toJDate(jewishYear, jewishMonth, jewishDay) - Months start at 1. Nissan is month 1 Adara Sheini is 13.
455
- * jDate.toJDate(jewishYear, jewishMonth) - Same as above, with Day defaulting to 1
456
- * jDate.toJDate(jewishYear) - sets to the first day of Rosh Hashana on the given year
457
- * jDate.toJDate( { year: 5776, month: 4, day: 5 } ) - Months start at 1. Nissan is month 1 Adara Sheini is 13.
458
- * jDate.toJDate( { year: 5776, month: 4 } ) - Same as above, with Day defaulting to 1
459
- * jDate.toJDate( { year: 5776 } ) - sets to the first day of Rosh Hashana on the given year
460
- * jDate.toJDate(jewishYear, jewishMonth, jewishDay, absoluteDate) - Most efficient. Needs no calculations at all. The absoluteDate is the number of days elapsed since the theoretical date Sunday, December 31, 0001 BCE.
461
- * jDate.toJDate( { year: 5776, month: 4, day: 5, abs: 122548708 } ) - same as jDate.toJDate(jewishYear, jewishMonth, jewishDay, absoluteDate)
462
- ****************************************************************************************************************/
463
- jDate.toJDate = function (arg, month, day, abs) {
464
- if (arguments.length === 0) {
465
- return new jDate();
466
- }
467
- // If just the year is set, then the date is set to Rosh Hashana of that year.
468
- // In the above scenario, we can't just pass the args along, as the constructor will treat it as an absolute date.
469
- //...and that folks, is actually the whole point of this function...
470
- else if (Utils.isNumber(arg) && arguments.length === 1) {
471
- return new jDate(arg, 7, 1);
472
- }
473
- else {
474
- return new jDate(arg, month, day, abs);
475
- }
476
- };
477
- jDate.now = function () {
478
- return new jDate();
479
- };
480
- /**Calculate the Jewish year, month and day for the given absolute date.*/
481
- jDate.fromAbs = function (absDay) {
482
- //To save on calculations, start with a few years before date
483
- var year = 3761 + Utils.toInt(absDay / (absDay > 0 ? 366 : 300)), month, day;
484
- // Search forward for year from the approximation year.
485
- while (absDay >= jDate.absJd(year + 1, 7, 1)) {
486
- year++;
487
- }
488
- // Search forward for month from either Tishrei or Nissan.
489
- month = absDay < jDate.absJd(year, 1, 1) ? 7 : 1;
490
- while (absDay > jDate.absJd(year, month, jDate.daysJMonth(year, month))) {
491
- month++;
492
- }
493
- // Calculate the day by subtraction.
494
- day = absDay - jDate.absJd(year, month, 1) + 1;
495
- return { year: year, month: month, day: day };
496
- };
497
- /**
498
- * Gets the absolute date of the given javascript Date object.
499
- * @param {Date} date
500
- */
501
- jDate.absSd = function (date) {
502
- //Get the correct number of milliseconds since 1/1/1970 00:00:00 UTC until current system time
503
- var ms = date.valueOf() - date.getTimezoneOffset() * 60000,
504
- //The number of full days since 1/1/1970.
505
- numFullDays = Math.floor(ms / MS_PER_DAY);
506
- //Add that to the number of days from 1/1/0001 until 1/1/1970 00:00:00 UTC
507
- return JS_START_DATE_ABS + numFullDays;
508
- };
509
- /**Calculate the absolute date for the given Jewish Date.*/
510
- jDate.absJd = function (year, month, day) {
511
- //The number of total days.
512
- var dayInYear = day; // day is the number of days so far this month.
513
- if (month < 7) {
514
- // Before Tishrei, so add days in prior months this year before and after Nissan.
515
- var m = 7;
516
- while (m <= jDate.monthsJYear(year)) {
517
- dayInYear += jDate.daysJMonth(year, m);
518
- m++;
519
- }
520
- m = 1;
521
- while (m < month) {
522
- dayInYear += jDate.daysJMonth(year, m);
523
- m++;
524
- }
525
- }
526
- else {
527
- // Add days in prior months this year
528
- var m = 7;
529
- while (m < month) {
530
- dayInYear += jDate.daysJMonth(year, m);
531
- m++;
532
- }
533
- }
534
- // Days elapsed before absolute date 1. - Days in prior years.
535
- return dayInYear + (jDate.tDays(year) + -1373429);
536
- };
537
- /**
538
- * Gets a javascript date from an absolute date
539
- */
540
- jDate.sdFromAbs = function (abs) {
541
- //The "zero hour" for Javascript is 1/1/1970 0:00:00 UTC.
542
- //If the time zone offset was more than 0, the current time zone was earlier than UTC at the time.
543
- //As the "zero hour" is at midnight, so if the current time was earlier than that, than it was during the previous date.
544
- //So we will need to add another day to get the correct date.
545
- var offset = JS_START_OFFSET > 0 ? 1 : 0,
546
- //Get the number of days from the "zero hour" until the given date.
547
- //This is done by taking the given absolute date and removing the
548
- //number of days from absolute date 0 until the js "zero hour" - keeping into
549
- //account the previously calculated possible day offset.
550
- daysSinceStart = abs - JS_START_DATE_ABS + offset;
551
- //Create a javascript date from the number of milliseconds since the "zero hour"
552
- return new Date(daysSinceStart * MS_PER_DAY);
553
- };
554
- /**number of days in the given Jewish Month. Nissan is 1 and Adar Sheini is 13.*/
555
- jDate.daysJMonth = function (year, month) {
556
- switch (month) {
557
- //Nissan, Sivan, Av, Tishrei and Shvat always have 30 days
558
- case 1:
559
- case 3:
560
- case 5:
561
- case 7:
562
- case 11:
563
- return 30;
564
- //Iyyar, Tammuz, Ellul, Teves and Adar Sheini always have 29 days.
565
- case 2:
566
- case 4:
567
- case 6:
568
- case 10:
569
- case 13:
570
- return 29;
571
- //Cheshvan sometimes has 29 days and sometimes 30 days.
572
- case 8:
573
- return jDate.isLongCheshvan(year) ? 30 : 29;
574
- //Kislev sometimes has 29 days and sometimes 30 days.
575
- case 9:
576
- return jDate.isShortKislev(year) ? 29 : 30;
577
- //Adar has 29 days unless it is Adar Rishon.
578
- case 12:
579
- return jDate.isJdLeapY(year) ? 30 : 29;
580
- }
581
- return 0;
582
- };
583
- /**Elapsed days since creation of the world until Rosh Hashana of the given year*/
584
- jDate.tDays = function (year) {
585
- /*As this function is called many times, often on the same year for all types of calculations,
586
- we save a list of years with their elapsed values.*/
587
- var cached = _yearCache.find(function (y) { return !!y && y.year === year; });
588
- //If this year was already calculated and cached, then we return the cached value.
589
- if (cached) {
590
- return cached.elapsed;
591
- }
592
- var months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle
593
- 12 * ((year - 1) % 19) + // Regular months in this cycle.
594
- (7 * ((year - 1) % 19) + 1) / 19), // Months in complete cycles so far.
595
- parts = 204 + 793 * (months % 1080), hours = 5 +
596
- 12 * months +
597
- 793 * Utils.toInt(months / 1080) +
598
- Utils.toInt(parts / 1080), conjDay = Utils.toInt(1 + 29 * months + hours / 24), conjParts = 1080 * (hours % 24) + (parts % 1080);
599
- var altDay;
600
- /* at the end of a leap year - 15 hours, 589 parts or later... -
601
- ... or is on a Monday at... - ...of a common year, -
602
- at 9 hours, 204 parts or later... - ...or is on a Tuesday... -
603
- If new moon is at or after midday,*/
604
- if (conjParts >= 19440 ||
605
- (conjDay % 7 === 2 &&
606
- conjParts >= 9924 &&
607
- !jDate.isJdLeapY(year)) ||
608
- (conjDay % 7 === 1 &&
609
- conjParts >= 16789 &&
610
- jDate.isJdLeapY(year - 1))) {
611
- // Then postpone Rosh HaShanah one day
612
- altDay = conjDay + 1;
613
- }
614
- else {
615
- altDay = conjDay;
616
- }
617
- // A day is added if Rosh HaShanah would occur on Sunday, Friday or Wednesday,
618
- if (Utils.has(altDay % 7, 0, 3, 5)) {
619
- altDay += 1;
620
- }
621
- //Add this year to the cache to save on calculations later on
622
- _yearCache.push({ year: year, elapsed: altDay });
623
- return altDay;
624
- };
625
- /**number of days in the given Jewish Year.*/
626
- jDate.daysJYear = function (year) {
627
- return jDate.tDays(year + 1) - jDate.tDays(year);
628
- };
629
- /**Does Cheshvan for the given Jewish Year have 30 days?*/
630
- jDate.isLongCheshvan = function (year) {
631
- return jDate.daysJYear(year) % 10 === 5;
632
- };
633
- /**Does Kislev for the given Jewish Year have 29 days?*/
634
- jDate.isShortKislev = function (year) {
635
- return jDate.daysJYear(year) % 10 === 3;
636
- };
637
- /**Does the given Jewish Year have 13 months?*/
638
- jDate.isJdLeapY = function (year) {
639
- return (7 * year + 1) % 19 < 7;
640
- };
641
- /**number of months in Jewish Year.*/
642
- jDate.monthsJYear = function (year) {
643
- return jDate.isJdLeapY(year) ? 13 : 12;
644
- };
645
- return jDate;
646
- }());
647
- export default jDate;
648
- //# sourceMappingURL=jDate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jDate.js","sourceRoot":"","sources":["../../src/JCal/jDate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC;AAClG,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,iIAAiI;AACjI,IAAM,UAAU,GAAyC,EAAE;AACvD,2FAA2F;AAC3F,iBAAiB,GAAG,MAAM;AAC1B,wCAAwC;AACxC,UAAU,GAAG,MAAM;AACnB,2FAA2F;AAC3F,eAAe,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACtD;;;;oHAIoH;AAEpH,sDAAsD;AACtD;IAMI;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAY,GAA8G,EAAE,KAAc,EAAE,GAAY,EAAE,GAAY;QAClK,6BAA6B;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG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