jcal-zmanim 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1911,7 +1911,6 @@ _Dafyomi.masechtaList = [
1911
1911
  ];
1912
1912
  var Dafyomi = _Dafyomi;
1913
1913
  // src/JCal/jDate.ts
1914
- var _yearCache = [];
1915
1914
  var JS_START_DATE_ABS = 719163;
1916
1915
  var MS_PER_DAY = 864e5;
1917
1916
  var JS_START_OFFSET = /* @__PURE__ */ new Date(0).getTimezoneOffset();
@@ -3017,15 +3016,7 @@ var yearTypeList = [
3017
3016
  0,
3018
3017
  7
3019
3018
  ];
3020
- var daysUntil5000 = 1825849;
3021
- var getElapsedDaysEarly = function(year) {
3022
- var _yearCache_find;
3023
- var elapsed = (_yearCache_find = _yearCache.find(function(y) {
3024
- return (y === null || y === void 0 ? void 0 : y.year) === year;
3025
- })) === null || _yearCache_find === void 0 ? void 0 : _yearCache_find.elapsed;
3026
- if (elapsed) {
3027
- return elapsed;
3028
- }
3019
+ var getElapsedDays = function(year) {
3029
3020
  var daysCounter = 0;
3030
3021
  var months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle
3031
3022
  12 * ((year - 1) % 19) + // Regular months in this cycle.
@@ -3038,20 +3029,9 @@ var getElapsedDaysEarly = function(year) {
3038
3029
  if (Utils.has(daysCounter % 7, 0, 3, 5)) {
3039
3030
  daysCounter += 1;
3040
3031
  }
3041
- _yearCache.push({
3042
- year: year,
3043
- elapsed: daysCounter
3044
- });
3045
3032
  return daysCounter;
3046
3033
  };
3047
- var getElapsedDays5000 = function(year) {
3048
- var counter = daysUntil5000;
3049
- for(var y = 5e3; y < year; y++){
3050
- counter += jDate.yearType(y).daysInYear;
3051
- }
3052
- return counter;
3053
- };
3054
- var jDate = /*#__PURE__*/ function() {
3034
+ var _jDate = /*#__PURE__*/ function() {
3055
3035
  function _jDate(arg, month, day, abs) {
3056
3036
  _class_call_check(this, _jDate);
3057
3037
  this.Day = NaN;
@@ -3598,7 +3578,7 @@ var jDate = /*#__PURE__*/ function() {
3598
3578
  m1++;
3599
3579
  }
3600
3580
  }
3601
- return dayInYear + (_jDate.tDays(year) + -1373429);
3581
+ return dayInYear + (getElapsedDays(year) + -1373429);
3602
3582
  }
3603
3583
  },
3604
3584
  {
@@ -3641,16 +3621,6 @@ var jDate = /*#__PURE__*/ function() {
3641
3621
  return 0;
3642
3622
  }
3643
3623
  },
3644
- {
3645
- key: "tDays",
3646
- value: /**Elapsed days since creation of the world until Rosh Hashana of the given year*/ function tDays(year) {
3647
- if (year >= 5e3) {
3648
- return getElapsedDays5000(year);
3649
- } else {
3650
- return getElapsedDaysEarly(year);
3651
- }
3652
- }
3653
- },
3654
3624
  {
3655
3625
  key: "yearType",
3656
3626
  value: /**The index for the year type of the given year.
@@ -3665,7 +3635,7 @@ var jDate = /*#__PURE__*/ function() {
3665
3635
  if (year >= 5e3) {
3666
3636
  return _jDate.yearType(year).daysInYear;
3667
3637
  } else {
3668
- return _jDate.tDays(year + 1) - _jDate.tDays(year);
3638
+ return getElapsedDays(year + 1) - getElapsedDays(year);
3669
3639
  }
3670
3640
  }
3671
3641
  },
@@ -3689,24 +3659,6 @@ var jDate = /*#__PURE__*/ function() {
3689
3659
  }
3690
3660
  }
3691
3661
  },
3692
- {
3693
- key: "daysJYear_",
3694
- value: /**number of days in the given Jewish Year.*/ function daysJYear_(year) {
3695
- return _jDate.yearType(year).daysInYear;
3696
- }
3697
- },
3698
- {
3699
- key: "isLongCheshvan_",
3700
- value: /**Does Cheshvan for the given Jewish Year have 30 days?*/ function isLongCheshvan_(year) {
3701
- return _jDate.yearType(year).isLongCheshvan;
3702
- }
3703
- },
3704
- {
3705
- key: "isShortKislev_",
3706
- value: /**Does Kislev for the given Jewish Year have 29 days?*/ function isShortKislev_(year) {
3707
- return !_jDate.yearType(year).isLongKislev;
3708
- }
3709
- },
3710
3662
  {
3711
3663
  key: "isJdLeapY",
3712
3664
  value: /**Does the given Jewish Year have 13 months?*/ function isJdLeapY(year) {
@@ -3722,6 +3674,8 @@ var jDate = /*#__PURE__*/ function() {
3722
3674
  ]);
3723
3675
  return _jDate;
3724
3676
  }();
