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
package/dist/Utils.js CHANGED
@@ -1,13 +1,43 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
4
27
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Utils = exports.DaysOfWeekHeb = exports.DaysOfWeekEng = exports.SecularMonthsEng = exports.JewishMonthsHeb = exports.JewishMonthsEng = exports.DaysOfWeek = void 0;
7
- const Zmanim_1 = __importDefault(require("./JCal/Zmanim"));
8
- const jDate_1 = __importDefault(require("./JCal/jDate"));
9
- const __DEV__ = process.env.NODE_ENV === 'development';
10
- exports.DaysOfWeek = Object.freeze({
28
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
37
+ import Zmanim from './JCal/Zmanim.js';
38
+ import jDate from './JCal/jDate.js';
39
+ var __DEV__ = process.env.NODE_ENV === 'development';
40
+ export var DaysOfWeek = Object.freeze({
11
41
  SUNDAY: 0,
12
42
  MONDAY: 1,
13
43
  TUESDAY: 2,
@@ -16,7 +46,7 @@ exports.DaysOfWeek = Object.freeze({
16
46
  FRIDAY: 5,
17
47
  SHABBOS: 6,
18
48
  });
19
- exports.JewishMonthsEng = [
49
+ export var JewishMonthsEng = [
20
50
  '',
21
51
  'Nissan',
22
52
  'Iyar',
@@ -32,7 +62,7 @@ exports.JewishMonthsEng = [
32
62
  'Adar',
33
63
  'Adar Sheini',
34
64
  ];
35
- exports.JewishMonthsHeb = [
65
+ export var JewishMonthsHeb = [
36
66
  '',
37
67
  'ניסן',
38
68
  'אייר',
@@ -48,7 +78,7 @@ exports.JewishMonthsHeb = [
48
78
  'אדר',
49
79
  'אדר שני',
50
80
  ];
51
- exports.SecularMonthsEng = [
81
+ export var SecularMonthsEng = [
52
82
  'January',
53
83
  'February',
54
84
  'March',
@@ -62,7 +92,7 @@ exports.SecularMonthsEng = [
62
92
  'November',
63
93
  'December',
64
94
  ];
65
- exports.DaysOfWeekEng = [
95
+ export var DaysOfWeekEng = [
66
96
  'Sunday',
67
97
  'Monday',
68
98
  'Tuesday',
@@ -71,7 +101,7 @@ exports.DaysOfWeekEng = [
71
101
  'Erev Shabbos',
72
102
  'Shabbos Kodesh',
73
103
  ];
74
- exports.DaysOfWeekHeb = [
104
+ export var DaysOfWeekHeb = [
75
105
  'יום ראשון',
76
106
  'יום שני',
77
107
  'יום שלישי',
@@ -80,20 +110,22 @@ exports.DaysOfWeekHeb = [
80
110
  'ערב שבת קודש',
81
111
  'שבת קודש',
82
112
  ];
83
- class Utils {
113
+ var Utils = /** @class */ (function () {
114
+ function Utils() {
115
+ }
84
116
  /**
85
117
  * Gets the Jewish representation of a number (365 = שס"ה)
86
118
  * Minimum number is 1 and maximum is 9999.
87
119
  * @param {Number} number
88
120
  */
89
- static toJewishNumber(number) {
121
+ Utils.toJewishNumber = function (number) {
90
122
  if (number < 1) {
91
123
  throw 'Min value is 1';
92
124
  }
93
125
  if (number > 9999) {
94
126
  throw 'Max value is 9999';
95
127
  }
96
- let n = number, retval = '';
128
+ var n = number, retval = '';
97
129
  if (n >= 1000) {
98
130
  retval += Utils.jsd[Utils.toInt((n - (n % 1000)) / 1000) - 1] + "'";
99
131
  n = n % 1000;
@@ -127,50 +159,50 @@ class Utils {
127
159
  retval = retval.slice(0, -1) + '"' + retval[retval.length - 1];
128
160
  }
129
161
  return retval;
130
- }
162
+ };
131
163
  /**
132
164
  * Returns the javascript date in the format: Thursday, the 3rd of January 2018.
133
165
  * @param {Date} date
134
166
  * @param {Boolean} hideDayOfWeek
135
167
  * @param {Boolean} dontCapitalize
136
168
  */
137
- static toStringDate(date, hideDayOfWeek, dontCapitalize) {
169
+ Utils.toStringDate = function (date, hideDayOfWeek, dontCapitalize) {
138
170
  if (!date)
139
171
  return;
140
172
  return ((hideDayOfWeek
141
173
  ? dontCapitalize
142
174
  ? 't'
143
175
  : 'T'
144
- : exports.DaysOfWeekEng[date.getDay()] + ', t') +
176
+ : DaysOfWeekEng[date.getDay()] + ', t') +
145
177
  'he ' +
146
178
  Utils.toSuffixed(date.getDate()) +
147
179
  ' of ' +
148
- exports.SecularMonthsEng[date.getMonth()] +
180
+ SecularMonthsEng[date.getMonth()] +
149
181
  ' ' +
150
182
  date.getFullYear().toString());
151
- }
183
+ };
152
184
  /**
153
185
  * Returns the javascript date in the format: 1/3/2020.
154
186
  * @param {Date} date
155
187
  * @param {Boolean} monthFirst
156
188
  */
157
- static toShortStringDate(date, monthFirst) {
189
+ Utils.toShortStringDate = function (date, monthFirst) {
158
190
  if (!date)
159
191
  return;
160
- const dayNum = date.getDate(), monthNum = date.getMonth() + 1;
192
+ var dayNum = date.getDate(), monthNum = date.getMonth() + 1;
161
193
  return ((monthFirst
162
- ? `${monthNum}/${dayNum}`
163
- : `${dayNum < 10 ? '0' : ''}${dayNum}/${monthNum < 10 ? '0' : ''}${monthNum}`) +
194
+ ? "".concat(monthNum, "/").concat(dayNum)
195
+ : "".concat(dayNum < 10 ? '0' : '').concat(dayNum, "/").concat(monthNum < 10 ? '0' : '').concat(monthNum)) +
164
196
  '/' +
165
197
  date.getFullYear().toString());
166
- }
198
+ };
167
199
  /**
168
200
  * Add two character suffix to number. e.g. 21st, 102nd, 93rd, 500th
169
201
  * @param {Number} num
170
202
  */
171
- static toSuffixed(num) {
172
- const t = num.toString();
173
- let suffix = 'th';
203
+ Utils.toSuffixed = function (num) {
204
+ var t = num.toString();
205
+ var suffix = 'th';
174
206
  if (t.length === 1 || t[t.length - 2] !== '1') {
175
207
  switch (t[t.length - 1]) {
176
208
  case '1':
@@ -185,14 +217,14 @@ class Utils {
185
217
  }
186
218
  }
187
219
  return t + suffix;
188
- }
220
+ };
189
221
  /**
190
222
  * Returns if the given full secular year has a February 29th
191
223
  * @param {Number} year
192
224
  */
193
- static isSecularLeapYear(year) {
225
+ Utils.isSecularLeapYear = function (year) {
194
226
  return !(year % 400) || (!!(year % 100) && !(year % 4));
195
- }
227
+ };
196
228
  /**
197
229
  * Get day of week using Javascripts getDay function.
198
230
  * Important note: months starts at 1 not 0 like javascript
@@ -201,18 +233,18 @@ class Utils {
201
233
  * @param {Number} month
202
234
  * @param {Number} day
203
235
  */
204
- static getSdDOW(year, month, day) {
236
+ Utils.getSdDOW = function (year, month, day) {
205
237
  return new Date(year, month - 1, day).getDay();
206
- }
238
+ };
207
239
  /**
208
240
  * Makes sure hour is between 0 and 23 and minute is between 0 and 59.
209
241
  * Overlaps get added/subtracted.
210
242
  * The argument needs to be an object in the format {hour : 12, minute : 42, second : 18}
211
243
  * @param {Time} time
212
244
  */
213
- static fixTime(time) {
245
+ Utils.fixTime = function (time) {
214
246
  //make a copy - javascript sends object parameters by reference
215
- const result = {
247
+ var result = {
216
248
  hour: time.hour,
217
249
  minute: time.minute,
218
250
  second: time.second || 0,
@@ -240,7 +272,7 @@ class Utils {
240
272
  result.hour = result.hour % 24;
241
273
  }
242
274
  return result;
243
- }
275
+ };
244
276
  /**
245
277
  * Add the given number of minutes to the given time.
246
278
  * The argument needs to be an object in the format {hour : 12, minute : 42, second : 18 }
@@ -248,7 +280,7 @@ class Utils {
248
280
  * @param {Time} time
249
281
  * @param {Number} minutes
250
282
  */
251
- static addMinutes(time, minutes) {
283
+ Utils.addMinutes = function (time, minutes) {
252
284
  if (!time)
253
285
  return time;
254
286
  return (time &&
@@ -257,7 +289,7 @@ class Utils {
257
289
  minute: time.minute + (minutes || 0),
258
290
  second: time.second,
259
291
  }));
260
- }
292
+ };
261
293
  /**
262
294
  * Add the given number of seconds to the given time.
263
295
  * The argument needs to be an object in the format {hour : 12, minute :42, second : 18}
@@ -265,13 +297,13 @@ class Utils {
265
297
  * @param {Time} time
266
298
  * @param {Number} seconds
267
299
  */
268
- static addSeconds(time, seconds) {
300
+ Utils.addSeconds = function (time, seconds) {
269
301
  return Utils.fixTime({
270
302
  hour: time.hour,
271
303
  minute: time.minute,
272
304
  second: (time.second || 0) + seconds,
273
305
  });
274
- }
306
+ };
275
307
  /**
276
308
  * Gets the time difference between two times of day.
277
309
  * If showNegative is falsey, assumes that the earlier time is always before the later time.
@@ -282,8 +314,9 @@ class Utils {
282
314
  * @param {Boolean} [showNegative] show negative values or assume second value is next day?
283
315
  * @returns{{hour:number, minute:number, second:number, sign:1|-1}}
284
316
  */
285
- static timeDiff(earlierTime, laterTime, showNegative = false) {
286
- const earlySec = Utils.totalSeconds(earlierTime), laterSec = Utils.totalSeconds(laterTime), time = Utils.fixTime({
317
+ Utils.timeDiff = function (earlierTime, laterTime, showNegative) {
318
+ if (showNegative === void 0) { showNegative = false; }
319
+ var earlySec = Utils.totalSeconds(earlierTime), laterSec = Utils.totalSeconds(laterTime), time = Utils.fixTime({
287
320
  hour: 0,
288
321
  minute: 0,
289
322
  second: earlySec <= laterSec
@@ -292,98 +325,98 @@ class Utils {
292
325
  ? earlySec - laterSec
293
326
  : 86400 - earlySec + laterSec,
294
327
  });
295
- return Object.assign(Object.assign({}, time), { sign: earlySec <= laterSec || !showNegative ? 1 : -1 });
296
- }
328
+ return __assign(__assign({}, time), { sign: earlySec <= laterSec || !showNegative ? 1 : -1 });
329
+ };
297
330
  /**
298
331
  * Gets the total number of minutes in the given time.
299
332
  * @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
300
333
  */
301
- static totalMinutes(time) {
334
+ Utils.totalMinutes = function (time) {
302
335
  return time ? time.hour * 60 + time.minute : 0;
303
- }
336
+ };
304
337
  /**
305
338
  * Gets the total number of seconds in the given time.
306
339
  * @param {Time} time An object in the format {hour : 12, minute :42, second : 18}
307
340
  */
308
- static totalSeconds(time) {
341
+ Utils.totalSeconds = function (time) {
309
342
  return time ? Utils.totalMinutes(time) * 60 + (time.second || 0) : 0;
310
- }
343
+ };
311
344
  /**
312
345
  * Returns the time of the given javascript date as an object in the format of {hour : 23, minute :42, second: 18 }
313
346
  * @param {Date} sdate
314
347
  * @returns {{hour :number, minute :number, second:number }}
315
348
  */
316
- static timeFromDate(sdate) {
349
+ Utils.timeFromDate = function (sdate) {
317
350
  return {
318
351
  hour: sdate.getHours(),
319
352
  minute: sdate.getMinutes(),
320
353
  second: sdate.getSeconds(),
321
354
  };
322
- }
355
+ };
323
356
  /**
324
357
  * Determines if the second given time is after (or at) the first given time
325
358
  * @param {{hour :number, minute :number, second:number }} beforeTime
326
359
  * @param {{hour :number, minute :number, second:number }} afterTime
327
360
  */
328
- static isTimeAfter(beforeTime, afterTime) {
361
+ Utils.isTimeAfter = function (beforeTime, afterTime) {
329
362
  if (!beforeTime || !afterTime)
330
363
  return false;
331
364
  return Utils.totalSeconds(afterTime) >= Utils.totalSeconds(beforeTime);
332
- }
365
+ };
333
366
  /**
334
367
  * Returns the given time interval in a formatted string.
335
368
  * @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
336
369
  */
337
- static getTimeIntervalTextStringHeb(time) {
338
- let t = '';
370
+ Utils.getTimeIntervalTextStringHeb = function (time) {
371
+ var t = '';
339
372
  if (time.hour > 0) {
340
- t += `${time.hour.toString()} ${time.hour === 1 ? 'שעה' : 'שעות'}`;
373
+ t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? 'שעה' : 'שעות');
341
374
  }
342
375
  if (time.minute > 0) {
343
376
  if (t.length) {
344
377
  t += ' ';
345
378
  }
346
- t += `${time.minute.toString()} ${time.minute === 1 ? 'דקה' : 'דקות'}`;
379
+ t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? 'דקה' : 'דקות');
347
380
  }
348
381
  if ((time.second || 0) > 0) {
349
382
  if (t.length) {
350
383
  t += ' ';
351
384
  }
352
- t += `${Math.trunc(time.second || 0).toString()} ${time.second === 1 ? 'שנייה' : 'שניות'}`;
385
+ t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? 'שנייה' : 'שניות');
353
386
  }
354
387
  return t;
355
- }
388
+ };
356
389
  /**
357
390
  * Returns the given time interval in a formatted string.
358
391
  * @param {{hour:number, minute:number,second:number,sign?: 1 | -1}} time An object in the format {hour : 23, minute :42, second: 18 }
359
392
  */
360
- static getTimeIntervalTextString(time) {
361
- let t = '';
393
+ Utils.getTimeIntervalTextString = function (time) {
394
+ var t = '';
362
395
  if (time.hour > 0) {
363
- t += `${time.hour.toString()} ${time.hour === 1 ? 'hour' : 'hours'}`;
396
+ t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? 'hour' : 'hours');
364
397
  }
365
398
  if (time.minute > 0) {
366
399
  if (t.length) {
367
400
  t += ' ';
368
401
  }
369
- t += `${time.minute.toString()} ${time.minute === 1 ? 'minute' : 'minutes'}`;
402
+ t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? 'minute' : 'minutes');
370
403
  }
371
404
  if ((time.second || 0) > 0) {
372
405
  if (t.length) {
373
406
  t += ' ';
374
407
  }
375
- t += `${Math.trunc(time.second || 0).toString()} ${time.second === 1 ? 'second' : 'seconds'}`;
408
+ t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? 'second' : 'seconds');
376
409
  }
377
410
  return t;
378
- }
411
+ };
379
412
  /**
380
413
  * Returns the nusach for Sefiras Ha'omer for the given day and minhag
381
414
  * @param {number} dayOfOmer The day of the Omer for which to get the nusach for
382
415
  * @param {'ashkenaz'|'sefard'|'sefardi'} nusach Should it be La'Omer ("sefard") or Ba'Omer ("ashkenaz") or "sefardi" (Eidot Hamizrach)?
383
416
  */
384
- static getOmerNusach(dayOfOmer, nusach) {
385
- const weeks = Utils.toInt(dayOfOmer / 7), days = dayOfOmer % 7;
386
- let txt = 'היום ';
417
+ Utils.getOmerNusach = function (dayOfOmer, nusach) {
418
+ var weeks = Utils.toInt(dayOfOmer / 7), days = dayOfOmer % 7;
419
+ var txt = 'היום ';
387
420
  if (dayOfOmer === 1) {
388
421
  txt += 'יום אחד ';
389
422
  }
@@ -438,7 +471,7 @@ class Utils {
438
471
  txt += 'בעומר';
439
472
  }
440
473
  return txt;
441
- }
474
+ };
442
475
  /**
443
476
  * Returns the given time in a formatted string.
444
477
  * @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
@@ -446,8 +479,8 @@ class Utils {
446
479
  * @param {Boolean} [army] If falsey, the returned string will be: 11:42:18 PM otherwise it will be 23:42:18
447
480
  * @param {Boolean} [roundUp] If falsey, the numbers will converted to a whole number by rounding down, otherwise, up.
448
481
  */
449
- static getTimeString(time, sign, army, roundUp) {
450
- const round = roundUp ? Math.ceil : Math.floor;
482
+ Utils.getTimeString = function (time, sign, army, roundUp) {
483
+ var round = roundUp ? Math.ceil : Math.floor;
451
484
  time = {
452
485
  hour: round(time.hour),
453
486
  minute: round(time.minute),
@@ -482,26 +515,26 @@ class Utils {
482
515
  : (time.second || 0).toString()) +
483
516
  (time.hour < 12 ? ' AM' : ' PM'));
484
517
  }
485
- }
518
+ };
486
519
  /**
487
520
  * Gets the UTC offset in whole hours for the users time zone.
488
521
  * Note: this is not affected by DST - unlike javascripts getTimezoneOffset() function which gives you the current offset.
489
522
  */
490
- static currUtcOffset() {
491
- const date = new Date(), jan = new Date(date.getFullYear(), 0, 1), jul = new Date(date.getFullYear(), 6, 1);
523
+ Utils.currUtcOffset = function () {
524
+ var date = new Date(), jan = new Date(date.getFullYear(), 0, 1), jul = new Date(date.getFullYear(), 6, 1);
492
525
  return -Utils.toInt(Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()) / 60);
493
- }
526
+ };
494
527
  /** Determines if the given date is within DST on the users system */
495
- static isDateDST(date) {
528
+ Utils.isDateDST = function (date) {
496
529
  return (-Utils.toInt(date.getTimezoneOffset() / 60) !==
497
530
  Utils.currUtcOffset());
498
- }
531
+ };
499
532
  /**
500
533
  * Determines if the given date is within DST in the given location
501
534
  * Note: This may not be correct if the user has set the Location to a
502
535
  * time zone outside Israel or the USA which is not the current system time zone.
503
536
  */
504
- static isDST(location, date) {
537
+ Utils.isDST = function (location, date) {
505
538
  //If the current system time zone is the same as the given locations time zone
506
539
  if (location.UTCOffset === Utils.currUtcOffset()) {
507
540
  //We can use the system data to determine if the given date is within DST
@@ -513,13 +546,13 @@ class Utils {
513
546
  else {
514
547
  return Utils.isUSA_DST(date);
515
548
  }
516
- }
549
+ };
517
550
  /**
518
551
  * Determines if the given javascript date is during DST according to the USA rules
519
552
  * @param {Date} date A javascript Date object
520
553
  */
521
- static isUSA_DST(date) {
522
- const year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours();
554
+ Utils.isUSA_DST = function (date) {
555
+ var year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours();
523
556
  if (month < 3 || month == 12) {
524
557
  return false;
525
558
  }
@@ -530,7 +563,7 @@ class Utils {
530
563
  else if (month === 3) {
531
564
  //March
532
565
  //Gets day of week on March 1st
533
- const firstDOW = Utils.getSdDOW(year, 3, 1),
566
+ var firstDOW = Utils.getSdDOW(year, 3, 1),
534
567
  //Gets date of second Sunday
535
568
  targetDate = firstDOW == 0 ? 8 : 7 - ((firstDOW + 7) % 7) + 8;
536
569
  return day > targetDate || (day === targetDate && hour >= 2);
@@ -538,19 +571,19 @@ class Utils {
538
571
  //DST ends at 2 AM on the first Sunday in November //dt.Month == 11 / November
539
572
  else {
540
573
  //Gets day of week on November 1st
541
- const firstDOW = Utils.getSdDOW(year, 11, 1),
574
+ var firstDOW = Utils.getSdDOW(year, 11, 1),
542
575
  //Gets date of first Sunday
543
576
  targetDate = firstDOW === 0 ? 1 : 7 - ((firstDOW + 7) % 7) + 1;
544
577
  return day < targetDate || (day === targetDate && hour < 2);
545
578
  }
546
- }
579
+ };
547
580
  //
548
581
  /**
549
582
  * Determines if the given Javascript date is during DST according to the current (5776) Israeli rules
550
583
  * @param {Date} date A Javascript Date object
551
584
  */
552
- static isIsrael_DST(date) {
553
- const year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours();
585
+ Utils.isIsrael_DST = function (date) {
586
+ var year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours();
554
587
  if (month > 10 || month < 3) {
555
588
  return false;
556
589
  }
@@ -561,91 +594,91 @@ class Utils {
561
594
  else if (month === 3) {
562
595
  //March
563
596
  //Gets date of the Friday before the last Sunday
564
- const lastFriday = 31 - Utils.getSdDOW(year, 3, 31) - 2;
597
+ var lastFriday = 31 - Utils.getSdDOW(year, 3, 31) - 2;
565
598
  return day > lastFriday || (day === lastFriday && hour >= 2);
566
599
  }
567
600
  //DST ends at 2 AM on the last Sunday in October //dt.Month === 10 / October
568
601
  else {
569
602
  //Gets date of last Sunday in October
570
- const lastSunday = 31 - Utils.getSdDOW(year, 10, 31);
603
+ var lastSunday = 31 - Utils.getSdDOW(year, 10, 31);
571
604
  return day < lastSunday || (day === lastSunday && hour < 2);
572
605
  }
573
- }
606
+ };
574
607
  /** The current time in Israel - determined by the current users system time and time zone offset*/
575
- static getSdNowInIsrael() {
576
- const now = new Date(),
608
+ Utils.getSdNowInIsrael = function () {
609
+ var now = new Date(),
577
610
  //first determine the hour differential between this user and Israel time
578
611
  israelTimeOffset = 2 + -Utils.currUtcOffset();
579
612
  //This will give us the current correct date and time in Israel
580
613
  now.setHours(now.getHours() + israelTimeOffset);
581
614
  return now;
582
- }
615
+ };
583
616
  /**
584
617
  * Adds the given number of days to the given javascript date and returns the new date
585
618
  * @param {Date} sdate
586
619
  * @param {Number} days
587
620
  */
588
- static addDaysToSdate(sdate, days) {
621
+ Utils.addDaysToSdate = function (sdate, days) {
589
622
  return new Date(sdate.valueOf() + 8.64e7 * days);
590
- }
623
+ };
591
624
  /**
592
625
  * Compares two js dates to se if they both refer to the same day - time is ignored.
593
626
  * @param {Date} sdate1
594
627
  * @param {Date} sdate2
595
628
  */
596
- static isSameSdate(sdate1, sdate2) {
629
+ Utils.isSameSdate = function (sdate1, sdate2) {
597
630
  return (sdate1 && sdate2 && sdate1.toDateString() === sdate2.toDateString());
598
- }
631
+ };
599
632
  /**
600
633
  * Compares two jDates to se if they both refer to the same day - time is ignored.
601
634
  * @param {jDate} jdate1
602
635
  * @param {jDate} jdate2
603
636
  */
604
- static isSameJdate(jdate1, jdate2) {
637
+ Utils.isSameJdate = function (jdate1, jdate2) {
605
638
  return (jdate1 &&
606
639
  jdate2 &&
607
640
  jdate1.Abs &&
608
641
  jdate2.Abs &&
609
642
  jdate1.Abs === jdate2.Abs);
610
- }
643
+ };
611
644
  /**
612
645
  * Compares two jDates to see if they both refer to the same Jewish Month.
613
646
  * @param {jDate} jdate1
614
647
  * @param {jDate} jdate2
615
648
  */
616
- static isSameJMonth(jdate1, jdate2) {
649
+ Utils.isSameJMonth = function (jdate1, jdate2) {
617
650
  return jdate1.Month === jdate2.Month && jdate1.Year === jdate2.Year;
618
- }
651
+ };
619
652
  /**
620
653
  * Compares two dates to se if they both refer to the same Secular Month.
621
654
  * @param {Date} sdate1
622
655
  * @param {Date} sdate2
623
656
  */
624
- static isSameSMonth(sdate1, sdate2) {
657
+ Utils.isSameSMonth = function (sdate1, sdate2) {
625
658
  return (sdate1.getMonth() === sdate2.getMonth() &&
626
659
  sdate1.getFullYear() === sdate2.getFullYear());
627
- }
660
+ };
628
661
  /**
629
662
  * Determines if the time of the given Date() is after sunset at the given Location
630
663
  * @param {Date} sdate
631
664
  * @param {Location} location
632
665
  */
633
- static isAfterSunset(sdate, location) {
634
- const shkia = Zmanim_1.default.getSunTimes(sdate, location).sunset, now = Utils.timeFromDate(sdate);
666
+ Utils.isAfterSunset = function (sdate, location) {
667
+ var shkia = Zmanim.getSunTimes(sdate, location).sunset, now = Utils.timeFromDate(sdate);
635
668
  return shkia && Utils.isTimeAfter(shkia, now);
636
- }
669
+ };
637
670
  /**
638
671
  * Gets the current Jewish Date at the given Location
639
672
  * @param {Location} location
640
673
  */
641
- static nowAtLocation(location) {
642
- let sdate = new Date();
674
+ Utils.nowAtLocation = function (location) {
675
+ var sdate = new Date();
643
676
  //if isAfterSunset a day is added.
644
677
  if (Utils.isAfterSunset(sdate, location)) {
645
678
  sdate.setDate(sdate.getDate() + 1);
646
679
  }
647
- return new jDate_1.default(sdate);
648
- }
680
+ return new jDate(sdate);
681
+ };
649
682
  /**
650
683
  * Converts the given complex number to an integer by removing the decimal part.
651
684
  * Returns same results as Math.floor for positive numbers and Math.ceil for negative ones.
@@ -654,46 +687,50 @@ class Utils {
654
687
  * In performance tests, this function was found to be quicker than the alternatives.
655
688
  * @param {Number} float The complex number to convert to an integer
656
689
  */
657
- static toInt(float) {
690
+ Utils.toInt = function (float) {
658
691
  return float | 0;
659
- }
692
+ };
660
693
  /***
661
694
  * Takes either a jDate or a Date and returns both
662
695
  * @param date {Date |jDate}
663
696
  * @returns {{ sdate:Date, jdate:jDate }}
664
697
  */
665
- static bothDates(date) {
666
- const jdate = date instanceof Date
667
- ? new jDate_1.default(date)
698
+ Utils.bothDates = function (date) {
699
+ var jdate = date instanceof Date
700
+ ? new jDate(date)
668
701
  : date;
669
- const sdate = date instanceof Date
702
+ var sdate = date instanceof Date
670
703
  ? date
671
704
  : jdate.getDate();
672
- return { sdate, jdate };
673
- }
705
+ return { sdate: sdate, jdate: jdate };
706
+ };
674
707
  /** Returns true if "thing" is either a string primitive or String object.*/
675
- static isString(thing) {
708
+ Utils.isString = function (thing) {
676
709
  return typeof thing === 'string' || thing instanceof String;
677
- }
710
+ };
678
711
  /** Returns true if "thing" is either a number primitive or a Number object.*/
679
- static isNumber(thing) {
712
+ Utils.isNumber = function (thing) {
680
713
  return typeof thing === 'number' || thing instanceof Number;
681
- }
714
+ };
682
715
  /** Returns true if "thing" is a Date object containing a valid date.*/
683
- static isValidDate(thing) {
716
+ Utils.isValidDate = function (thing) {
684
717
  return thing instanceof Date && !isNaN(thing.valueOf());
685
- }
718
+ };
686
719
  /** Returns whether or not the given, array, string, or argument list contains the given item or substring.
687
720
  *
688
721
  * This function is awfully similar to Array.includes, but has the added plus of accepting any number or type of arguments.*/
689
- static has(o, ...arr) {
722
+ Utils.has = function (o) {
723
+ var arr = [];
724
+ for (var _i = 1; _i < arguments.length; _i++) {
725
+ arr[_i - 1] = arguments[_i];
726
+ }
690
727
  if (arr.length === 1 && (Array.isArray(arr[0]) || Utils.isString(arr[0]))) {
691
728
  return arr[0].includes(o);
692
729
  }
693
730
  else {
694
731
  return arr.includes(o);
695
732
  }
696
- }
733
+ };
697
734
  /** Returns the first value unless it is undefined, null or NaN.
698
735
  *
699
736
  * This is very useful for boolean, string and integer parameters
@@ -702,7 +739,7 @@ class Utils {
702
739
  * Similar purpose to default parameters with the difference being that this function will return
703
740
  * the second value if the first is NaN or null, while default params will give give you the NaN or the null.
704
741
  */
705
- static setDefault(paramValue, defValue) {
742
+ Utils.setDefault = function (paramValue, defValue) {
706
743
  if (typeof paramValue === 'undefined' ||
707
744
  paramValue === null ||
708
745
  isNaN(paramValue)) {
@@ -711,7 +748,7 @@ class Utils {
711
748
  else {
712
749
  return paramValue;
713
750
  }
714
- }
751
+ };
715
752
  /**
716
753
  * Returns an array containing a range of integers.
717
754
  * @param {Number} [start] The number to start at. The start number is included in the results.
@@ -720,53 +757,66 @@ class Utils {
720
757
  * Unlike Pythons range function, The end number is included in the results.
721
758
  * @returns {[Number]}
722
759
  */
723
- static range(start, end) {
724
- const startNumber = typeof (end) === 'undefined' ? 1 : start, endNumber = typeof (end) === 'undefined' ? start : end;
725
- return Array.from({ length: endNumber - startNumber + 1 }, (v, i) => startNumber + i);
726
- }
760
+ Utils.range = function (start, end) {
761
+ var startNumber = typeof (end) === 'undefined' ? 1 : start, endNumber = typeof (end) === 'undefined' ? start : end;
762
+ return Array.from({ length: endNumber - startNumber + 1 }, function (v, i) { return startNumber + i; });
763
+ };
727
764
  /**
728
765
  * Log message to console
729
766
  * @param {string} txt
730
767
  */
731
- static log(txt, ...optionalItems) {
768
+ Utils.log = function (txt) {
769
+ var optionalItems = [];
770
+ for (var _i = 1; _i < arguments.length; _i++) {
771
+ optionalItems[_i - 1] = arguments[_i];
772
+ }
732
773
  if (__DEV__) {
733
- console.log(txt, ...optionalItems);
774
+ console.log.apply(console, __spreadArray([txt], __read(optionalItems), false));
734
775
  }
735
- }
776
+ };
736
777
  /**
737
778
  * Warn message to console
738
779
  * @param {string} txt
739
780
  */
740
- static warn(txt, ...optionalItems) {
781
+ Utils.warn = function (txt) {
782
+ var optionalItems = [];
783
+ for (var _i = 1; _i < arguments.length; _i++) {
784
+ optionalItems[_i - 1] = arguments[_i];
785
+ }
741
786
  if (__DEV__) {
742
- console.warn(txt, ...optionalItems);
787
+ console.warn.apply(console, __spreadArray([txt], __read(optionalItems), false));
743
788
  }
744
- }
789
+ };
745
790
  /**
746
791
  * Error message to console
747
792
  * @param {*} txt
748
793
  */
749
- static error(txt, ...optionalItems) {
750
- if (__DEV__) {
751
- console.error(txt, ...optionalItems);
794
+ Utils.error = function (txt) {
795
+ var optionalItems = [];
796
+ for (var _i = 1; _i < arguments.length; _i++) {
797
+ optionalItems[_i - 1] = arguments[_i];
752
798
  }
753
- }
754
- }
755
- exports.Utils = Utils;
756
- Utils.jsd = ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט'];
757
- Utils.jtd = ['י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ'];
758
- Utils.jhd = ['ק', 'ר', 'ש', 'ת'];
759
- Utils.jsnum = [
760
- '',
761
- 'אחד',
762
- 'שנים',
763
- 'שלשה',
764
- 'ארבעה',
765
- 'חמשה',
766
- 'ששה',
767
- 'שבעה',
768
- 'שמונה',
769
- 'תשעה',
770
- ];
771
- Utils.jtnum = ['', 'עשר', 'עשרים', 'שלושים', 'ארבעים'];
799
+ if (__DEV__) {
800
+ console.error.apply(console, __spreadArray([txt], __read(optionalItems), false));
801
+ }
802
+ };
803
+ Utils.jsd = ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט'];
804
+ Utils.jtd = ['י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ'];
805
+ Utils.jhd = ['ק', 'ר', 'ש', 'ת'];
806
+ Utils.jsnum = [
807
+ '',
808
+ 'אחד',
809
+ 'שנים',
810
+ 'שלשה',
811
+ 'ארבעה',
812
+ 'חמשה',
813
+ 'ששה',
814
+ 'שבעה',
815
+ 'שמונה',
816
+ 'תשעה',
817
+ ];
818
+ Utils.jtnum = ['', 'עשר', 'עשרים', 'שלושים', 'ארבעים'];
819
+ return Utils;
820
+ }());
821
+ export { Utils };
772
822
  //# sourceMappingURL=Utils.js.map