@hebcal/core 5.0.5 → 5.0.7
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/bundle.js +171 -113
- package/dist/bundle.min.js +2 -2
- package/dist/index.cjs +164 -90
- package/dist/index.mjs +164 -90
- package/hebcal.d.ts +24 -6
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.7 */
|
|
2
2
|
/** @private */
|
|
3
3
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4
4
|
/** @private */
|
|
@@ -3704,27 +3704,68 @@ class Zmanim {
|
|
|
3704
3704
|
return this.getShaahZmanisBasedZman(4);
|
|
3705
3705
|
}
|
|
3706
3706
|
/**
|
|
3707
|
-
*
|
|
3707
|
+
* Returns an array with alot (Date) and ms in hour (number)
|
|
3708
|
+
* @private
|
|
3709
|
+
* @return {any[]}
|
|
3710
|
+
*/
|
|
3711
|
+
getTemporalHour72() {
|
|
3712
|
+
const alot72 = this.sunriseOffset(-72, false, true);
|
|
3713
|
+
const tzeit72 = this.sunsetOffset(72, false, true);
|
|
3714
|
+
const temporalHour = (tzeit72 - alot72) / 12;
|
|
3715
|
+
return [alot72, temporalHour];
|
|
3716
|
+
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Returns an array with alot (Date) and ms in hour (number)
|
|
3719
|
+
* @private
|
|
3720
|
+
* @return {any[]}
|
|
3721
|
+
*/
|
|
3722
|
+
getTemporalHour16Point1() {
|
|
3723
|
+
const alot16one = this.alotHaShachar();
|
|
3724
|
+
const tzeit16one = this.tzeit(16.1);
|
|
3725
|
+
const temporalHour = (tzeit16one - alot16one) / 12;
|
|
3726
|
+
return [alot16one, temporalHour];
|
|
3727
|
+
}
|
|
3728
|
+
/**
|
|
3729
|
+
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
3730
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
3731
|
+
* dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
|
|
3732
|
+
* 72 minutes after sea-level sunset.
|
|
3708
3733
|
* @return {Date}
|
|
3709
3734
|
*/
|
|
3710
3735
|
sofZmanShmaMGA() {
|
|
3711
3736
|
// Magen Avraham
|
|
3712
|
-
const alot72 = this.
|
|
3713
|
-
const tzeit72 = this.sunsetOffset(72, false, true);
|
|
3714
|
-
const temporalHour = (tzeit72 - alot72) / 12; // ms in hour
|
|
3737
|
+
const [alot72, temporalHour] = this.getTemporalHour72();
|
|
3715
3738
|
return new Date(alot72.getTime() + 3 * temporalHour);
|
|
3716
3739
|
}
|
|
3740
|
+
/**
|
|
3741
|
+
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
3742
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
3743
|
+
* dawn to nightfall with both being 16.1° below the horizon.
|
|
3744
|
+
* @return {Date}
|
|
3745
|
+
*/
|
|
3746
|
+
sofZmanShmaMGA16Point1() {
|
|
3747
|
+
const [alot, temporalHour] = this.getTemporalHour16Point1();
|
|
3748
|
+
return new Date(alot.getTime() + 3 * temporalHour);
|
|
3749
|
+
}
|
|
3717
3750
|
/**
|
|
3718
3751
|
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham
|
|
3719
3752
|
* @return {Date}
|
|
3720
3753
|
*/
|
|
3721
3754
|
sofZmanTfillaMGA() {
|
|
3722
3755
|
// Magen Avraham
|
|
3723
|
-
const alot72 = this.
|
|
3724
|
-
const tzeit72 = this.sunsetOffset(72, false, true);
|
|
3725
|
-
const temporalHour = (tzeit72 - alot72) / 12; // ms in hour
|
|
3756
|
+
const [alot72, temporalHour] = this.getTemporalHour72();
|
|
3726
3757
|
return new Date(alot72.getTime() + 4 * temporalHour);
|
|
3727
3758
|
}
|
|
3759
|
+
/**
|
|
3760
|
+
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
|
|
3761
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
3762
|
+
* dawn to nightfall with both being 16.1° below the horizon.
|
|
3763
|
+
* @return {Date}
|
|
3764
|
+
*/
|
|
3765
|
+
sofZmanTfillaMGA16Point1() {
|
|
3766
|
+
const [alot, temporalHour] = this.getTemporalHour16Point1();
|
|
3767
|
+
return new Date(alot.getTime() + 4 * temporalHour);
|
|
3768
|
+
}
|
|
3728
3769
|
/**
|
|
3729
3770
|
* Earliest Mincha – Mincha Gedola; Sunrise plus 6.5 halachic hours
|
|
3730
3771
|
* @return {Date}
|
|
@@ -3877,6 +3918,54 @@ class Zmanim {
|
|
|
3877
3918
|
}
|
|
3878
3919
|
}
|
|
3879
3920
|
|
|
3921
|
+
const hour12cc = {
|
|
3922
|
+
US: 1,
|
|
3923
|
+
CA: 1,
|
|
3924
|
+
BR: 1,
|
|
3925
|
+
AU: 1,
|
|
3926
|
+
NZ: 1,
|
|
3927
|
+
DO: 1,
|
|
3928
|
+
PR: 1,
|
|
3929
|
+
GR: 1,
|
|
3930
|
+
IN: 1,
|
|
3931
|
+
KR: 1,
|
|
3932
|
+
NP: 1,
|
|
3933
|
+
ZA: 1
|
|
3934
|
+
};
|
|
3935
|
+
|
|
3936
|
+
/**
|
|
3937
|
+
* @private
|
|
3938
|
+
* @param {string} timeStr - original time like "20:30"
|
|
3939
|
+
* @param {string} suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
3940
|
+
* @param {CalOptions} options
|
|
3941
|
+
* @return {string}
|
|
3942
|
+
*/
|
|
3943
|
+
function reformatTimeStr(timeStr, suffix, options) {
|
|
3944
|
+
var _options$location;
|
|
3945
|
+
if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
3946
|
+
const cc = (options === null || options === void 0 || (_options$location = options.location) === null || _options$location === void 0 ? void 0 : _options$location.cc) || (options !== null && options !== void 0 && options.il ? 'IL' : 'US');
|
|
3947
|
+
const hour12 = options === null || options === void 0 ? void 0 : options.hour12;
|
|
3948
|
+
if (typeof hour12 !== 'undefined' && !hour12) {
|
|
3949
|
+
return timeStr;
|
|
3950
|
+
}
|
|
3951
|
+
if (!hour12 && typeof hour12cc[cc] === 'undefined') {
|
|
3952
|
+
return timeStr;
|
|
3953
|
+
}
|
|
3954
|
+
const hm = timeStr.split(':');
|
|
3955
|
+
let hour = parseInt(hm[0], 10);
|
|
3956
|
+
if (hour < 12 && suffix) {
|
|
3957
|
+
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
3958
|
+
if (hour === 0) {
|
|
3959
|
+
hour = 12;
|
|
3960
|
+
}
|
|
3961
|
+
} else if (hour > 12) {
|
|
3962
|
+
hour = hour % 12;
|
|
3963
|
+
} else if (hour === 0) {
|
|
3964
|
+
hour = '00';
|
|
3965
|
+
}
|
|
3966
|
+
return `${hour}:${hm[1]}${suffix}`;
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3880
3969
|
/* eslint-disable max-len */
|
|
3881
3970
|
const FRI$3 = 5;
|
|
3882
3971
|
const SAT$3 = 6;
|
|
@@ -3886,11 +3975,10 @@ const SAT$3 = 6;
|
|
|
3886
3975
|
* @param {Event} e
|
|
3887
3976
|
* @param {HDate} hd
|
|
3888
3977
|
* @param {number} dow
|
|
3889
|
-
* @param {Location} location
|
|
3890
3978
|
* @param {CalOptions} options
|
|
3891
3979
|
* @return {Event}
|
|
3892
3980
|
*/
|
|
3893
|
-
function makeCandleEvent(e, hd, dow,
|
|
3981
|
+
function makeCandleEvent(e, hd, dow, options) {
|
|
3894
3982
|
let havdalahTitle = false;
|
|
3895
3983
|
let useHavdalahOffset = dow === SAT$3;
|
|
3896
3984
|
let mask = e ? e.getFlags() : flags.LIGHT_CANDLES;
|
|
@@ -3910,15 +3998,16 @@ function makeCandleEvent(e, hd, dow, location, options) {
|
|
|
3910
3998
|
}
|
|
3911
3999
|
// if offset is 0 or undefined, we'll use tzeit time
|
|
3912
4000
|
const offset = useHavdalahOffset ? options.havdalahMins : options.candleLightingMins;
|
|
4001
|
+
const location = options.location;
|
|
3913
4002
|
const zmanim = new Zmanim(location, hd, options.useElevation);
|
|
3914
4003
|
const time = offset ? zmanim.sunsetOffset(offset, true) : zmanim.tzeit(options.havdalahDeg);
|
|
3915
4004
|
if (isNaN(time.getTime())) {
|
|
3916
4005
|
return null; // no sunset
|
|
3917
4006
|
}
|
|
3918
4007
|
if (havdalahTitle) {
|
|
3919
|
-
return new HavdalahEvent(hd, mask, time, location, options.havdalahMins, e);
|
|
4008
|
+
return new HavdalahEvent(hd, mask, time, location, options.havdalahMins, e, options);
|
|
3920
4009
|
} else {
|
|
3921
|
-
return new CandleLightingEvent(hd, mask, time, location, e);
|
|
4010
|
+
return new CandleLightingEvent(hd, mask, time, location, e, options);
|
|
3922
4011
|
}
|
|
3923
4012
|
}
|
|
3924
4013
|
|
|
@@ -3931,13 +4020,18 @@ class TimedEvent extends Event {
|
|
|
3931
4020
|
* @param {Date} eventTime
|
|
3932
4021
|
* @param {Location} location
|
|
3933
4022
|
* @param {Event} linkedEvent
|
|
4023
|
+
* @param {CalOptions} options
|
|
3934
4024
|
*/
|
|
3935
|
-
constructor(date, desc, mask, eventTime, location, linkedEvent) {
|
|
4025
|
+
constructor(date, desc, mask, eventTime, location, linkedEvent, options) {
|
|
3936
4026
|
super(date, desc, mask);
|
|
3937
4027
|
this.eventTime = Zmanim.roundTime(eventTime);
|
|
3938
4028
|
this.location = location;
|
|
3939
4029
|
const timeFormat = location.getTimeFormatter();
|
|
3940
4030
|
this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);
|
|
4031
|
+
const opts = Object.assign({
|
|
4032
|
+
location
|
|
4033
|
+
}, options);
|
|
4034
|
+
this.fmtTime = reformatTimeStr(this.eventTimeStr, 'pm', opts);
|
|
3941
4035
|
if (typeof linkedEvent !== 'undefined') {
|
|
3942
4036
|
this.linkedEvent = linkedEvent;
|
|
3943
4037
|
}
|
|
@@ -3947,7 +4041,7 @@ class TimedEvent extends Event {
|
|
|
3947
4041
|
* @return {string}
|
|
3948
4042
|
*/
|
|
3949
4043
|
render(locale) {
|
|
3950
|
-
return Locale.gettext(this.getDesc(), locale) + ': ' + this.
|
|
4044
|
+
return Locale.gettext(this.getDesc(), locale) + ': ' + this.fmtTime;
|
|
3951
4045
|
}
|
|
3952
4046
|
/**
|
|
3953
4047
|
* Returns translation of "Candle lighting" without the time.
|
|
@@ -3984,9 +4078,10 @@ class HavdalahEvent extends TimedEvent {
|
|
|
3984
4078
|
* @param {Location} location
|
|
3985
4079
|
* @param {number} havdalahMins
|
|
3986
4080
|
* @param {Event} linkedEvent
|
|
4081
|
+
* @param {CalOptions} options
|
|
3987
4082
|
*/
|
|
3988
|
-
constructor(date, mask, eventTime, location, havdalahMins, linkedEvent) {
|
|
3989
|
-
super(date, 'Havdalah', mask, eventTime, location, linkedEvent);
|
|
4083
|
+
constructor(date, mask, eventTime, location, havdalahMins, linkedEvent, options) {
|
|
4084
|
+
super(date, 'Havdalah', mask, eventTime, location, linkedEvent, options);
|
|
3990
4085
|
if (havdalahMins) {
|
|
3991
4086
|
this.havdalahMins = havdalahMins;
|
|
3992
4087
|
}
|
|
@@ -3996,7 +4091,7 @@ class HavdalahEvent extends TimedEvent {
|
|
|
3996
4091
|
* @return {string}
|
|
3997
4092
|
*/
|
|
3998
4093
|
render(locale) {
|
|
3999
|
-
return this.renderBrief(locale) + ': ' + this.
|
|
4094
|
+
return this.renderBrief(locale) + ': ' + this.fmtTime;
|
|
4000
4095
|
}
|
|
4001
4096
|
/**
|
|
4002
4097
|
* Returns translation of "Havdalah" without the time.
|
|
@@ -4025,9 +4120,10 @@ class CandleLightingEvent extends TimedEvent {
|
|
|
4025
4120
|
* @param {Date} eventTime
|
|
4026
4121
|
* @param {Location} location
|
|
4027
4122
|
* @param {Event} linkedEvent
|
|
4123
|
+
* @param {CalOptions} options
|
|
4028
4124
|
*/
|
|
4029
|
-
constructor(date, mask, eventTime, location, linkedEvent) {
|
|
4030
|
-
super(date, 'Candle lighting', mask, eventTime, location, linkedEvent);
|
|
4125
|
+
constructor(date, mask, eventTime, location, linkedEvent, options) {
|
|
4126
|
+
super(date, 'Candle lighting', mask, eventTime, location, linkedEvent, options);
|
|
4031
4127
|
}
|
|
4032
4128
|
/** @return {string} */
|
|
4033
4129
|
getEmoji() {
|
|
@@ -4055,14 +4151,14 @@ function makeFastStartEnd(ev, options) {
|
|
|
4055
4151
|
const zmanim = new Zmanim(location, dt, options.useElevation);
|
|
4056
4152
|
if (desc === 'Erev Tish\'a B\'Av') {
|
|
4057
4153
|
const sunset = zmanim.sunset();
|
|
4058
|
-
ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev,
|
|
4154
|
+
ev.startEvent = makeTimedEvent(hd, sunset, 'Fast begins', ev, options);
|
|
4059
4155
|
} else if (desc.startsWith('Tish\'a B\'Av')) {
|
|
4060
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev,
|
|
4156
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, options);
|
|
4061
4157
|
} else {
|
|
4062
4158
|
const dawn = zmanim.alotHaShachar();
|
|
4063
|
-
ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev,
|
|
4159
|
+
ev.startEvent = makeTimedEvent(hd, dawn, 'Fast begins', ev, options);
|
|
4064
4160
|
if (dt.getDay() !== 5 && !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)) {
|
|
4065
|
-
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev,
|
|
4161
|
+
ev.endEvent = makeTimedEvent(hd, zmanim.tzeit(fastEndDeg), 'Fast ends', ev, options);
|
|
4066
4162
|
}
|
|
4067
4163
|
}
|
|
4068
4164
|
return ev;
|
|
@@ -4074,14 +4170,15 @@ function makeFastStartEnd(ev, options) {
|
|
|
4074
4170
|
* @param {Date} time
|
|
4075
4171
|
* @param {string} desc
|
|
4076
4172
|
* @param {Event} ev
|
|
4077
|
-
* @param {
|
|
4173
|
+
* @param {CalOptions} options
|
|
4078
4174
|
* @return {TimedEvent}
|
|
4079
4175
|
*/
|
|
4080
|
-
function makeTimedEvent(hd, time, desc, ev,
|
|
4176
|
+
function makeTimedEvent(hd, time, desc, ev, options) {
|
|
4081
4177
|
if (isNaN(time.getTime())) {
|
|
4082
4178
|
return null;
|
|
4083
4179
|
}
|
|
4084
|
-
|
|
4180
|
+
const location = options.location;
|
|
4181
|
+
return new TimedEvent(hd, desc, ev.getFlags(), time, location, ev, options);
|
|
4085
4182
|
}
|
|
4086
4183
|
|
|
4087
4184
|
/**
|
|
@@ -4097,7 +4194,7 @@ function makeWeekdayChanukahCandleLighting(ev, hd, options) {
|
|
|
4097
4194
|
const zmanim = new Zmanim(location, hd.greg(), options.useElevation);
|
|
4098
4195
|
const candleLightingTime = zmanim.dusk();
|
|
4099
4196
|
// const candleLightingTime = zmanim.tzeit(4.6667);
|
|
4100
|
-
return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev,
|
|
4197
|
+
return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, options);
|
|
4101
4198
|
}
|
|
4102
4199
|
|
|
4103
4200
|
/* eslint-disable camelcase */
|
|
@@ -4185,6 +4282,33 @@ class Molad {
|
|
|
4185
4282
|
getChalakim() {
|
|
4186
4283
|
return this.chalakim;
|
|
4187
4284
|
}
|
|
4285
|
+
/**
|
|
4286
|
+
* @param {string} [locale] Optional locale name (defaults to active locale)
|
|
4287
|
+
* @param {CalOptions} options
|
|
4288
|
+
* @return {string}
|
|
4289
|
+
*/
|
|
4290
|
+
render(locale, options) {
|
|
4291
|
+
locale = locale || Locale.getLocaleName();
|
|
4292
|
+
if (typeof locale === 'string') {
|
|
4293
|
+
locale = locale.toLowerCase();
|
|
4294
|
+
}
|
|
4295
|
+
const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
|
|
4296
|
+
const monthName = Locale.gettext(this.getMonthName(), locale);
|
|
4297
|
+
const dayNames = isHebrewLocale ? heDayNames : shortDayNames;
|
|
4298
|
+
const dow = dayNames[this.getDow()];
|
|
4299
|
+
const minutes = this.getMinutes();
|
|
4300
|
+
const hour = this.getHour();
|
|
4301
|
+
const chalakim = this.getChalakim();
|
|
4302
|
+
const moladStr = Locale.gettext('Molad', locale);
|
|
4303
|
+
const minutesStr = Locale.lookupTranslation('min', locale) || 'minutes';
|
|
4304
|
+
const chalakimStr = Locale.gettext('chalakim', locale);
|
|
4305
|
+
if (isHebrewLocale) {
|
|
4306
|
+
const ampm = hour < 5 ? night : hour < 12 ? morning : hour < 17 ? afternoon : hour < 21 ? evening : night;
|
|
4307
|
+
return `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
|
|
4308
|
+
}
|
|
4309
|
+
const fmtTime = reformatTimeStr(`${hour}:00`, 'pm', options);
|
|
4310
|
+
return `${moladStr} ${monthName}: ${dow}, ${minutes} ${minutesStr} and ${chalakim} ${chalakimStr} after ${fmtTime}`;
|
|
4311
|
+
}
|
|
4188
4312
|
}
|
|
4189
4313
|
|
|
4190
4314
|
/** Represents a Molad announcement on Shabbat Mevarchim */
|
|
@@ -4193,38 +4317,21 @@ class MoladEvent extends Event {
|
|
|
4193
4317
|
* @param {HDate} date Hebrew date event occurs
|
|
4194
4318
|
* @param {number} hyear molad year
|
|
4195
4319
|
* @param {number} hmonth molad month
|
|
4320
|
+
* @param {CalOptions} options
|
|
4196
4321
|
*/
|
|
4197
|
-
constructor(date, hyear, hmonth) {
|
|
4322
|
+
constructor(date, hyear, hmonth, options) {
|
|
4198
4323
|
const m = new Molad(hyear, hmonth);
|
|
4199
4324
|
const monthName = m.getMonthName();
|
|
4200
4325
|
super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);
|
|
4201
4326
|
this.molad = m;
|
|
4327
|
+
this.options = options;
|
|
4202
4328
|
}
|
|
4203
4329
|
/**
|
|
4204
4330
|
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
4205
4331
|
* @return {string}
|
|
4206
4332
|
*/
|
|
4207
4333
|
render(locale) {
|
|
4208
|
-
|
|
4209
|
-
locale = locale || Locale.getLocaleName();
|
|
4210
|
-
if (typeof locale === 'string') {
|
|
4211
|
-
locale = locale.toLowerCase();
|
|
4212
|
-
}
|
|
4213
|
-
const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
|
|
4214
|
-
const monthName = Locale.gettext(m.getMonthName(), locale);
|
|
4215
|
-
const dayNames = isHebrewLocale ? heDayNames : shortDayNames;
|
|
4216
|
-
const dow = dayNames[m.getDow()];
|
|
4217
|
-
const minutes = m.getMinutes();
|
|
4218
|
-
const hour = m.getHour();
|
|
4219
|
-
const chalakim = m.getChalakim();
|
|
4220
|
-
const moladStr = Locale.gettext('Molad', locale);
|
|
4221
|
-
const minutesStr = Locale.lookupTranslation('min', locale) || 'minutes';
|
|
4222
|
-
const chalakimStr = Locale.gettext('chalakim', locale);
|
|
4223
|
-
if (isHebrewLocale) {
|
|
4224
|
-
const ampm = hour < 5 ? night : hour < 12 ? morning : hour < 17 ? afternoon : hour < 21 ? evening : night;
|
|
4225
|
-
return `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` + `בְּשָׁעָה ${hour} ${ampm}, ` + `ו-${minutes} ${minutesStr} ` + `ו-${chalakim} ${chalakimStr}`;
|
|
4226
|
-
}
|
|
4227
|
-
return `${moladStr} ${monthName}: ${dow}, ${minutes} ${minutesStr} and ${chalakim} ${chalakimStr} after ${hour}:00`;
|
|
4334
|
+
return this.molad.render(locale, this.options);
|
|
4228
4335
|
}
|
|
4229
4336
|
}
|
|
4230
4337
|
|
|
@@ -5807,8 +5914,10 @@ class MevarchimChodeshEvent extends Event {
|
|
|
5807
5914
|
const hyear = date.getFullYear();
|
|
5808
5915
|
const hmonth = date.getMonth();
|
|
5809
5916
|
const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN$1 : hmonth + 1;
|
|
5810
|
-
const molad = new
|
|
5811
|
-
this.memo = molad.render('en'
|
|
5917
|
+
const molad = new Molad(hyear, monNext);
|
|
5918
|
+
this.memo = molad.render('en', {
|
|
5919
|
+
hour12: false
|
|
5920
|
+
});
|
|
5812
5921
|
}
|
|
5813
5922
|
/** @return {string} */
|
|
5814
5923
|
basename() {
|
|
@@ -6162,7 +6271,7 @@ class DailyLearning {
|
|
|
6162
6271
|
}
|
|
6163
6272
|
|
|
6164
6273
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
6165
|
-
const version = '5.0.
|
|
6274
|
+
const version = '5.0.7';
|
|
6166
6275
|
|
|
6167
6276
|
const NONE$1 = 0;
|
|
6168
6277
|
const HALF = 1;
|
|
@@ -7116,20 +7225,6 @@ function getMaskFromOptions(options) {
|
|
|
7116
7225
|
}
|
|
7117
7226
|
const MASK_LIGHT_CANDLES = LIGHT_CANDLES | LIGHT_CANDLES_TZEIS | CHANUKAH_CANDLES | YOM_TOV_ENDS;
|
|
7118
7227
|
const defaultLocation = new Location(0, 0, false, 'UTC');
|
|
7119
|
-
const hour12cc = {
|
|
7120
|
-
US: 1,
|
|
7121
|
-
CA: 1,
|
|
7122
|
-
BR: 1,
|
|
7123
|
-
AU: 1,
|
|
7124
|
-
NZ: 1,
|
|
7125
|
-
DO: 1,
|
|
7126
|
-
PR: 1,
|
|
7127
|
-
GR: 1,
|
|
7128
|
-
IN: 1,
|
|
7129
|
-
KR: 1,
|
|
7130
|
-
NP: 1,
|
|
7131
|
-
ZA: 1
|
|
7132
|
-
};
|
|
7133
7228
|
|
|
7134
7229
|
/**
|
|
7135
7230
|
* @private
|
|
@@ -7384,10 +7479,10 @@ class HebrewCalendar {
|
|
|
7384
7479
|
const hmonth = hd.getMonth();
|
|
7385
7480
|
if (options.molad && dow == SAT && hmonth != ELUL && hd.getDate() >= 23 && hd.getDate() <= 29) {
|
|
7386
7481
|
const monNext = hmonth == HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
7387
|
-
evts.push(new MoladEvent(hd, hyear, monNext));
|
|
7482
|
+
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
7388
7483
|
}
|
|
7389
7484
|
if (!candlesEv && options.candlelighting && (dow == FRI || dow == SAT)) {
|
|
7390
|
-
candlesEv = makeCandleEvent(undefined, hd, dow,
|
|
7485
|
+
candlesEv = makeCandleEvent(undefined, hd, dow, options);
|
|
7391
7486
|
if (dow === FRI && candlesEv && sedra) {
|
|
7392
7487
|
candlesEv.memo = sedra.getString(abs);
|
|
7393
7488
|
}
|
|
@@ -7554,28 +7649,7 @@ class HebrewCalendar {
|
|
|
7554
7649
|
* @return {string}
|
|
7555
7650
|
*/
|
|
7556
7651
|
static reformatTimeStr(timeStr, suffix, options) {
|
|
7557
|
-
|
|
7558
|
-
if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
7559
|
-
const cc = ((_options$location2 = options.location) === null || _options$location2 === void 0 ? void 0 : _options$location2.cc) || (options.il ? 'IL' : 'US');
|
|
7560
|
-
if (typeof options.hour12 !== 'undefined' && !options.hour12) {
|
|
7561
|
-
return timeStr;
|
|
7562
|
-
}
|
|
7563
|
-
if (!options.hour12 && typeof hour12cc[cc] === 'undefined') {
|
|
7564
|
-
return timeStr;
|
|
7565
|
-
}
|
|
7566
|
-
const hm = timeStr.split(':');
|
|
7567
|
-
let hour = parseInt(hm[0], 10);
|
|
7568
|
-
if (hour < 12 && suffix) {
|
|
7569
|
-
suffix = suffix.replace('p', 'a').replace('P', 'A');
|
|
7570
|
-
if (hour === 0) {
|
|
7571
|
-
hour = 12;
|
|
7572
|
-
}
|
|
7573
|
-
} else if (hour > 12) {
|
|
7574
|
-
hour = hour % 12;
|
|
7575
|
-
} else if (hour === 0) {
|
|
7576
|
-
hour = '00';
|
|
7577
|
-
}
|
|
7578
|
-
return `${hour}:${hm[1]}${suffix}`;
|
|
7652
|
+
return reformatTimeStr(timeStr, suffix, options);
|
|
7579
7653
|
}
|
|
7580
7654
|
|
|
7581
7655
|
/** @return {string} */
|
|
@@ -7674,7 +7748,7 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
|
|
|
7674
7748
|
if (eFlags & options.mask || !eFlags && !options.userMask) {
|
|
7675
7749
|
if (options.candlelighting && eFlags & MASK_LIGHT_CANDLES) {
|
|
7676
7750
|
const hd = ev.getDate();
|
|
7677
|
-
candlesEv = makeCandleEvent(ev, hd, dow,
|
|
7751
|
+
candlesEv = makeCandleEvent(ev, hd, dow, options);
|
|
7678
7752
|
if (eFlags & CHANUKAH_CANDLES && candlesEv && !options.noHolidays) {
|
|
7679
7753
|
const chanukahEv = dow === FRI || dow === SAT ? candlesEv : makeWeekdayChanukahCandleLighting(ev, hd, options);
|
|
7680
7754
|
const attrs = {
|
package/hebcal.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare module '@hebcal/core' {
|
|
|
28
28
|
observedIn(il: boolean): boolean;
|
|
29
29
|
clone(): Event;
|
|
30
30
|
getCategories(): string[];
|
|
31
|
-
readonly date:
|
|
31
|
+
readonly date: HDate;
|
|
32
32
|
readonly desc: string;
|
|
33
33
|
readonly mask: number;
|
|
34
34
|
readonly emoji?: string;
|
|
@@ -414,11 +414,28 @@ declare module '@hebcal/core' {
|
|
|
414
414
|
sofZmanShma(): Date;
|
|
415
415
|
/** Latest Shacharit (Gra); Sunrise plus 4 halachic hours, according to the Gra */
|
|
416
416
|
sofZmanTfilla(): Date;
|
|
417
|
-
/**
|
|
417
|
+
/**
|
|
418
|
+
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
419
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
420
|
+
* dawn being fixed 72 minutes before sea-level sunrise, and nightfall is fixed
|
|
421
|
+
* 72 minutes after sea-level sunset.
|
|
422
|
+
*/
|
|
418
423
|
sofZmanShmaMGA(): Date;
|
|
424
|
+
/**
|
|
425
|
+
* Latest Shema (MGA); Sunrise plus 3 halachic hours, according to Magen Avraham.
|
|
426
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
427
|
+
* dawn to nightfall with both being 16.1° below the horizon.
|
|
428
|
+
*/
|
|
429
|
+
sofZmanShmaMGA16Point1(): Date;
|
|
419
430
|
/** Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham */
|
|
420
431
|
sofZmanTfillaMGA(): Date;
|
|
421
432
|
/** Earliest Mincha – Mincha Gedola; Sunrise plus 6.5 halachic hours */
|
|
433
|
+
/**
|
|
434
|
+
* Latest Shacharit (MGA); Sunrise plus 4 halachic hours, according to Magen Avraham.
|
|
435
|
+
* Based on the opinion of the MGA that the day is calculated from
|
|
436
|
+
* dawn to nightfall with both being 16.1° below the horizon.
|
|
437
|
+
*/
|
|
438
|
+
sofZmanTfillaMGA16Point1(): Date;
|
|
422
439
|
minchaGedola(): Date;
|
|
423
440
|
/** Preferable earliest time to recite Minchah – Mincha Ketana; Sunrise plus 9.5 halachic hours */
|
|
424
441
|
minchaKetana(): Date;
|
|
@@ -814,6 +831,7 @@ declare module '@hebcal/core' {
|
|
|
814
831
|
* @return parts of a minute (0-17)
|
|
815
832
|
*/
|
|
816
833
|
getChalakim(): number;
|
|
834
|
+
render(locale?: string, options?: CalOptions): string;
|
|
817
835
|
}
|
|
818
836
|
|
|
819
837
|
/**
|
|
@@ -989,7 +1007,7 @@ declare module '@hebcal/core' {
|
|
|
989
1007
|
* @param desc - Description (not translated)
|
|
990
1008
|
*/
|
|
991
1009
|
export class TimedEvent extends Event {
|
|
992
|
-
constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent?: Event);
|
|
1010
|
+
constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
|
|
993
1011
|
render(locale?: string): string;
|
|
994
1012
|
renderBrief(locale?: string): string;
|
|
995
1013
|
getCategories(): string[];
|
|
@@ -999,11 +1017,11 @@ declare module '@hebcal/core' {
|
|
|
999
1017
|
readonly linkedEvent?: Event;
|
|
1000
1018
|
}
|
|
1001
1019
|
export class CandleLightingEvent extends TimedEvent {
|
|
1002
|
-
constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent?: Event);
|
|
1020
|
+
constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent?: Event, options?: CalOptions);
|
|
1003
1021
|
getEmoji(): string;
|
|
1004
1022
|
}
|
|
1005
1023
|
export class HavdalahEvent extends TimedEvent {
|
|
1006
|
-
constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins?: number, linkedEvent?: Event);
|
|
1024
|
+
constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins?: number, linkedEvent?: Event, options?: CalOptions);
|
|
1007
1025
|
render(locale?: string): string;
|
|
1008
1026
|
renderBrief(locale?: string): string;
|
|
1009
1027
|
getEmoji(): string;
|
|
@@ -1044,7 +1062,7 @@ declare module '@hebcal/core' {
|
|
|
1044
1062
|
readonly monthName: string;
|
|
1045
1063
|
}
|
|
1046
1064
|
export class MoladEvent extends Event {
|
|
1047
|
-
constructor(date: HDate, hyear: number, hmonth: number);
|
|
1065
|
+
constructor(date: HDate, hyear: number, hmonth: number, options?: CalOptions);
|
|
1048
1066
|
render(locale?: string): string;
|
|
1049
1067
|
renderBrief(locale?: string): string;
|
|
1050
1068
|
readonly molad: Molad;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.7",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"exports": {
|
|
28
28
|
"import": "./dist/index.mjs",
|
|
29
|
-
"require": "./dist/index.cjs"
|
|
29
|
+
"require": "./dist/index.cjs",
|
|
30
|
+
"types": "./hebcal.d.ts"
|
|
30
31
|
},
|
|
31
32
|
"typings": "hebcal.d.ts",
|
|
32
33
|
"engines": {
|
|
@@ -70,9 +71,9 @@
|
|
|
70
71
|
"temporal-polyfill": "^0.1.1"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
|
-
"@babel/core": "^7.23.
|
|
74
|
-
"@babel/preset-env": "^7.23.
|
|
75
|
-
"@babel/register": "^7.
|
|
74
|
+
"@babel/core": "^7.23.7",
|
|
75
|
+
"@babel/preset-env": "^7.23.7",
|
|
76
|
+
"@babel/register": "^7.23.7",
|
|
76
77
|
"@hebcal/hdate": "^0.9.1",
|
|
77
78
|
"@hebcal/noaa": "^0.8.11",
|
|
78
79
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -81,14 +82,14 @@
|
|
|
81
82
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
82
83
|
"@rollup/plugin-terser": "^0.4.4",
|
|
83
84
|
"ava": "^6.0.1",
|
|
84
|
-
"core-js": "^3.
|
|
85
|
+
"core-js": "^3.35.0",
|
|
85
86
|
"eslint": "^8.56.0",
|
|
86
87
|
"eslint-config-google": "^0.14.0",
|
|
87
88
|
"jsdoc": "^4.0.2",
|
|
88
89
|
"jsdoc-to-markdown": "^8.0.0",
|
|
89
90
|
"nyc": "^15.1.0",
|
|
90
91
|
"quick-lru": "^7.0.0",
|
|
91
|
-
"rollup": "^4.9.
|
|
92
|
+
"rollup": "^4.9.2",
|
|
92
93
|
"ttag-cli": "^1.10.10"
|
|
93
94
|
}
|
|
94
95
|
}
|