3677
+ _jDate.getElapsedDays = getElapsedDays;
3678
+ var jDate = _jDate;
3725
3679
  // src/JCal/Zmanim.ts
3726
3680
  var Zmanim = /*#__PURE__*/ function() {
3727
3681
  function _Zmanim() {
@@ -4351,19 +4305,19 @@ var _Utils = /*#__PURE__*/ function() {
4351
4305
  */ function getTimeIntervalTextStringHeb(time) {
4352
4306
  var t = "";
4353
4307
  if (time.hour > 0) {
4354
- t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "\u05E9\u05E2\u05D4" : "\u05E9\u05E2\u05D5\u05EA");
4308
+ t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "\u05E9\u05E2\u05D4" : "\u05E9\u05E2\u05D5\u05EA", "\xad");
4355
4309
  }
4356
4310
  if (time.minute > 0) {
4357
4311
  if (t.length) {
4358
4312
  t += " ";
4359
4313
  }
4360
- t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "\u05D3\u05E7\u05D4" : "\u05D3\u05E7\u05D5\u05EA");
4314
+ t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "\u05D3\u05E7\u05D4" : "\u05D3\u05E7\u05D5\u05EA", "\xad");
4361
4315
  }
4362
4316
  if ((time.second || 0) > 0) {
4363
4317
  if (t.length) {
4364
4318
  t += " ";
4365
4319
  }
4366
- t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "\u05E9\u05E0\u05D9\u05D9\u05D4" : "\u05E9\u05E0\u05D9\u05D5\u05EA");
4320
+ t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "\u05E9\u05E0\u05D9\u05D9\u05D4" : "\u05E9\u05E0\u05D9\u05D5\u05EA", "\xad");
4367
4321
  }
4368
4322
  return t;
4369
4323
  }
@@ -4376,19 +4330,19 @@ var _Utils = /*#__PURE__*/ function() {
4376
4330
  */ function getTimeIntervalTextString(time) {
4377
4331
  var t = "";
4378
4332
  if (time.hour > 0) {
4379
- t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "hour" : "hours");
4333
+ t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "hour" : "hours", "\xad");
4380
4334
  }
4381
4335
  if (time.minute > 0) {
4382
4336
  if (t.length) {
4383
4337
  t += " ";
4384
4338
  }
4385
- t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "minute" : "minutes");
4339
+ t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "minute" : "minutes", "\xad");
4386
4340
  }
4387
4341
  if ((time.second || 0) > 0) {
4388
4342
  if (t.length) {
4389
4343
  t += " ";
4390
4344
  }
4391
- t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "second" : "seconds");
4345
+ t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "second" : "seconds", "\xad");
4392
4346
  }
4393
4347
  return t;
4394
4348
  }
