jcal-zmanim 1.1.6 → 1.1.8

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 (41) hide show
  1. package/dist/JCal/Dafyomi.js +66 -68
  2. package/dist/JCal/Dafyomi.js.map +1 -1
  3. package/dist/JCal/Location.js +17 -18
  4. package/dist/JCal/Location.js.map +1 -1
  5. package/dist/JCal/Molad.js +33 -35
  6. package/dist/JCal/Molad.js.map +1 -1
  7. package/dist/JCal/PirkeiAvos.js +143 -145
  8. package/dist/JCal/PirkeiAvos.js.map +1 -1
  9. package/dist/JCal/Sedra.js +40 -44
  10. package/dist/JCal/Sedra.js.map +1 -1
  11. package/dist/JCal/Zmanim.js +61 -62
  12. package/dist/JCal/Zmanim.js.map +1 -1
  13. package/dist/JCal/ZmanimUtils.d.ts +3 -3
  14. package/dist/JCal/ZmanimUtils.d.ts.map +1 -1
  15. package/dist/JCal/ZmanimUtils.js +246 -225
  16. package/dist/JCal/ZmanimUtils.js.map +1 -1
  17. package/dist/JCal/jDate.d.ts +1 -1
  18. package/dist/JCal/jDate.d.ts.map +1 -1
  19. package/dist/JCal/jDate.js +158 -157
  20. package/dist/JCal/jDate.js.map +1 -1
  21. package/dist/Locations.d.ts +1 -1
  22. package/dist/Locations.d.ts.map +1 -1
  23. package/dist/Locations.js +62 -30
  24. package/dist/Locations.js.map +1 -1
  25. package/dist/Notifications.d.ts +3 -3
  26. package/dist/Notifications.d.ts.map +1 -1
  27. package/dist/Notifications.js +171 -153
  28. package/dist/Notifications.js.map +1 -1
  29. package/dist/Utils.d.ts +3 -3
  30. package/dist/Utils.d.ts.map +1 -1
  31. package/dist/Utils.js +210 -160
  32. package/dist/Utils.js.map +1 -1
  33. package/dist/ZmanTypes.d.ts +1 -1
  34. package/dist/ZmanTypes.d.ts.map +1 -1
  35. package/dist/ZmanTypes.js +28 -32
  36. package/dist/ZmanTypes.js.map +1 -1
  37. package/dist/index.d.ts +71 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +36 -41
  40. package/dist/index.js.map +1 -1
  41. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"jDate.d.ts","sourceRoot":"","sources":["../../src/JCal/jDate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,YAAY,CAAC;AAI/B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAgBlC,sDAAsD;AACtD,MAAM,CAAC,OAAO,OAAO,KAAK;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;OAiBG;gBACS,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IA8DtK,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,EAAE,MAAM;IAQxB;yDACqD;IACrD,OAAO,IAAI,IAAI;IAGf;;OAEG;IACH,YAAY,IAAI,MAAM;IAGtB;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,yGAAyG;IACzG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAG5B;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK;IAiChC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK;IAqB9B,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK;IAKvC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK;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,EAAE,MAAM,GAAG,MAAM;IAItC,0DAA0D;IAC1D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI5C,wDAAwD;IACxD,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI3C,+CAA+C;IAC/C,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIvC,qCAAqC;IACrC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG3C"}
@@ -1,15 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Utils_js_1 = require("../Utils.js");
7
- const Sedra_js_1 = __importDefault(require("./Sedra.js"));
8
- const PirkeiAvos_js_1 = __importDefault(require("./PirkeiAvos.js"));
9
- const Zmanim_js_1 = __importDefault(require("./Zmanim.js"));
10
- const Dafyomi_1 = __importDefault(require("./Dafyomi"));
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';
11
6
  /** Keeps a "memcache" of years that have had their elapsed days previously calculated. Format: { year:5776, elapsed:2109283 } */
12
- const _yearCache = [],
7
+ var _yearCache = [],
13
8
  //The absolute date for the zero hour of all javascript date objects - 1/1/1970 0:00:00 UTC
14
9
  JS_START_DATE_ABS = 719163,
15
10
  //The number of milliseconds in everyday
