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 +21 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -13
- package/dist/index.d.ts +6 -13
- package/dist/index.js +21 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -300,8 +300,6 @@ declare class jDate {
|
|
|
300
300
|
static sdFromAbs(abs: number): Date;
|
|
301
301
|
/**number of days in the given Jewish Month. Nissan is 1 and Adar Sheini is 13.*/
|
|
302
302
|
static daysJMonth(year: number, month: number): number;
|
|
303
|
-
/**Elapsed days since creation of the world until Rosh Hashana of the given year*/
|
|
304
|
-
static tDays(year: number): number;
|
|
305
303
|
/**The index for the year type of the given year.
|
|
306
304
|
* IMPORTANT NOTE: Only works for years 5000 and after.
|
|
307
305
|
*/
|
|
@@ -318,16 +316,11 @@ declare class jDate {
|
|
|
318
316
|
static isLongCheshvan(year: number): boolean;
|
|
319
317
|
/**Does Kislev for the given Jewish Year have 29 days?*/
|
|
320
318
|
static isShortKislev(year: number): boolean;
|
|
321
|
-
/**number of days in the given Jewish Year.*/
|
|
322
|
-
static daysJYear_(year: number): number;
|
|
323
|
-
/**Does Cheshvan for the given Jewish Year have 30 days?*/
|
|
324
|
-
static isLongCheshvan_(year: number): boolean;
|
|
325
|
-
/**Does Kislev for the given Jewish Year have 29 days?*/
|
|
326
|
-
static isShortKislev_(year: number): boolean;
|
|
327
319
|
/**Does the given Jewish Year have 13 months?*/
|
|
328
320
|
static isJdLeapY(year: number): boolean;
|
|
329
321
|
/**number of months in Jewish Year.*/
|
|
330
322
|
static monthsJYear(year: number): number;
|
|
323
|
+
static getElapsedDays: (year: number) => number;
|
|
331
324
|
}
|
|
332
325
|
|
|
333
326
|
declare const DaysOfWeek: Readonly<{
|
|
@@ -491,7 +484,7 @@ declare class Utils {
|
|
|
491
484
|
* @param {number} dayOfOmer The day of the Omer for which to get the nusach for
|
|
492
485
|
* @param {'ashkenaz'|'sefard'|'sefardi'} nusach Should it be La'Omer ("sefard") or Ba'Omer ("ashkenaz") or "sefardi" (Eidot Hamizrach)?
|
|
493
486
|
*/
|
|
494
|
-
static getOmerNusach(dayOfOmer: number, nusach:
|
|
487
|
+
static getOmerNusach(dayOfOmer: number, nusach: "ashkenaz" | "sefard" | "sefardi"): string;
|
|
495
488
|
/**
|
|
496
489
|
* Returns the given time in a formatted string.
|
|
497
490
|
* @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
@@ -576,10 +569,10 @@ declare class Utils {
|
|
|
576
569
|
*/
|
|
577
570
|
static toInt(float: number): number;
|
|
578
571
|
/***
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
572
|
+
* Takes either a jDate or a Date and returns both
|
|
573
|
+
* @param date {Date |jDate}
|
|
574
|
+
* @returns {{ sdate:Date, jdate:jDate }}
|
|
575
|
+
*/
|
|
583
576
|
static bothDates(date: Date | jDate): {
|
|
584
577
|
sdate: Date;
|
|
585
578
|
jdate: jDate;
|
package/dist/index.d.ts
CHANGED
|
@@ -300,8 +300,6 @@ declare class jDate {
|
|
|
300
300
|
static sdFromAbs(abs: number): Date;
|
|
301
301
|
/**number of days in the given Jewish Month. Nissan is 1 and Adar Sheini is 13.*/
|
|
302
302
|
static daysJMonth(year: number, month: number): number;
|
|
303
|
-
/**Elapsed days since creation of the world until Rosh Hashana of the given year*/
|
|
304
|
-
static tDays(year: number): number;
|
|
305
303
|
/**The index for the year type of the given year.
|
|
306
304
|
* IMPORTANT NOTE: Only works for years 5000 and after.
|
|
307
305
|
*/
|
|
@@ -318,16 +316,11 @@ declare class jDate {
|
|
|
318
316
|
static isLongCheshvan(year: number): boolean;
|
|
319
317
|
/**Does Kislev for the given Jewish Year have 29 days?*/
|
|
320
318
|
static isShortKislev(year: number): boolean;
|
|
321
|
-
/**number of days in the given Jewish Year.*/
|
|
322
|
-
static daysJYear_(year: number): number;
|
|
323
|
-
/**Does Cheshvan for the given Jewish Year have 30 days?*/
|
|
324
|
-
static isLongCheshvan_(year: number): boolean;
|
|
325
|
-
/**Does Kislev for the given Jewish Year have 29 days?*/
|
|
326
|
-
static isShortKislev_(year: number): boolean;
|
|
327
319
|
/**Does the given Jewish Year have 13 months?*/
|
|
328
320
|
static isJdLeapY(year: number): boolean;
|
|
329
321
|
/**number of months in Jewish Year.*/
|
|
330
322
|
static monthsJYear(year: number): number;
|
|
323
|
+
static getElapsedDays: (year: number) => number;
|
|
331
324
|
}
|
|
332
325
|
|
|
333
326
|
declare const DaysOfWeek: Readonly<{
|
|
@@ -491,7 +484,7 @@ declare class Utils {
|
|
|
491
484
|
* @param {number} dayOfOmer The day of the Omer for which to get the nusach for
|
|
492
485
|
* @param {'ashkenaz'|'sefard'|'sefardi'} nusach Should it be La'Omer ("sefard") or Ba'Omer ("ashkenaz") or "sefardi" (Eidot Hamizrach)?
|
|
493
486
|
*/
|
|
494
|
-
static getOmerNusach(dayOfOmer: number, nusach:
|
|
487
|
+
static getOmerNusach(dayOfOmer: number, nusach: "ashkenaz" | "sefard" | "sefardi"): string;
|
|
495
488
|
/**
|
|
496
489
|
* Returns the given time in a formatted string.
|
|
497
490
|
* @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
@@ -576,10 +569,10 @@ declare class Utils {
|
|
|
576
569
|
*/
|
|
577
570
|
static toInt(float: number): number;
|
|
578
571
|
/***
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
572
|
+
* Takes either a jDate or a Date and returns both
|
|
573
|
+
* @param date {Date |jDate}
|
|
574
|
+
* @returns {{ sdate:Date, jdate:jDate }}
|
|
575
|
+
*/
|
|
583
576
|
static bothDates(date: Date | jDate): {
|
|
584
577
|
sdate: Date;
|
|
585
578
|
jdate: jDate;
|
package/dist/index.js
CHANGED
|
@@ -1790,7 +1790,6 @@ _Dafyomi.masechtaList = [
|
|
|
1790
1790
|
];
|
|
1791
1791
|
var Dafyomi = _Dafyomi;
|
|
1792
1792
|
// src/JCal/jDate.ts
|
|
1793
|
-
var _yearCache = [];
|
|
1794
1793
|
var JS_START_DATE_ABS = 719163;
|
|
1795
1794
|
var MS_PER_DAY = 864e5;
|
|
1796
1795
|
var JS_START_OFFSET = /* @__PURE__ */ new Date(0).getTimezoneOffset();
|
|
@@ -2896,15 +2895,7 @@ var yearTypeList = [
|
|
|
2896
2895
|
0,
|
|
2897
2896
|
7
|
|
2898
2897
|
];
|
|
2899
|
-
var
|
|
2900
|
-
var getElapsedDaysEarly = function(year) {
|
|
2901
|
-
var _yearCache_find;
|
|
2902
|
-
var elapsed = (_yearCache_find = _yearCache.find(function(y) {
|
|
2903
|
-
return (y === null || y === void 0 ? void 0 : y.year) === year;
|
|
2904
|
-
})) === null || _yearCache_find === void 0 ? void 0 : _yearCache_find.elapsed;
|
|
2905
|
-
if (elapsed) {
|
|
2906
|
-
return elapsed;
|
|
2907
|
-
}
|
|
2898
|
+
var getElapsedDays = function(year) {
|
|
2908
2899
|
var daysCounter = 0;
|
|
2909
2900
|
var months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle
|
|
2910
2901
|
12 * ((year - 1) % 19) + // Regular months in this cycle.
|
|
@@ -2917,20 +2908,9 @@ var getElapsedDaysEarly = function(year) {
|
|
|
2917
2908
|
if (Utils.has(daysCounter % 7, 0, 3, 5)) {
|
|
2918
2909
|
daysCounter += 1;
|
|
2919
2910
|
}
|
|
2920
|
-
_yearCache.push({
|
|
2921
|
-
year: year,
|
|
2922
|
-
elapsed: daysCounter
|
|
2923
|
-
});
|
|
2924
2911
|
return daysCounter;
|
|
2925
2912
|
};
|
|
2926
|
-
var
|
|
2927
|
-
var counter = daysUntil5000;
|
|
2928
|
-
for(var y = 5e3; y < year; y++){
|
|
2929
|
-
counter += jDate.yearType(y).daysInYear;
|
|
2930
|
-
}
|
|
2931
|
-
return counter;
|
|
2932
|
-
};
|
|
2933
|
-
var jDate = /*#__PURE__*/ function() {
|
|
2913
|
+
var _jDate = /*#__PURE__*/ function() {
|
|
2934
2914
|
"use strict";
|
|
2935
2915
|
function _jDate(arg, month, day, abs) {
|
|
2936
2916
|
_class_call_check(this, _jDate);
|
|
@@ -3478,7 +3458,7 @@ var jDate = /*#__PURE__*/ function() {
|
|
|
3478
3458
|
m1++;
|
|
3479
3459
|
}
|
|
3480
3460
|
}
|
|
3481
|
-
return dayInYear + (
|
|
3461
|
+
return dayInYear + (getElapsedDays(year) + -1373429);
|
|
3482
3462
|
}
|
|
3483
3463
|
},
|
|
3484
3464
|
{
|
|
@@ -3521,16 +3501,6 @@ var jDate = /*#__PURE__*/ function() {
|
|
|
3521
3501
|
return 0;
|
|
3522
3502
|
}
|
|
3523
3503
|
},
|
|
3524
|
-
{
|
|
3525
|
-
key: "tDays",
|
|
3526
|
-
value: /**Elapsed days since creation of the world until Rosh Hashana of the given year*/ function tDays(year) {
|
|
3527
|
-
if (year >= 5e3) {
|
|
3528
|
-
return getElapsedDays5000(year);
|
|
3529
|
-
} else {
|
|
3530
|
-
return getElapsedDaysEarly(year);
|
|
3531
|
-
}
|
|
3532
|
-
}
|
|
3533
|
-
},
|
|
3534
3504
|
{
|
|
3535
3505
|
key: "yearType",
|
|
3536
3506
|
value: /**The index for the year type of the given year.
|
|
@@ -3545,7 +3515,7 @@ var jDate = /*#__PURE__*/ function() {
|
|
|
3545
3515
|
if (year >= 5e3) {
|
|
3546
3516
|
return _jDate.yearType(year).daysInYear;
|
|
3547
3517
|
} else {
|
|
3548
|
-
return
|
|
3518
|
+
return getElapsedDays(year + 1) - getElapsedDays(year);
|
|
3549
3519
|
}
|
|
3550
3520
|
}
|
|
3551
3521
|
},
|
|
@@ -3569,24 +3539,6 @@ var jDate = /*#__PURE__*/ function() {
|
|
|
3569
3539
|
}
|
|
3570
3540
|
}
|
|
3571
3541
|
},
|
|
3572
|
-
{
|
|
3573
|
-
key: "daysJYear_",
|
|
3574
|
-
value: /**number of days in the given Jewish Year.*/ function daysJYear_(year) {
|
|
3575
|
-
return _jDate.yearType(year).daysInYear;
|
|
3576
|
-
}
|
|
3577
|
-
},
|
|
3578
|
-
{
|
|
3579
|
-
key: "isLongCheshvan_",
|
|
3580
|
-
value: /**Does Cheshvan for the given Jewish Year have 30 days?*/ function isLongCheshvan_(year) {
|
|
3581
|
-
return _jDate.yearType(year).isLongCheshvan;
|
|
3582
|
-
}
|
|
3583
|
-
},
|
|
3584
|
-
{
|
|
3585
|
-
key: "isShortKislev_",
|
|
3586
|
-
value: /**Does Kislev for the given Jewish Year have 29 days?*/ function isShortKislev_(year) {
|
|
3587
|
-
return !_jDate.yearType(year).isLongKislev;
|
|
3588
|
-
}
|
|
3589
|
-
},
|
|
3590
3542
|
{
|
|
3591
3543
|
key: "isJdLeapY",
|
|
3592
3544
|
value: /**Does the given Jewish Year have 13 months?*/ function isJdLeapY(year) {
|
|
@@ -3602,6 +3554,8 @@ var jDate = /*#__PURE__*/ function() {
|
|
|
3602
3554
|
]);
|
|
3603
3555
|
return _jDate;
|
|
3604
3556
|
}();
|
|
3557
|
+
_jDate.getElapsedDays = getElapsedDays;
|
|
3558
|
+
var jDate = _jDate;
|
|
3605
3559
|
// src/JCal/Zmanim.ts
|
|
3606
3560
|
var Zmanim = /*#__PURE__*/ function() {
|
|
3607
3561
|
"use strict";
|
|
@@ -4233,19 +4187,19 @@ var _Utils = /*#__PURE__*/ function() {
|
|
|
4233
4187
|
*/ function getTimeIntervalTextStringHeb(time) {
|
|
4234
4188
|
var t = "";
|
|
4235
4189
|
if (time.hour > 0) {
|
|
4236
|
-
t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "\u05E9\u05E2\u05D4" : "\u05E9\u05E2\u05D5\u05EA");
|
|
4190
|
+
t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "\u05E9\u05E2\u05D4" : "\u05E9\u05E2\u05D5\u05EA", "\xad");
|
|
4237
4191
|
}
|
|
4238
4192
|
if (time.minute > 0) {
|
|
4239
4193
|
if (t.length) {
|
|
4240
4194
|
t += " ";
|
|
4241
4195
|
}
|
|
4242
|
-
t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "\u05D3\u05E7\u05D4" : "\u05D3\u05E7\u05D5\u05EA");
|
|
4196
|
+
t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "\u05D3\u05E7\u05D4" : "\u05D3\u05E7\u05D5\u05EA", "\xad");
|
|
4243
4197
|
}
|
|
4244
4198
|
if ((time.second || 0) > 0) {
|
|
4245
4199
|
if (t.length) {
|
|
4246
4200
|
t += " ";
|
|
4247
4201
|
}
|
|
4248
|
-
t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "\u05E9\u05E0\u05D9\u05D9\u05D4" : "\u05E9\u05E0\u05D9\u05D5\u05EA");
|
|
4202
|
+
t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "\u05E9\u05E0\u05D9\u05D9\u05D4" : "\u05E9\u05E0\u05D9\u05D5\u05EA", "\xad");
|
|
4249
4203
|
}
|
|
4250
4204
|
return t;
|
|
4251
4205
|
}
|
|
@@ -4258,19 +4212,19 @@ var _Utils = /*#__PURE__*/ function() {
|
|
|
4258
4212
|
*/ function getTimeIntervalTextString(time) {
|
|
4259
4213
|
var t = "";
|
|
4260
4214
|
if (time.hour > 0) {
|
|
4261
|
-
t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "hour" : "hours");
|
|
4215
|
+
t += "".concat(time.hour.toString(), " ").concat(time.hour === 1 ? "hour" : "hours", "\xad");
|
|
4262
4216
|
}
|
|
4263
4217
|
if (time.minute > 0) {
|
|
4264
4218
|
if (t.length) {
|
|
4265
4219
|
t += " ";
|
|
4266
4220
|
}
|
|
4267
|
-
t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "minute" : "minutes");
|
|
4221
|
+
t += "".concat(time.minute.toString(), " ").concat(time.minute === 1 ? "minute" : "minutes", "\xad");
|
|
4268
4222
|
}
|
|
4269
4223
|
if ((time.second || 0) > 0) {
|
|
4270
4224
|
if (t.length) {
|
|
4271
4225
|
t += " ";
|
|
4272
4226
|
}
|
|
4273
|
-
t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "second" : "seconds");
|
|
4227
|
+
t += "".concat(Math.trunc(time.second || 0).toString(), " ").concat(time.second === 1 ? "second" : "seconds", "\xad");
|
|
4274
4228
|
}
|
|
4275
4229
|
return t;
|
|
4276
4230
|
}
|
|
@@ -4337,7 +4291,7 @@ var _Utils = /*#__PURE__*/ function() {
|
|
|
4337
4291
|
value: /**
|
|
4338
4292
|
* Returns the given time in a formatted string.
|
|
4339
4293
|
* @param {Time} time An object in the format {hour : 23, minute :42, second: 18 }
|
|
4340
|
-
* @param {1 | -1} [sign]
|
|
4294
|
+
* @param {1 | -1} [sign]
|
|
4341
4295
|
* @param {Boolean} [army] If falsey, the returned string will be: 11:42:18 PM otherwise it will be 23:42:18
|
|
4342
4296
|
* @param {Boolean} [roundUp] If falsey, the numbers will converted to a whole number by rounding down, otherwise, up.
|
|
4343
4297
|
*/ function getTimeString(time, sign, army, roundUp) {
|
|
@@ -4525,10 +4479,10 @@ var _Utils = /*#__PURE__*/ function() {
|
|
|
4525
4479
|
{
|
|
4526
4480
|
key: "bothDates",
|
|
4527
4481
|
value: /***
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4482
|
+
* Takes either a jDate or a Date and returns both
|
|
4483
|
+
* @param date {Date |jDate}
|
|
4484
|
+
* @returns {{ sdate:Date, jdate:jDate }}
|
|
4485
|
+
*/ function bothDates(date) {
|
|
4532
4486
|
var jdate = _instanceof(date, Date) ? new jDate(date) : date;
|
|
4533
4487
|
var sdate = _instanceof(date, Date) ? date : jdate.getDate();
|
|
4534
4488
|
return {
|
|
@@ -13500,7 +13454,7 @@ function getNotifications(date, time, location, english, showGaonShir, showDafYo
|
|
|
13500
13454
|
var _Utils_bothDates = Utils.bothDates(date), sdate = _Utils_bothDates.sdate, jdate = _Utils_bothDates.jdate;
|
|
13501
13455
|
dayNotes.length = 0;
|
|
13502
13456
|
tefillahNotes.length = 0;
|
|
13503
|
-
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);
|
|
13457
|
+
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);
|
|
13504
13458
|
dayInfo = {
|
|
13505
13459
|
jdate: jdate,
|
|
13506
13460
|
sdate: sdate,
|
|
@@ -13674,6 +13628,9 @@ function getAroundTheYearNotifications() {
|
|
|
13674
13628
|
if (dow !== DaysOfWeek.SHABBOS && day > 15 && day !== 21) {
|
|
13675
13629
|
addTefillahNote("Vesain Bracha", "\u05D5\u05EA\u05DF \u05D1\u05E8\u05DB\u05D4");
|
|
13676
13630
|
}
|
|
13631
|
+
if (isNightTime && (dow !== DaysOfWeek.FRIDAY && day === 14 || dow === DaysOfWeek.THURSDAY && day === 13)) {
|
|
13632
|
+
addDayNote("Bedikas Chometz", "\u05D1\u05D3\u05D9\u05E7\u05EA \u05D7\u05DE\u05E5");
|
|
13633
|
+
}
|
|
13677
13634
|
if (isMorning && dow !== DaysOfWeek.SHABBOS && [
|
|
13678
13635
|
14,
|
|
13679
13636
|
16,
|