@hebcal/core 6.0.7 → 6.1.0
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/DailyLearning.d.ts +1 -1
- package/dist/HolidayEvent.d.ts +1 -0
- package/dist/ashkenazi.po.d.ts +14 -2
- package/dist/bundle.js +2086 -1536
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +17 -19
- package/dist/bundle.min.js.map +1 -1
- package/dist/coverage/block-navigation.d.ts +1 -0
- package/dist/coverage/block-navigation.js +70 -0
- package/dist/coverage/prettify.d.ts +0 -0
- package/dist/coverage/prettify.js +477 -0
- package/dist/coverage/sorter.d.ts +1 -0
- package/dist/coverage/sorter.js +176 -0
- package/dist/eslint.config.d.mts +83 -0
- package/dist/eslint.config.mjs +28 -0
- package/dist/esm/DailyLearning.d.ts +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.js +5 -5
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.d.ts +1 -0
- package/dist/esm/HolidayEvent.js +17 -1
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +2 -1
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +2 -1
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +9 -3
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +2 -1
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.d.ts +14 -2
- package/dist/esm/ashkenazi.po.js +2 -2
- package/dist/esm/ashkenazi.po.js.map +1 -1
- package/dist/esm/calendar.js +6 -8
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.js +11 -3
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/event.js +18 -1
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +2 -2
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.d.ts +1 -0
- package/dist/esm/he-x-NoNikud.po.js +2 -2
- package/dist/esm/he-x-NoNikud.po.js.map +1 -1
- package/dist/esm/he.po.d.ts +20 -0
- package/dist/esm/he.po.js +2 -2
- package/dist/esm/he.po.js.map +1 -1
- package/dist/esm/hebcal.js +3 -3
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.js +3 -3
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/locale.d.ts +1 -2
- package/dist/esm/locale.js +1 -1
- package/dist/esm/locale.js.map +1 -1
- package/dist/esm/location.js +7 -1
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +71 -1
- package/dist/esm/molad.js +113 -12
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.d.ts +15 -0
- package/dist/esm/moladBase.js +83 -0
- package/dist/esm/moladBase.js.map +1 -0
- package/dist/esm/moladDate.d.ts +12 -0
- package/dist/esm/moladDate.js +63 -0
- package/dist/esm/moladDate.js.map +1 -0
- package/dist/esm/omer.d.ts +0 -1
- package/dist/esm/omer.js +7 -4
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +2 -2
- package/dist/esm/parshaName.js.map +1 -1
- package/dist/esm/parshaYear.js +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +5 -6
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.js +13 -7
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/tachanun.js +4 -4
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +114 -1
- package/dist/esm/zmanim.js +242 -8
- package/dist/esm/zmanim.js.map +1 -1
- package/dist/he-x-NoNikud.po.d.ts +1 -0
- package/dist/he.po.d.ts +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/locale.d.ts +1 -2
- package/dist/molad.d.ts +71 -1
- package/dist/moladBase.d.ts +15 -0
- package/dist/moladDate.d.ts +12 -0
- package/dist/omer.d.ts +0 -1
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/po2json.js +3 -4
- package/dist/src/DailyLearning.d.ts +1 -1
- package/dist/src/HebrewDateEvent.js +4 -4
- package/dist/src/HolidayEvent.d.ts +1 -0
- package/dist/src/HolidayEvent.js +16 -0
- package/dist/src/MevarchimChodeshEvent.js +1 -0
- package/dist/src/ParshaEvent.js +1 -0
- package/dist/src/TimedEvent.js +8 -2
- package/dist/src/YomKippurKatanEvent.js +1 -0
- package/dist/src/ashkenazi.po.d.ts +14 -2
- package/dist/src/ashkenazi.po.js +1 -1
- package/dist/src/calendar.js +5 -7
- package/dist/src/candles.js +10 -2
- package/dist/src/event.js +17 -0
- package/dist/src/getStartAndEnd.js +1 -1
- package/dist/src/he-x-NoNikud.po.d.ts +1 -0
- package/dist/src/he-x-NoNikud.po.js +1 -1
- package/dist/src/he.po.d.ts +20 -0
- package/dist/src/he.po.js +1 -1
- package/dist/src/hebcal.js +2 -2
- package/dist/src/holidays.js +2 -2
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/locale.d.ts +1 -2
- package/dist/src/locale.js +1 -1
- package/dist/src/location.js +6 -0
- package/dist/src/molad.d.ts +71 -1
- package/dist/src/molad.js +112 -11
- package/dist/src/moladBase.d.ts +15 -0
- package/dist/src/moladBase.js +78 -0
- package/dist/src/moladDate.d.ts +12 -0
- package/dist/src/moladDate.js +58 -0
- package/dist/src/omer.d.ts +0 -1
- package/dist/src/omer.js +6 -3
- package/dist/src/parshaName.js +1 -1
- package/dist/src/pkgVersion.d.ts +1 -1
- package/dist/src/pkgVersion.js +1 -1
- package/dist/src/reformatTimeStr.js +4 -5
- package/dist/src/sedra.js +12 -6
- package/dist/src/tachanun.js +3 -3
- package/dist/src/zmanim.d.ts +114 -1
- package/dist/src/zmanim.js +240 -6
- package/dist/version.js +1 -2
- package/dist/zmanim.d.ts +114 -1
- package/package.json +17 -19
- package/dist/size-demo/dist/getHoliday.d.ts +0 -1944
- package/dist/size-demo/dist/getHoliday.js +0 -3712
- package/dist/size-demo/dist/parshiyot.js +0 -10662
- package/dist/size-demo/dist/sedra.d.ts +0 -1411
- package/dist/size-demo/dist/sedra.js +0 -2359
- package/dist/size-demo/dist/tachanun.d.ts +0 -1015
- package/dist/size-demo/dist/tachanun.js +0 -1755
- package/dist/size-demo/getHoliday.d.ts +0 -1
- package/dist/size-demo/getHoliday.js +0 -3
- package/dist/size-demo/parshiyot.d.ts +0 -1
- package/dist/size-demo/parshiyot.js +0 -11
- package/dist/size-demo/rollup.config.d.ts +0 -3
- package/dist/size-demo/rollup.config.js +0 -47
- package/dist/size-demo/sedra.d.ts +0 -1
- package/dist/size-demo/sedra.js +0 -3
- package/dist/size-demo/tachanun.d.ts +0 -1
- package/dist/size-demo/tachanun.js +0 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { HDate, isLeapYear } from '@hebcal/hdate';
|
|
2
|
+
/*
|
|
3
|
+
* Includes code ported from KosherJava, copyright 2004 Eliyahu Hershfeld,
|
|
4
|
+
* released under LGPL 2.1.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* the Jewish epoch using the RD (Rata Die/Fixed Date or Reingold Dershowitz) day used in Calendrical Calculations.
|
|
8
|
+
* Day 1 is January 1, 0001 of the Gregorian calendar
|
|
9
|
+
*/
|
|
10
|
+
const JEWISH_EPOCH = -1373429;
|
|
11
|
+
/** The number of _chalakim_ (18) in a minute. */
|
|
12
|
+
const CHALAKIM_PER_MINUTE = 18;
|
|
13
|
+
/** The number of _chalakim_ (1080) in an hour. */
|
|
14
|
+
const CHALAKIM_PER_HOUR = 1080;
|
|
15
|
+
/** The number of _chalakim_ (25,920) in a 24-hour day. */
|
|
16
|
+
const CHALAKIM_PER_DAY = 25920; // 24 * 1080
|
|
17
|
+
/** The number of _chalakim_ in an average Jewish month. A month has 29 days, 12 hours and 793
|
|
18
|
+
* _chalakim_ (44 minutes and 3.3 seconds) for a total of 765,433 _chalakim_ */
|
|
19
|
+
const CHALAKIM_PER_MONTH = 765433; // (29 * 24 + 12) * 1080 + 793
|
|
20
|
+
/**
|
|
21
|
+
* Days from the beginning of Sunday till _molad BaHaRaD_. Calculated as 1 day, 5 hours and 204 _chalakim_ =
|
|
22
|
+
* (24 + 5) * 1080 + 204 = 31524
|
|
23
|
+
*/
|
|
24
|
+
const CHALAKIM_MOLAD_TOHU = 31524;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the NISSAN-based constants used by this class to numeric month starting from
|
|
27
|
+
* TISHREI. This is required for _molad_ calculations.
|
|
28
|
+
*/
|
|
29
|
+
function getJewishMonthOfYear(year, month) {
|
|
30
|
+
const leap = isLeapYear(year);
|
|
31
|
+
return ((month + (leap ? 6 : 5)) % (leap ? 13 : 12)) + 1;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the number of _chalakim_ (parts - 1080 to the hour) from
|
|
35
|
+
* the original hypothetical _Molad Tohu_ to the year and month
|
|
36
|
+
* passed in.
|
|
37
|
+
*/
|
|
38
|
+
function getChalakimSinceMoladTohu(year, month) {
|
|
39
|
+
// Jewish lunar month = 29 days, 12 hours and 793 chalakim
|
|
40
|
+
// chalakim since Molad Tohu BeHaRaD - 1 day, 5 hours and 204 chalakim
|
|
41
|
+
const monthOfYear = getJewishMonthOfYear(year, month);
|
|
42
|
+
const monthsElapsed = 235 * Math.trunc((year - 1) / 19) + // Months in complete 19-year lunar (Metonic) cycles so far
|
|
43
|
+
12 * ((year - 1) % 19) + // Regular months in this cycle
|
|
44
|
+
Math.trunc((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle
|
|
45
|
+
(monthOfYear - 1); // add elapsed months till the start of the molad of the month
|
|
46
|
+
// return chalakim prior to BeHaRaD + number of chalakim since
|
|
47
|
+
return CHALAKIM_MOLAD_TOHU + CHALAKIM_PER_MONTH * monthsElapsed;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the number of days from the Jewish epoch from the number of chalakim from the epoch passed in.
|
|
51
|
+
* @param chalakim the number of _chalakim_ since the beginning of Sunday prior to BaHaRaD
|
|
52
|
+
* @return the number of days from the Jewish epoch
|
|
53
|
+
*/
|
|
54
|
+
function moladToAbsDate(chalakim) {
|
|
55
|
+
return Math.trunc(chalakim / CHALAKIM_PER_DAY) + JEWISH_EPOCH;
|
|
56
|
+
}
|
|
57
|
+
export function calculateMolad(year, month) {
|
|
58
|
+
const chalakim = getChalakimSinceMoladTohu(year, month);
|
|
59
|
+
const absDate = moladToAbsDate(chalakim);
|
|
60
|
+
let hd = new HDate(absDate);
|
|
61
|
+
const conjunctionDay = Math.trunc(chalakim / CHALAKIM_PER_DAY);
|
|
62
|
+
const conjunctionParts = Math.trunc(chalakim - conjunctionDay * CHALAKIM_PER_DAY);
|
|
63
|
+
let adjustedChalakim = conjunctionParts;
|
|
64
|
+
let hour = Math.trunc(adjustedChalakim / CHALAKIM_PER_HOUR);
|
|
65
|
+
adjustedChalakim = adjustedChalakim - hour * CHALAKIM_PER_HOUR;
|
|
66
|
+
const minutes = Math.trunc(adjustedChalakim / CHALAKIM_PER_MINUTE);
|
|
67
|
+
if (hour >= 6) {
|
|
68
|
+
hd = hd.next();
|
|
69
|
+
}
|
|
70
|
+
hour = (hour + 18) % 24;
|
|
71
|
+
const m = {
|
|
72
|
+
hdate: hd,
|
|
73
|
+
hour,
|
|
74
|
+
minutes,
|
|
75
|
+
chalakim: adjustedChalakim - minutes * CHALAKIM_PER_MINUTE,
|
|
76
|
+
};
|
|
77
|
+
return m;
|
|
78
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'temporal-polyfill/global';
|
|
2
|
+
import { MoladBase } from './moladBase';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the molad in UTC as a Temporal.ZonedDateTime.
|
|
5
|
+
* This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
|
|
6
|
+
* of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method
|
|
7
|
+
* intentionally uses standard time and not daylight savings time.
|
|
8
|
+
*
|
|
9
|
+
* @return the ZonedDateTime representing the moment of the molad in UTC
|
|
10
|
+
|
|
11
|
+
*/
|
|
12
|
+
export declare function getMoladAsDate(molad: MoladBase): Temporal.ZonedDateTime;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import 'temporal-polyfill/global';
|
|
2
|
+
import { getTimezoneOffset } from '@hebcal/hdate';
|
|
3
|
+
/** constant for milliseconds in a minute (60,000) */
|
|
4
|
+
const MINUTE_MILLIS = 60 * 1000;
|
|
5
|
+
/**
|
|
6
|
+
* A method that will return the location's local mean time offset in milliseconds from local <a
|
|
7
|
+
* href="https://en.wikipedia.org/wiki/Standard_time">standard time</a>. The globe is split into 360°, with
|
|
8
|
+
* 15° per hour of the day. For a local that is at a longitude that is evenly divisible by 15 (longitude % 15 ==
|
|
9
|
+
* 0), at solar {@link com.kosherjava.zmanim.AstronomicalCalendar#getSunTransit() noon} (with adjustment for the <a
|
|
10
|
+
* href="https://en.wikipedia.org/wiki/Equation_of_time">equation of time</a>) the sun should be directly overhead,
|
|
11
|
+
* so a user who is 1° west of this will have noon at 4 minutes after standard time noon, and conversely, a user
|
|
12
|
+
* who is 1° east of the 15° longitude will have noon at 11:56 AM. Lakewood, N.J., whose longitude is
|
|
13
|
+
* -74.222, is 0.778 away from the closest multiple of 15 at -75°. This is multiplied by 4 to yield 3 minutes
|
|
14
|
+
* and 10 seconds earlier than standard time. The offset returned does not account for the <a
|
|
15
|
+
* href="https://en.wikipedia.org/wiki/Daylight_saving_time">Daylight saving time</a> offset since this class is
|
|
16
|
+
* unaware of dates.
|
|
17
|
+
*
|
|
18
|
+
* @return the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned
|
|
19
|
+
* East of the 15° timezone line, and a negative value West of it.
|
|
20
|
+
*/
|
|
21
|
+
function getLocalMeanTimeOffset(dt, longitude, tzid) {
|
|
22
|
+
const offset = -1 * getTimezoneOffset(tzid, dt);
|
|
23
|
+
const d = longitude * 4 * MINUTE_MILLIS - offset * MINUTE_MILLIS;
|
|
24
|
+
return Math.trunc(d);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the molad in UTC as a Temporal.ZonedDateTime.
|
|
28
|
+
* This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
|
|
29
|
+
* of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method
|
|
30
|
+
* intentionally uses standard time and not daylight savings time.
|
|
31
|
+
*
|
|
32
|
+
* @return the ZonedDateTime representing the moment of the molad in UTC
|
|
33
|
+
|
|
34
|
+
*/
|
|
35
|
+
export function getMoladAsDate(molad) {
|
|
36
|
+
const moladSeconds = (molad.chalakim * 10) / 3;
|
|
37
|
+
const millis = Math.trunc(1000 * (moladSeconds - Math.trunc(moladSeconds)));
|
|
38
|
+
const dt = molad.hdate.greg();
|
|
39
|
+
// The raw molad Date (point in time) must be generated using standard time. Using "Asia/Jerusalem" timezone will result in the time
|
|
40
|
+
// being incorrectly off by an hour in the summer due to DST. Proper adjustment for the actual time in DST will be done by the date
|
|
41
|
+
// formatter class used to display the Date.
|
|
42
|
+
const tzid = 'Etc/GMT+2';
|
|
43
|
+
const zdt = Temporal.ZonedDateTime.from({
|
|
44
|
+
year: dt.getFullYear(),
|
|
45
|
+
month: dt.getMonth() + 1,
|
|
46
|
+
day: dt.getDate(),
|
|
47
|
+
hour: molad.hour,
|
|
48
|
+
minute: molad.minutes,
|
|
49
|
+
second: Math.trunc(moladSeconds),
|
|
50
|
+
millisecond: millis,
|
|
51
|
+
timeZone: tzid,
|
|
52
|
+
});
|
|
53
|
+
const longitude = 35.2354; // Har Habayis longitude
|
|
54
|
+
const offset = getLocalMeanTimeOffset(dt, longitude, tzid);
|
|
55
|
+
// subtract local time difference of 20.94 minutes (20 minutes and 56.496 seconds) to get to Standard time
|
|
56
|
+
const zdt2 = zdt.subtract({ milliseconds: offset });
|
|
57
|
+
return zdt2.withTimeZone('UTC');
|
|
58
|
+
}
|
package/dist/src/omer.d.ts
CHANGED
package/dist/src/omer.js
CHANGED
|
@@ -75,7 +75,7 @@ function omerTodayIsEn(omerDay) {
|
|
|
75
75
|
const day7 = daysWithinWeeks === 7;
|
|
76
76
|
const numWeeks = day7 ? weekNumber : weekNumber - 1;
|
|
77
77
|
const weeksStr = numWeeks === 1 ? 'week' : 'weeks';
|
|
78
|
-
str += `, which
|
|
78
|
+
str += `, which are ${numWeeks} ${weeksStr}`;
|
|
79
79
|
if (!day7) {
|
|
80
80
|
const daysStr = daysWithinWeeks === 1 ? 'day' : 'days';
|
|
81
81
|
str += ` and ${daysWithinWeeks} ${daysStr}`;
|
|
@@ -185,6 +185,9 @@ function omerTodayIsHe(omerDay) {
|
|
|
185
185
|
}
|
|
186
186
|
/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
|
|
187
187
|
export class OmerEvent extends Event {
|
|
188
|
+
weekNumber;
|
|
189
|
+
daysWithinWeeks;
|
|
190
|
+
omer;
|
|
188
191
|
/**
|
|
189
192
|
* @param date
|
|
190
193
|
* @param omerDay
|
|
@@ -225,7 +228,7 @@ export class OmerEvent extends Event {
|
|
|
225
228
|
* @param [locale] Optional locale name (defaults to empty locale)
|
|
226
229
|
*/
|
|
227
230
|
render(locale) {
|
|
228
|
-
locale = locale
|
|
231
|
+
locale = locale ?? 'en';
|
|
229
232
|
if (typeof locale === 'string') {
|
|
230
233
|
locale = locale.toLowerCase();
|
|
231
234
|
}
|
|
@@ -281,7 +284,7 @@ export class OmerEvent extends Event {
|
|
|
281
284
|
* or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
|
|
282
285
|
*/
|
|
283
286
|
getTodayIs(locale) {
|
|
284
|
-
locale = locale
|
|
287
|
+
locale = locale ?? 'en';
|
|
285
288
|
if (typeof locale === 'string') {
|
|
286
289
|
locale = locale.toLowerCase();
|
|
287
290
|
}
|
package/dist/src/parshaName.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Locale } from './locale';
|
|
2
2
|
/** @private */
|
|
3
3
|
export function renderParshaName(parsha, locale) {
|
|
4
|
-
const locale0 = locale
|
|
4
|
+
const locale0 = locale ?? 'en';
|
|
5
5
|
let name = Locale.gettext(parsha[0], locale0);
|
|
6
6
|
if (parsha.length === 2) {
|
|
7
7
|
const hyphen = locale0 === 'he' ? '־' : '-';
|
package/dist/src/pkgVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export declare const version = "6.0
|
|
2
|
+
export declare const version = "6.1.0";
|
package/dist/src/pkgVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export const version = '6.0
|
|
2
|
+
export const version = '6.1.0';
|
|
@@ -19,15 +19,14 @@ const hour12cc = {
|
|
|
19
19
|
* @param options
|
|
20
20
|
*/
|
|
21
21
|
export function reformatTimeStr(timeStr, suffix, options) {
|
|
22
|
-
var _a;
|
|
23
22
|
if (typeof timeStr !== 'string')
|
|
24
23
|
throw new TypeError(`Bad timeStr: ${timeStr}`);
|
|
25
|
-
const cc =
|
|
26
|
-
const hour12 = options
|
|
27
|
-
if (
|
|
24
|
+
const cc = options?.location?.getCountryCode() || (options?.il ? 'IL' : 'US');
|
|
25
|
+
const hour12 = options?.hour12;
|
|
26
|
+
if (hour12 !== undefined && !hour12) {
|
|
28
27
|
return timeStr;
|
|
29
28
|
}
|
|
30
|
-
if (!hour12 &&
|
|
29
|
+
if (!hour12 && hour12cc[cc] === undefined) {
|
|
31
30
|
return timeStr;
|
|
32
31
|
}
|
|
33
32
|
const hm = timeStr.split(':');
|
package/dist/src/sedra.js
CHANGED
|
@@ -52,6 +52,12 @@ function yearType(hyear) {
|
|
|
52
52
|
* Represents Parashah HaShavua for an entire Hebrew year
|
|
53
53
|
*/
|
|
54
54
|
export class Sedra {
|
|
55
|
+
year;
|
|
56
|
+
il;
|
|
57
|
+
rh;
|
|
58
|
+
firstSaturday;
|
|
59
|
+
theSedraArray;
|
|
60
|
+
yearKey;
|
|
55
61
|
/**
|
|
56
62
|
* Caculates the Parashah HaShavua for an entire Hebrew year
|
|
57
63
|
* @param hyear - Hebrew year (e.g. 5749)
|
|
@@ -103,7 +109,7 @@ export class Sedra {
|
|
|
103
109
|
if (typeof num === 'number') {
|
|
104
110
|
return this.find(num);
|
|
105
111
|
}
|
|
106
|
-
else if (parsha.
|
|
112
|
+
else if (parsha.includes('-')) {
|
|
107
113
|
if (parsha === CHMPESACH || parsha === CHMSUKOT) {
|
|
108
114
|
return this.findInternal(parsha);
|
|
109
115
|
}
|
|
@@ -219,7 +225,7 @@ export class Sedra {
|
|
|
219
225
|
const saturday = HDate.dayOnOrBefore(6, abs + 6);
|
|
220
226
|
const weekNum = (saturday - this.firstSaturday) / 7;
|
|
221
227
|
const index = this.theSedraArray[weekNum];
|
|
222
|
-
if (
|
|
228
|
+
if (index === undefined) {
|
|
223
229
|
const sedra = getSedra(this.year + 1, this.il);
|
|
224
230
|
return sedra.lookup(saturday); // must be next year
|
|
225
231
|
}
|
|
@@ -319,7 +325,7 @@ for (let id = 0; id < parshiot.length; id++) {
|
|
|
319
325
|
parsha2id.set(name, id);
|
|
320
326
|
}
|
|
321
327
|
// 0-based parsha IDs
|
|
322
|
-
const doubles = [
|
|
328
|
+
const doubles = new Set([
|
|
323
329
|
21, // Vayakhel-Pekudei
|
|
324
330
|
26, // Tazria-Metzora
|
|
325
331
|
28, // Achrei Mot-Kedoshim
|
|
@@ -327,13 +333,13 @@ const doubles = [
|
|
|
327
333
|
38, // Chukat-Balak
|
|
328
334
|
41, // Matot-Masei
|
|
329
335
|
50, // Nitzavim-Vayeilech
|
|
330
|
-
];
|
|
336
|
+
]);
|
|
331
337
|
/**
|
|
332
338
|
* @private
|
|
333
339
|
* @param id a negative number
|
|
334
340
|
*/
|
|
335
341
|
function isValidDouble(id) {
|
|
336
|
-
return doubles.
|
|
342
|
+
return doubles.has(-id);
|
|
337
343
|
}
|
|
338
344
|
/**
|
|
339
345
|
* parsha doubler/undoubler
|
|
@@ -459,7 +465,7 @@ types['1311'] = types['1221'];
|
|
|
459
465
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
460
466
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
461
467
|
types['1721'] = types['170'];
|
|
462
|
-
const sedraCache = new QuickLRU({ maxSize:
|
|
468
|
+
const sedraCache = new QuickLRU({ maxSize: 120 });
|
|
463
469
|
/**
|
|
464
470
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
465
471
|
* created and cached instance.
|
package/dist/src/tachanun.js
CHANGED
|
@@ -35,7 +35,7 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
35
35
|
const year = hdate.yy;
|
|
36
36
|
const dates = tachanunYear(year, il);
|
|
37
37
|
const abs = hdate.abs();
|
|
38
|
-
if (dates.none.
|
|
38
|
+
if (dates.none.includes(abs)) {
|
|
39
39
|
return NONE;
|
|
40
40
|
}
|
|
41
41
|
const dow = hdate.getDay();
|
|
@@ -44,14 +44,14 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
44
44
|
mincha: false,
|
|
45
45
|
allCongs: false,
|
|
46
46
|
};
|
|
47
|
-
if (dates.some.
|
|
47
|
+
if (!dates.some.includes(abs)) {
|
|
48
48
|
ret.allCongs = true;
|
|
49
49
|
}
|
|
50
50
|
if (dow !== 6) {
|
|
51
51
|
ret.shacharit = true;
|
|
52
52
|
}
|
|
53
53
|
const tomorrow = abs + 1;
|
|
54
|
-
if (checkNext && dates.yesPrev.
|
|
54
|
+
if (checkNext && !dates.yesPrev.includes(tomorrow)) {
|
|
55
55
|
const tmp = tachanun0(new HDate(tomorrow), il, false);
|
|
56
56
|
ret.mincha = tmp.shacharit;
|
|
57
57
|
}
|
package/dist/src/zmanim.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { HDate } from '@hebcal/hdate';
|
|
|
28
28
|
* const timeStr = Zmanim.formatISOWithTimeZone(tzid, candleLighting);
|
|
29
29
|
*/
|
|
30
30
|
export declare class Zmanim {
|
|
31
|
-
private readonly
|
|
31
|
+
private readonly plainDate;
|
|
32
32
|
private readonly gloc;
|
|
33
33
|
private readonly noaa;
|
|
34
34
|
private useElevation;
|
|
@@ -123,6 +123,7 @@ export declare class Zmanim {
|
|
|
123
123
|
* sea level sunrise.
|
|
124
124
|
*/
|
|
125
125
|
alotHaShachar72(): Date;
|
|
126
|
+
alotHaShachar72zdt(): Temporal.ZonedDateTime | null;
|
|
126
127
|
/**
|
|
127
128
|
* Earliest talis & tefillin – Misheyakir; Sun is 11.5° below the horizon in the morning.
|
|
128
129
|
* Because degree-based functions estimate the amount of light in the sky,
|
|
@@ -265,6 +266,7 @@ export declare class Zmanim {
|
|
|
265
266
|
* the result is not impacted by elevation.
|
|
266
267
|
*/
|
|
267
268
|
tzeit(angle?: number): Date;
|
|
269
|
+
tzeit72(): Temporal.ZonedDateTime | null;
|
|
268
270
|
/**
|
|
269
271
|
* Alias for sunrise
|
|
270
272
|
*/
|
|
@@ -282,6 +284,117 @@ export declare class Zmanim {
|
|
|
282
284
|
* the result is not impacted by elevation.
|
|
283
285
|
*/
|
|
284
286
|
beinHaShmashos(): Date;
|
|
287
|
+
/**
|
|
288
|
+
* Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
|
|
289
|
+
* @return previous midnight
|
|
290
|
+
*/
|
|
291
|
+
private getMidnightLastNight;
|
|
292
|
+
/**
|
|
293
|
+
* Used by Molad based _zmanim_ to determine if _zmanim_ occur during the current day.
|
|
294
|
+
* @return following midnight
|
|
295
|
+
*/
|
|
296
|
+
private getMidnightTonight;
|
|
297
|
+
/**
|
|
298
|
+
* Returns the Date of the _molad_ based time if it occurs on the current date. Since _Kiddush Levana_
|
|
299
|
+
* can only be said during the day, there are parameters to limit it to between _alos_ and _tzais_. If
|
|
300
|
+
* the time occurs between _alos_ and _tzais_, _tzais_ will be returned.
|
|
301
|
+
*
|
|
302
|
+
* @param moladBasedTime
|
|
303
|
+
* the _molad_ based time such as _molad_, _tchilas_ and _sof zman Kiddush Levana_
|
|
304
|
+
* @param alos
|
|
305
|
+
* optional start of day to limit _molad_ times to the end of the night before or beginning of the next night.
|
|
306
|
+
* Ignored if either _alos_ or _tzais_ are null.
|
|
307
|
+
* @param tzais
|
|
308
|
+
* optional end of day to limit _molad_ times to the end of the night before or beginning of the next night.
|
|
309
|
+
* Ignored if either _tzais_ or _alos_ are null
|
|
310
|
+
* @param techila
|
|
311
|
+
* is it the start of _Kiddush Levana_ time or the end? If it is start roll it to the next _tzais_,
|
|
312
|
+
* and if it is the end, return the end of the previous night (_alos_ passed in). Ignored if either
|
|
313
|
+
* _alos_ or _tzais_ are null.
|
|
314
|
+
* @return the _molad_ based time. If the _zman_ does not occur during the current date, <code>null</code> will be
|
|
315
|
+
* returned.
|
|
316
|
+
*/
|
|
317
|
+
private getMoladBasedTime;
|
|
318
|
+
private getHDate;
|
|
319
|
+
/**
|
|
320
|
+
* Returns the latest time of Kiddush Levana according to the <a
|
|
321
|
+
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
|
|
322
|
+
* halfway between _molad_ and _molad_. This adds half the 29 days, 12 hours and 793 chalakim time between
|
|
323
|
+
* _molad_ and _molad_ (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's _molad_.
|
|
324
|
+
* The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to between
|
|
325
|
+
* _tzais_ and _alos_, see {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date)}.
|
|
326
|
+
*
|
|
327
|
+
* @param alos
|
|
328
|
+
* the beginning of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and
|
|
329
|
+
* ending at _tzais_), the time returned will be alos. If either the _alos_ or _tzais_ parameters
|
|
330
|
+
* are null, no daytime adjustment will be made.
|
|
331
|
+
* @param tzais
|
|
332
|
+
* the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at
|
|
333
|
+
* tzais), the time returned will be alos. If either the alos or tzais parameters are null, no daytime
|
|
334
|
+
* adjustment will be made.
|
|
335
|
+
* @return the Date representing the moment halfway between molad and molad. If the time occurs between
|
|
336
|
+
* _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this
|
|
337
|
+
* day, a <code>null</code> will be returned.
|
|
338
|
+
*/
|
|
339
|
+
getSofZmanKidushLevanaBetweenMoldos(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
|
|
340
|
+
/**
|
|
341
|
+
* Returns the latest time of _Kiddush Levana_ calculated as 15 days after the molad. This is the opinion of
|
|
342
|
+
* the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
|
|
343
|
+
* <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
|
|
344
|
+
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
|
|
345
|
+
* {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date) half way between _molad_ and _molad_} is of
|
|
346
|
+
* the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject,
|
|
347
|
+
* See Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of <a href="https://hebrewbooks.org/53000">Shaarei
|
|
348
|
+
* Zmanim</a>. The _sof zman Kiddush Levana_ will be returned even if it occurs during the day. To limit the time to
|
|
349
|
+
* between _tzais_ and _alos_, see {@link #getSofZmanKidushLevana15Days(Date, Date)}.
|
|
350
|
+
*
|
|
351
|
+
* @return the Date representing the moment 15 days after the _molad_. If the time occurs between
|
|
352
|
+
* _alos_ and _tzais_, _alos_ will be returned. If the _zman_ will not occur on this day, a
|
|
353
|
+
* <code>null</code> will be returned.
|
|
354
|
+
*
|
|
355
|
+
*
|
|
356
|
+
*/
|
|
357
|
+
getSofZmanKidushLevana15Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
|
|
358
|
+
/**
|
|
359
|
+
* Returns the earliest time of _Kiddush Levana_ according to <a href=
|
|
360
|
+
* "https://en.wikipedia.org/wiki/Yonah_Gerondi">Rabbeinu Yonah</a>'s opinion that it can be said 3 days after the _molad_.
|
|
361
|
+
* If the time of _tchilas zman Kiddush Levana_ occurs during the day (between _alos_ and _tzais_ passed to
|
|
362
|
+
* this method) it will return the following _tzais_. If null is passed for either _alos_ or _tzais_, the actual
|
|
363
|
+
* _tchilas zman Kiddush Levana_ will be returned, regardless of if it is during the day or not.
|
|
364
|
+
*
|
|
365
|
+
* @param alos
|
|
366
|
+
* the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at _alos_ and ending
|
|
367
|
+
* at _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
|
|
368
|
+
* are null, no daytime adjustment will be made.
|
|
369
|
+
* @param tzais
|
|
370
|
+
* the end of the Jewish day. If _Kidush Levana_ occurs during the day (starting at _alos_ and ending at
|
|
371
|
+
* _tzais_), the time returned will be _tzais_. If either the _alos_ or _tzais_ parameters
|
|
372
|
+
* are null, no daytime adjustment will be made.
|
|
373
|
+
*
|
|
374
|
+
* @return the Date representing the moment 3 days after the molad. If the time occurs between _alos_ and
|
|
375
|
+
* _tzais_, _tzais_ will be returned. If the _zman_ will not occur on this day, a
|
|
376
|
+
* <code>null</code> will be returned.
|
|
377
|
+
*/
|
|
378
|
+
getTchilasZmanKidushLevana3Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
|
|
379
|
+
/**
|
|
380
|
+
* Returns the point in time of _Molad_ as a <code>Date</code> Object. For the traditional day of week, hour,
|
|
381
|
+
* minute and chalakim, {@link Molad.getInstant()} and the not yet completed
|
|
382
|
+
* {@link HebrewDateFormatter} that will have formatting for this.
|
|
383
|
+
*
|
|
384
|
+
* @return the Date representing the moment of the molad. If the _molad_ does not occur on this day, a
|
|
385
|
+
* <code>null</code> will be returned.
|
|
386
|
+
*
|
|
387
|
+
*/
|
|
388
|
+
getZmanMolad(): Temporal.ZonedDateTime | null;
|
|
389
|
+
/**
|
|
390
|
+
* Returns the earliest time of _Kiddush Levana_ according to the opinions that it should not be said until 7
|
|
391
|
+
* days after the _molad_. The time will be returned even if it occurs during the day when _Kiddush Levana_
|
|
392
|
+
* can't be recited. Use {@link #getTchilasZmanKidushLevana7Days(Date, Date)} if you want to limit the time to night hours.
|
|
393
|
+
*
|
|
394
|
+
* @return the Date representing the moment 7 days after the molad regardless of it is day or night. If the _zman_
|
|
395
|
+
* will not occur on this day, a <code>null</code> will be returned.
|
|
396
|
+
*/
|
|
397
|
+
getTchilasZmanKidushLevana7Days(alos?: Temporal.ZonedDateTime | null, tzais?: Temporal.ZonedDateTime | null): Temporal.ZonedDateTime | null;
|
|
285
398
|
/**
|
|
286
399
|
* Uses timeFormat to return a date like '20:34'.
|
|
287
400
|
* Returns `XX:XX` if the date is invalid.
|