@@ -22,7 +17,7 @@ JS_START_OFFSET = new Date(0).getTimezoneOffset();
22
17
  * in Software---Practice & Experience, vol. 20, no. 9 (September, 1990), pp. 899--928.
23
18
  * ****************************************************************************************************************/
24
19
  /** Represents a single day in the Jewish Calendar. */
25
- class jDate {
20
+ var jDate = /** @class */ (function () {
26
21
  /**
27
22
  * Create a new Jdate.
28
23
  * new jDate() - Sets the Jewish Date for the current system date
@@ -41,7 +36,7 @@ class jDate {
41
36
  * @param {number} [day] The day of the month
42
37
  * @param {number} [abs] The number of days that have passed since 12/31/0001
43
38
  */
44
- constructor(arg, month, day, abs) {
39
+ function jDate(arg, month, day, abs) {
45
40
  //The day of the Jewish Month
46
41
  this.Day = NaN;
47
42
  //The Jewish Month. As in the Torah, Nissan is 1 and Adara Sheini is 13
@@ -54,7 +49,7 @@ class jDate {
54
49
  this.fromAbs(jDate.absSd(new Date()));
55
50
  }
56
51
  else if (arg instanceof Date) {
57
- if (Utils_js_1.Utils.isValidDate(arg)) {
52
+ if (Utils.isValidDate(arg)) {
58
53
  this.fromAbs(jDate.absSd(arg));
59
54
  }
60
55
  else {
@@ -69,9 +64,9 @@ class jDate {
69
64
  (arg.length > 3 && arg[3]) ||
70
65
  jDate.absJd(this.Year, this.Month, this.Day);
71
66
  }
72
- else if (arg && Utils_js_1.Utils.isString(arg)) {
73
- const d = new Date(arg);
74
- if (Utils_js_1.Utils.isValidDate(d)) {
67
+ else if (arg && Utils.isString(arg)) {
68
+ var d = new Date(arg);
69
+ if (Utils.isValidDate(d)) {
75
70
  this.fromAbs(jDate.absSd(d));
76
71
  }
77
72
  else {
@@ -80,7 +75,7 @@ class jDate {
80
75
  '" cannot be parsed into a Date');
81
76
  }
82
77
  }
83
- else if (Utils_js_1.Utils.isNumber(arg)) {
78
+ else if (Utils.isNumber(arg)) {
84
79
  //if no other arguments were supplied, we assume that the supplied number is an absolute date
85
80
  if (arguments.length === 1) {
86
81
  this.fromAbs(arg);
@@ -96,8 +91,8 @@ class jDate {
96
91
  }
97
92
  //If arg is an object that has a "year" property that contains a valid value...
98
93
  else if (typeof arg === 'object') {
99
- const argObj = arg;
100
- if (Utils_js_1.Utils.isNumber(argObj.year)) {
94
+ var argObj = arg;
95
+ if (Utils.isNumber(argObj.year)) {
101
96
  this.Day = argObj.day || 1;
102
97
  this.Month = argObj.month || 7;
103
98
  this.Year = argObj.year;
@@ -106,34 +101,38 @@ class jDate {
106
101
  }
107
102
  }
108
103
  /**Sets the current Jewish date from the given absolute date*/
109
- fromAbs(absolute) {
110
- const ymd = jDate.fromAbs(absolute);
104
+ jDate.prototype.fromAbs = function (absolute) {
105
+ var ymd = jDate.fromAbs(absolute);
111
106
  this.Year = ymd.year;
112
107
  this.Month = ymd.month;
113
108
  this.Day = ymd.day;
114
109
  this.Abs = absolute;
115
- }
110
+ };
116
111
  /**Returns a valid javascript Date object that represents the Gregorian date
117
112
  that starts at midnight of the current Jewish date.*/
118
- getDate() {
113
+ jDate.prototype.getDate = function () {
119
114
  return jDate.sdFromAbs(this.Abs);
120
- }
115
+ };
121
116
  /**
122
117
  * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6.
123
118
  */
124
- getDayOfWeek() {
119
+ jDate.prototype.getDayOfWeek = function () {
125
120
  return Math.abs(this.Abs % 7);
126
- }
127
- /**
128
- * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6
129
- */
130
- get DayOfWeek() {
131
- return this.getDayOfWeek();
132
- }
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
+ });
133
132
  /**Returns a new Jewish date represented by adding the given number of days to the current Jewish date.*/
134
- addDays(days) {
133
+ jDate.prototype.addDays = function (days) {
135
134
  return new jDate(this.Abs + days);
136
- }
135
+ };
137
136
  /**
138
137
  * Returns a new Jewish date represented by adding the given number of
139
138
  * Jewish Months to the current Jewish date.
@@ -141,9 +140,9 @@ class jDate {
141
140
  * the 29th day of the month is returned.
142
141
  * @param {number} months
143
142
  */
144
- addMonths(months) {
145
- let year = this.Year, month = this.Month, day = this.Day, miy = jDate.monthsJYear(year);
146
- for (let i = 0; i < Math.abs(months); i++) {
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++) {
147
146
  if (months > 0) {
148
147
  month += 1;
149
148
  if (month > miy) {
@@ -169,7 +168,7 @@ class jDate {
169
168
  day = 29;
170
169
  }
171
170
  return new jDate(year, month, day);
172
- }
171
+ };
173
172
  /**
174
173
  * Returns a new Jewish date represented by adding the
175
174
  * given number of Jewish Years to the current Jewish date.
@@ -177,8 +176,8 @@ class jDate {
177
176
  * the 29th day of the month is returned.
178
177
  * @param {number} years
179
178
  */
180
- addYears(years) {
181
- let year = this.Year + years, month = this.Month, day = this.Day;
179
+ jDate.prototype.addYears = function (years) {
180
+ var year = this.Year + years, month = this.Month, day = this.Day;
182
181
  if (month === 13 && !jDate.isJdLeapY(year)) {
183
182
  month = 12;
184
183
  }
@@ -194,25 +193,25 @@ class jDate {
194
193
  day = 29;
195
194
  }
196
195
  return new jDate(year, month, day);
197
- }
198
- addSecularMonths(months) {
199
- const secDate = new Date(this.getDate().valueOf());
196
+ };
197
+ jDate.prototype.addSecularMonths = function (months) {
198
+ var secDate = new Date(this.getDate().valueOf());
200
199
  secDate.setMonth(secDate.getMonth() + months);
201
200
  return new jDate(secDate);
202
- }
203
- addSecularYears(years) {
204
- const secDate = new Date(this.getDate().valueOf());
201
+ };
202
+ jDate.prototype.addSecularYears = function (years) {
203
+ var secDate = new Date(this.getDate().valueOf());
205
204
  secDate.setFullYear(secDate.getFullYear() + years);
206
205
  return new jDate(secDate);
207
- }
206
+ };
208
207
  /**Gets the number of days separating this Jewish Date and the given one.
209
208
  *
210
209
  * If the given date is before this one, the number will be negative.
211
210
  * @param {jDate} jd
212
211
  * */
213
- diffDays(jd) {
212
+ jDate.prototype.diffDays = function (jd) {
214
213
  return jd.Abs - this.Abs;
215
- }
214
+ };
216
215
  /**Gets the number of months separating this Jewish Date and the given one.
217
216
  *
218
217
  * Ignores the Day property:
@@ -222,8 +221,8 @@ class jDate {
222
221
  * If the given date is before this one, the number will be negative.
223
222
  * @param {jDate} jd
224
223
  * */
225
- diffMonths(jd) {
226
- let month = jd.Month, year = jd.Year, months = 0;
224
+ jDate.prototype.diffMonths = function (jd) {
225
+ var month = jd.Month, year = jd.Year, months = 0;
227
226
  while (!(year === this.Year && month === this.Month)) {
228
227
  if (this.Abs > jd.Abs) {
229
228
  months--;
@@ -247,7 +246,7 @@ class jDate {
247
246
  }
248
247
  }
249
248
  return months;
250
- }
249
+ };
251
250
  /**Gets the number of years separating this Jewish Date and the given one.
252
251
  *
253
252
  * Ignores the Day and Month properties:
@@ -256,81 +255,82 @@ class jDate {
256
255
  *
257
256
  * If the given date is before this one, the number will be negative.
258
257
  * @param {jDate} jd*/
259
- diffYears(jd) {
258
+ jDate.prototype.diffYears = function (jd) {
260
259
  return jd.Year - this.Year;
261
- }
260
+ };
262
261
  /**
263
262
  * Returns the current Jewish date in the format: Thursday, the 3rd of Kislev 5776.
264
263
  * @param {boolean} hideDayOfWeek
265
264
  * @param {boolean} dontCapitalize
266
265
  */
267
- toString(hideDayOfWeek, dontCapitalize) {
266
+ jDate.prototype.toString = function (hideDayOfWeek, dontCapitalize) {
268
267
  return ((hideDayOfWeek
269
268
  ? dontCapitalize
270
269
  ? 't'
271
270
  : 'T'
272
- : Utils_js_1.DaysOfWeekEng[this.getDayOfWeek()] + ', t') +
271
+ : DaysOfWeekEng[this.getDayOfWeek()] + ', t') +
273
272
  'he ' +
274
- Utils_js_1.Utils.toSuffixed(this.Day) +
273
+ Utils.toSuffixed(this.Day) +
275
274
  ' of ' +
276
275
  this.monthName());
277
- }
276
+ };
278
277
  /**
279
278
  * Returns the current Jewish date in the format "[Tuesday] Nissan 3, 5778"
280
279
  * @param {boolean} showDow - show day of week?
281
280
  */
282
- toShortstring(showDow) {
283
- return ((showDow ? Utils_js_1.DaysOfWeekEng[this.getDayOfWeek()] + ' ' : '') +
284
- Utils_js_1.JewishMonthsEng[this.Month] +
281
+ jDate.prototype.toShortstring = function (showDow) {
282
+ return ((showDow ? DaysOfWeekEng[this.getDayOfWeek()] + ' ' : '') +
283
+ JewishMonthsEng[this.Month] +
285
284
  ' ' +
286
285
  this.Day.toString() +
287
286
  ', ' +
288
287
  this.Year.toString());
289
- }
288
+ };
290
289
  /**
291
290
  * Returns the current Jewish date in the format "Nissan 5778"
292
291
  * @param {boolean} showYear - show the year number?
293
292
  */
294
- monthName(showYear = true) {
295
- return (Utils_js_1.JewishMonthsEng[this.Month] +
293
+ jDate.prototype.monthName = function (showYear) {
294
+ if (showYear === void 0) { showYear = true; }
295
+ return (JewishMonthsEng[this.Month] +
296
296
  (showYear ? ' ' + this.Year.toString() : ''));
297
- }
297
+ };
298
298
  /**Returns the current Jewish date in the format: יום חמישי כ"א כסלו תשע"ו.*/
299
- toStringHeb() {
300
- return (Utils_js_1.DaysOfWeekHeb[this.getDayOfWeek()] +
299
+ jDate.prototype.toStringHeb = function () {
300
+ return (DaysOfWeekHeb[this.getDayOfWeek()] +
301
301
  ' ' +
302
- Utils_js_1.Utils.toJewishNumber(this.Day) +
302
+ Utils.toJewishNumber(this.Day) +
303
303
  ' ' +
304
- Utils_js_1.JewishMonthsHeb[this.Month] +
304
+ JewishMonthsHeb[this.Month] +
305
305
  ' ' +
306
- Utils_js_1.Utils.toJewishNumber(this.Year % 1000));
307
- }
306
+ Utils.toJewishNumber(this.Year % 1000));
307
+ };
308
308
  /**Gets the day of the omer for the current Jewish date. If the date is not during sefira, 0 is returned.*/
309
- getDayOfOmer() {
310
- let dayOfOmer = 0;
309
+ jDate.prototype.getDayOfOmer = function () {
310
+ var dayOfOmer = 0;
311
311
  if ((this.Month === 1 && this.Day > 15) ||
312
312
  this.Month === 2 ||
313
313
  (this.Month === 3 && this.Day < 6)) {
314
- const first = new jDate(this.Year, 1, 15);
314
+ var first = new jDate(this.Year, 1, 15);
315
315
  dayOfOmer = first.diffDays(this);
316
316
  }
317
317
  return dayOfOmer;
318
- }
318
+ };
319
319
  /**
320
320
  * Returns true if this day is yomtov or chol hamoed
321
321
  * @param {boolean} israel
322
322
  */
323
- isYomTovOrCholHamoed(israel) {
323
+ jDate.prototype.isYomTovOrCholHamoed = function (israel) {
324
324
  return (this.isYomTov(israel) ||
325
325
  (this.Month === 1 && [16, 17, 18, 19, 20].includes(this.Day)) ||
326
326
  (this.Month === 7 && [16, 17, 18, 19, 20, 21].includes(this.Day)));
327
- }
327
+ };
328
328
  /**
329
329
  * Returns true if this day is yomtov
330
330
  * @param {boolean} israel
331
331
  */
332
- isYomTov(israel) {
333
- const day = this.Day;
332
+ jDate.prototype.isYomTov = function (israel) {
333
+ var day = this.Day;
334
334
  switch (this.Month) {
335
335
  case 1:
336
336
  if (day === 15 || day === 21)
@@ -351,17 +351,17 @@ class jDate {
351
351
  break;
352
352
  }
353
353
  return false;
354
- }
354
+ };
355
355
  /**Is today Erev Yom Tov? (includes Erev second days of Sukkos and Pesach) */
356
- isErevYomTov() {
357
- return ((this.Month === 1 && Utils_js_1.Utils.has(this.Day, 14, 20)) ||
356
+ jDate.prototype.isErevYomTov = function () {
357
+ return ((this.Month === 1 && Utils.has(this.Day, 14, 20)) ||
358
358
  (this.Month === 3 && this.Day === 5) ||
359
359
  (this.Month === 6 && this.Day === 29) ||
360
- (this.Month === 7 && Utils_js_1.Utils.has(this.Day, 9, 14, 21)));
361
- }
360
+ (this.Month === 7 && Utils.has(this.Day, 9, 14, 21)));
361
+ };
362
362
  /**Does the current Jewish date have candle lighting before sunset?*/
363
- hasCandleLighting() {
364
- const dow = this.getDayOfWeek();
363
+ jDate.prototype.hasCandleLighting = function () {
364
+ var dow = this.getDayOfWeek();
365
365
  if (dow === 5) {
366
366
  return true;
367
367
  }
@@ -370,10 +370,10 @@ class jDate {
370
370
  return false;
371
371
  }
372
372
  return this.isErevYomTov();
373
- }
373
+ };
374
374
  /**Is the current Jewish Date the day before a yomtov that contains a Friday?*/
375
- hasEiruvTavshilin(israel) {
376
- let dow = this.getDayOfWeek();
375
+ jDate.prototype.hasEiruvTavshilin = function (israel) {
376
+ var dow = this.getDayOfWeek();
377
377
  return (
378
378
  //Eiruv Tavshilin is only on Wednesday or Thursday
379
379
  [3, 4].includes(dow) &&
@@ -383,14 +383,14 @@ class jDate {
383
383
  (dow === 4 || (dow === 3 && (!israel || this.Month === 6))) &&
384
384
  //No Eiruv Tavshilin on Erev yom kippur
385
385
  this.Day !== 9);
386
- }
386
+ };
387
387
  /**Gets the candle lighting time for the current Jewish date for the given Location object.*/
388
- getCandleLighting(location, nullIfNoCandles) {
388
+ jDate.prototype.getCandleLighting = function (location, nullIfNoCandles) {
389
389
  if (!location) {
390
390
  throw 'To get sunrise and sunset, the location needs to be supplied';
391
391
  }
392
392
  if (this.hasCandleLighting()) {
393
- return Zmanim_js_1.default.getCandleLighting(this, location);
393
+ return Zmanim.getCandleLighting(this, location);
394
394
  }
395
395
  else if (nullIfNoCandles) {
396
396
  return null;
@@ -398,48 +398,48 @@ class jDate {
398
398
  else {
399
399
  throw 'No candle lighting on ' + this.toString();
400
400
  }
401
- }
401
+ };
402
402
  /**Get the sedra of the week for the current Jewish date.*/
403
- getSedra(israel) {
404
- return new Sedra_js_1.default(this, israel);
405
- }
403
+ jDate.prototype.getSedra = function (israel) {
404
+ return new Sedra(this, israel);
405
+ };
406
406
  /**Get the prakim of Pirkei Avos for the current Jewish date.*/
407
- getPirkeiAvos(israel) {
408
- return PirkeiAvos_js_1.default.getPrakim(this, israel);
409
- }
407
+ jDate.prototype.getPirkeiAvos = function (israel) {
408
+ return PirkeiAvos.getPrakim(this, israel);
409
+ };
410
410
  /**Gets sunrise and sunset time for the current Jewish date at the given Location.
411
411
  *
412
412
  * Return format: {sunrise: {hour: 6, minute: 18}, sunset: {hour: 19, minute: 41}}*/
413
- getSunriseSunset(location, ignoreElevation) {
413
+ jDate.prototype.getSunriseSunset = function (location, ignoreElevation) {
414
414
  if (!location) {
415
415
  throw 'To get sunrise and sunset, the location needs to be supplied';
416
416
  }
417
- return Zmanim_js_1.default.getSunTimes(this, location, !ignoreElevation);
418
- }
417
+ return Zmanim.getSunTimes(this, location, !ignoreElevation);
418
+ };
419
419
  /**Gets Chatzos for both the day and the night for the current Jewish date at the given Location.
420
420
  *
421
421
  *Return format: {hour: 11, minute: 48}*/
422
- getChatzos(location) {
422
+ jDate.prototype.getChatzos = function (location) {
423
423
  if (!location) {
424
424
  throw 'To get Chatzos, the location needs to be supplied';
425
425
  }
426
- return Zmanim_js_1.default.getChatzos(this, location);
427
- }
426
+ return Zmanim.getChatzos(this, location);
427
+ };
428
428
  /**Gets the length of a single Sha'a Zmanis in minutes for the current Jewish date at the given Location.*/
429
- getShaaZmanis(location, offset) {
429
+ jDate.prototype.getShaaZmanis = function (location, offset) {
430
430
  if (!location) {
431
431
  throw 'To get the Shaa Zmanis, the location needs to be supplied';
432
432
  }
433
- return Zmanim_js_1.default.getShaaZmanis(this, location, offset);
434
- }
433
+ return Zmanim.getShaaZmanis(this, location, offset);
434
+ };
435
435
  /**Returns the daily daf in English. For example: Sukkah, Daf 3.*/
436
- getDafYomi() {
437
- return Dafyomi_1.default.toString(this) || '';
438
- }
436
+ jDate.prototype.getDafYomi = function () {
437
+ return DafYomi.toString(this) || '';
438
+ };
439
439
  /**Gets the daily daf in Hebrew. For example: 'סוכה דף כ.*/
440
- getDafyomiHeb() {
441
- return Dafyomi_1.default.toStringHeb(this) || '';
442
- }
440
+ jDate.prototype.getDafyomiHeb = function () {
441
+ return DafYomi.toStringHeb(this) || '';
442
+ };
443
443
  /**
444
444
  * Converts its argument/s to a Jewish Date.
445
445
  * Samples of use:
@@ -460,27 +460,27 @@ class jDate {
460
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
461
  * jDate.toJDate( { year: 5776, month: 4, day: 5, abs: 122548708 } ) - same as jDate.toJDate(jewishYear, jewishMonth, jewishDay, absoluteDate)
462
462
  ****************************************************************************************************************/
463
- static toJDate(arg, month, day, abs) {
463
+ jDate.toJDate = function (arg, month, day, abs) {
464
464
  if (arguments.length === 0) {
465
465
  return new jDate();
466
466
  }
467
467
  // If just the year is set, then the date is set to Rosh Hashana of that year.
468
468
  // In the above scenario, we can't just pass the args along, as the constructor will treat it as an absolute date.
469
469
  //...and that folks, is actually the whole point of this function...
470
- else if (Utils_js_1.Utils.isNumber(arg) && arguments.length === 1) {
470
+ else if (Utils.isNumber(arg) && arguments.length === 1) {
471
471
  return new jDate(arg, 7, 1);
472
472
  }
473
473
  else {
474
474
  return new jDate(arg, month, day, abs);
475
475
  }
476
- }
477
- static now() {
476
+ };
477
+ jDate.now = function () {
478
478
  return new jDate();
479
- }
479
+ };
480
480
  /**Calculate the Jewish year, month and day for the given absolute date.*/
481
- static fromAbs(absDay) {
481
+ jDate.fromAbs = function (absDay) {
482
482
  //To save on calculations, start with a few years before date
483
- let year = 3761 + Utils_js_1.Utils.toInt(absDay / (absDay > 0 ? 366 : 300)), month, day;
483
+ var year = 3761 + Utils.toInt(absDay / (absDay > 0 ? 366 : 300)), month, day;
484
484
  // Search forward for year from the approximation year.
485
485
  while (absDay >= jDate.absJd(year + 1, 7, 1)) {
486
486
  year++;
@@ -492,27 +492,27 @@ class jDate {
492
492
  }
493
493
  // Calculate the day by subtraction.
494
494
  day = absDay - jDate.absJd(year, month, 1) + 1;
495
- return { year, month, day };
496
- }
495
+ return { year: year, month: month, day: day };
496
+ };
497
497
  /**
498
498
  * Gets the absolute date of the given javascript Date object.
499
499
  * @param {Date} date
500
500
  */
501
- static absSd(date) {
501
+ jDate.absSd = function (date) {
502
502
  //Get the correct number of milliseconds since 1/1/1970 00:00:00 UTC until current system time
503
- const ms = date.valueOf() - date.getTimezoneOffset() * 60000,
503
+ var ms = date.valueOf() - date.getTimezoneOffset() * 60000,
504
504
  //The number of full days since 1/1/1970.
505
505
  numFullDays = Math.floor(ms / MS_PER_DAY);
506
506
  //Add that to the number of days from 1/1/0001 until 1/1/1970 00:00:00 UTC
507
507
  return JS_START_DATE_ABS + numFullDays;
508
- }
508
+ };
509
509
  /**Calculate the absolute date for the given Jewish Date.*/
510
- static absJd(year, month, day) {
510
+ jDate.absJd = function (year, month, day) {
511
511
  //The number of total days.
512
- let dayInYear = day; // day is the number of days so far this month.
512
+ var dayInYear = day; // day is the number of days so far this month.
513
513
  if (month < 7) {
514
514
  // Before Tishrei, so add days in prior months this year before and after Nissan.
515
- let m = 7;
515
+ var m = 7;
516
516
  while (m <= jDate.monthsJYear(year)) {
517
517
  dayInYear += jDate.daysJMonth(year, m);
518
518
  m++;
@@ -525,7 +525,7 @@ class jDate {
525
525
  }
526
526
  else {
527
527
  // Add days in prior months this year
528
- let m = 7;
528
+ var m = 7;
529
529
  while (m < month) {
530
530
  dayInYear += jDate.daysJMonth(year, m);
531
531
  m++;
@@ -533,16 +533,16 @@ class jDate {
533
533
  }
534
534
  // Days elapsed before absolute date 1. - Days in prior years.
535
535
  return dayInYear + (jDate.tDays(year) + -1373429);
536
- }
536
+ };
537
537
  /**
538
538
  * Gets a javascript date from an absolute date
539
539
  */
540
- static sdFromAbs(abs) {
540
+ jDate.sdFromAbs = function (abs) {
541
541
  //The "zero hour" for Javascript is 1/1/1970 0:00:00 UTC.
542
542
  //If the time zone offset was more than 0, the current time zone was earlier than UTC at the time.
543
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
544
  //So we will need to add another day to get the correct date.
545
- const offset = JS_START_OFFSET > 0 ? 1 : 0,
545
+ var offset = JS_START_OFFSET > 0 ? 1 : 0,
546
546
  //Get the number of days from the "zero hour" until the given date.
547
547
  //This is done by taking the given absolute date and removing the
548
548
  //number of days from absolute date 0 until the js "zero hour" - keeping into
@@ -550,9 +550,9 @@ class jDate {
550
550
  daysSinceStart = abs - JS_START_DATE_ABS + offset;
551
551
  //Create a javascript date from the number of milliseconds since the "zero hour"
552
552
  return new Date(daysSinceStart * MS_PER_DAY);
553
- }
553
+ };
554
554
  /**number of days in the given Jewish Month. Nissan is 1 and Adar Sheini is 13.*/
555
- static daysJMonth(year, month) {
555
+ jDate.daysJMonth = function (year, month) {
556
556
  switch (month) {
557
557
  //Nissan, Sivan, Av, Tishrei and Shvat always have 30 days
558
558
  case 1:
@@ -579,24 +579,24 @@ class jDate {
579
579
  return jDate.isJdLeapY(year) ? 30 : 29;
580
580
  }
581
581
  return 0;
582
- }
582
+ };
583
583
  /**Elapsed days since creation of the world until Rosh Hashana of the given year*/
584
- static tDays(year) {
584
+ jDate.tDays = function (year) {
585
585
  /*As this function is called many times, often on the same year for all types of calculations,
586
586
  we save a list of years with their elapsed values.*/
587
- const cached = _yearCache.find(y => !!y && y.year === year);
587
+ var cached = _yearCache.find(function (y) { return !!y && y.year === year; });
588
588
  //If this year was already calculated and cached, then we return the cached value.
589
589
  if (cached) {
590
590
  return cached.elapsed;
591
591
  }
592
- const months = Utils_js_1.Utils.toInt(235 * Utils_js_1.Utils.toInt((year - 1) / 19) + // Leap months this cycle
592
+ var months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle
593
593
  12 * ((year - 1) % 19) + // Regular months in this cycle.
594
594
  (7 * ((year - 1) % 19) + 1) / 19), // Months in complete cycles so far.
595
595
  parts = 204 + 793 * (months % 1080), hours = 5 +
596
596
  12 * months +
597
- 793 * Utils_js_1.Utils.toInt(months / 1080) +
598
- Utils_js_1.Utils.toInt(parts / 1080), conjDay = Utils_js_1.Utils.toInt(1 + 29 * months + hours / 24), conjParts = 1080 * (hours % 24) + (parts % 1080);
599
- let altDay;
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
600
  /* at the end of a leap year - 15 hours, 589 parts or later... -
601
601
  ... or is on a Monday at... - ...of a common year, -
602
602
  at 9 hours, 204 parts or later... - ...or is on a Tuesday... -
@@ -615,33 +615,34 @@ class jDate {
615
615
  altDay = conjDay;
616
616
  }
617
617
  // A day is added if Rosh HaShanah would occur on Sunday, Friday or Wednesday,
618
- if (Utils_js_1.Utils.has(altDay % 7, 0, 3, 5)) {
618
+ if (Utils.has(altDay % 7, 0, 3, 5)) {
619
619
  altDay += 1;
620
620
  }
621
621
  //Add this year to the cache to save on calculations later on
622
622
  _yearCache.push({ year: year, elapsed: altDay });
623
623
  return altDay;
624
- }
624
+ };
625
625
  /**number of days in the given Jewish Year.*/
626
- static daysJYear(year) {
626
+ jDate.daysJYear = function (year) {
627
627
  return jDate.tDays(year + 1) - jDate.tDays(year);
628
- }
628
+ };
629
629
  /**Does Cheshvan for the given Jewish Year have 30 days?*/
630
- static isLongCheshvan(year) {
630
+ jDate.isLongCheshvan = function (year) {
631
631
  return jDate.daysJYear(year) % 10 === 5;
632
- }
632
+ };
633
633
  /**Does Kislev for the given Jewish Year have 29 days?*/
634
- static isShortKislev(year) {
634
+ jDate.isShortKislev = function (year) {
635
635
  return jDate.daysJYear(year) % 10 === 3;
636
- }
636
+ };
637
637
  /**Does the given Jewish Year have 13 months?*/
638
- static isJdLeapY(year) {
638
+ jDate.isJdLeapY = function (year) {
639
639
  return (7 * year + 1) % 19 < 7;
640
- }
640
+ };
641
641
  /**number of months in Jewish Year.*/
642
- static monthsJYear(year) {
642
+ jDate.monthsJYear = function (year) {
643
643
  return jDate.isJdLeapY(year) ? 13 : 12;
644
- }
645
- }
646
- exports.default = jDate;
644
+ };
645
+ return jDate;
646
+ }());
647
+ export default jDate;
647
648
  //# sourceMappingURL=jDate.js.map