@@ -4455,7 +4409,7 @@ var _Utils = /*#__PURE__*/ function() {
4455
4409
  value: /**
4456
4410
  * Returns the given time in a formatted string.
4457
4411
  * @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
4458
- * @param {1 | -1} [sign]
4412
+ * @param {1 | -1} [sign]
4459
4413
  * @param {Boolean} [army] If falsey, the returned string will be: 11:42:18 PM otherwise it will be 23:42:18
4460
4414
  * @param {Boolean} [roundUp] If falsey, the numbers will converted to a whole number by rounding down, otherwise, up.
4461
4415
  */ function getTimeString(time, sign, army, roundUp) {
@@ -4643,10 +4597,10 @@ var _Utils = /*#__PURE__*/ function() {
4643
4597
  {
4644
4598
  key: "bothDates",
4645
4599
  value: /***
4646
- * Takes either a jDate or a Date and returns both
4647
- * @param date {Date |jDate}
4648
- * @returns {{ sdate:Date, jdate:jDate }}
4649
- */ function bothDates(date) {
4600
+ * Takes either a jDate or a Date and returns both
4601
+ * @param date {Date |jDate}
4602
+ * @returns {{ sdate:Date, jdate:jDate }}
4603
+ */ function bothDates(date) {
4650
4604
  var jdate = _instanceof(date, Date) ? new jDate(date) : date;
4651
4605
  var sdate = _instanceof(date, Date) ? date : jdate.getDate();
4652
4606
  return {
@@ -13615,7 +13569,7 @@ function getNotifications(date, time, location, english, showGaonShir, showDafYo
13615
13569
  var _Utils_bothDates = Utils.bothDates(date), sdate = _Utils_bothDates.sdate, jdate = _Utils_bothDates.jdate;
13616
13570
  dayNotes.length = 0;
13617
13571
  tefillahNotes.length = 0;
13618
- var month = jdate.Month, day = jdate.Day, dow = jdate.DayOfWeek, _ZmanimUtils_getBasicShulZmanim = ZmanimUtils.getBasicShulZmanim(date, location), chatzosHayom = _ZmanimUtils_getBasicShulZmanim.chatzosHayom, chatzosHalayla = _ZmanimUtils_getBasicShulZmanim.chatzosHalayla, alos = _ZmanimUtils_getBasicShulZmanim.alos, shkia = _ZmanimUtils_getBasicShulZmanim.shkia, isAfterChatzosHayom = Utils.isTimeAfter(chatzosHayom, time), isAfterChatzosHalayla = typeof chatzosHalayla !== "undefined" && (Utils.isTimeAfter(chatzosHalayla, time) || chatzosHalayla.hour > 12 && time.hour < 12), isAfterAlos = Utils.isTimeAfter(alos, time), isAfterShkia = Utils.isTimeAfter(shkia, time), isDaytime = isAfterAlos && !isAfterShkia, isNightTime = !isDaytime, isNotBeinHasmashos = !isAfterShkia || Utils.isTimeAfter(Utils.addMinutes(shkia, 18), time), isMorning = isDaytime && !isAfterChatzosHayom, isAfternoon = isDaytime && isAfterChatzosHayom, isYomTov = jdate.isYomTovOrCholHamoed(location.Israel), isLeapYear = jDate.isJdLeapY(jdate.Year), noTachnun = isAfternoon && (dow === DaysOfWeek.FRIDAY || day === 29);
13572
+ var month = jdate.Month, day = jdate.Day, dow = jdate.DayOfWeek, _ZmanimUtils_getBasicShulZmanim = ZmanimUtils.getBasicShulZmanim(date, location), chatzosHayom = _ZmanimUtils_getBasicShulZmanim.chatzosHayom, chatzosHalayla = _ZmanimUtils_getBasicShulZmanim.chatzosHalayla, alos = _ZmanimUtils_getBasicShulZmanim.alos, shkia = _ZmanimUtils_getBasicShulZmanim.shkia, isAfterChatzosHayom = Utils.isTimeAfter(chatzosHayom, time), isAfterChatzosHalayla = typeof chatzosHalayla !== "undefined" && (Utils.isTimeAfter(chatzosHalayla, time) || chatzosHalayla.hour > 12 && time.hour < 12), isAfterAlos = Utils.isTimeAfter(alos, time), isAfterShkia = Utils.isTimeAfter(shkia, time), isDaytime = isAfterAlos && !isAfterShkia, isNightTime = !isDaytime, isNotBeinHasmashos = !isAfterShkia || Utils.isTimeAfter(Utils.addMinutes(shkia, 18), time), isMorning = isDaytime && !isAfterChatzosHayom, isAfternoon = isDaytime && isAfterChatzosHayom && isNotBeinHasmashos, isYomTov = jdate.isYomTovOrCholHamoed(location.Israel), isLeapYear = jDate.isJdLeapY(jdate.Year), noTachnun = isAfternoon && (dow === DaysOfWeek.FRIDAY || day === 29);
13619
13573
  dayInfo = {
13620
13574
  jdate: jdate,
13621
13575
  sdate: sdate,
@@ -13789,6 +13743,9 @@ function getAroundTheYearNotifications() {
13789
13743
  if (dow !== DaysOfWeek.SHABBOS && day > 15 && day !== 21) {
13790
13744
  addTefillahNote("Vesain Bracha", "\u05D5\u05EA\u05DF \u05D1\u05E8\u05DB\u05D4");
13791
13745
  }
13746
+ if (isNightTime && (dow !== DaysOfWeek.FRIDAY && day === 14 || dow === DaysOfWeek.THURSDAY && day === 13)) {
13747
+ addDayNote("Bedikas Chometz", "\u05D1\u05D3\u05D9\u05E7\u05EA \u05D7\u05DE\u05E5");
13748
+ }
13792
13749
  if (isMorning && dow !== DaysOfWeek.SHABBOS && [
13793
13750
  14,
13794
13751
  16,