@hebcal/core 6.5.3 → 6.7.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/README.md +4 -4
- package/dist/bundle.js +6525 -5562
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -18
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +15 -3
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.js +7 -6
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +3 -2
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +18 -7
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +3 -2
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +2 -2
- package/dist/esm/ashkenazi.po.js.map +1 -1
- package/dist/esm/calendar.js +14 -20
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +8 -3
- package/dist/esm/candles.js +65 -11
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.d.ts +0 -1
- package/dist/esm/he.po.js +2 -2
- package/dist/esm/he.po.js.map +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.js +1 -1
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +1 -1
- package/dist/esm/molad.js +4 -3
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.d.ts +1 -1
- package/dist/esm/moladDate.js +2 -2
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +3 -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 +1 -1
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +14 -0
- package/dist/esm/sedra.js +62 -1
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/string.d.ts +2 -0
- package/dist/esm/string.js +10 -0
- package/dist/esm/string.js.map +1 -0
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +1 -1
- package/dist/esm/zmanim.js +3 -4
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +18 -21
- package/po/ashkenazi.po +1 -12
- package/po/he.po +0 -3
- package/dist/eslint.config.d.mts +0 -83
- package/dist/eslint.config.mjs +0 -29
- package/dist/esm/temporal-shim.d.ts +0 -1
- package/dist/esm/temporal-shim.js +0 -11
- package/dist/esm/temporal-shim.js.map +0 -1
- package/dist/po2json.d.ts +0 -1
- package/dist/po2json.js +0 -40
- package/dist/src/CalOptions.d.ts +0 -171
- package/dist/src/CalOptions.js +0 -1
- package/dist/src/DailyLearning.d.ts +0 -69
- package/dist/src/DailyLearning.js +0 -92
- package/dist/src/HebrewDateEvent.d.ts +0 -37
- package/dist/src/HebrewDateEvent.js +0 -72
- package/dist/src/HolidayEvent.d.ts +0 -117
- package/dist/src/HolidayEvent.js +0 -235
- package/dist/src/MevarchimChodeshEvent.d.ts +0 -26
- package/dist/src/MevarchimChodeshEvent.js +0 -51
- package/dist/src/ParshaEvent.d.ts +0 -24
- package/dist/src/ParshaEvent.js +0 -49
- package/dist/src/TimedEvent.d.ts +0 -76
- package/dist/src/TimedEvent.js +0 -134
- package/dist/src/YomKippurKatanEvent.d.ts +0 -23
- package/dist/src/YomKippurKatanEvent.js +0 -39
- package/dist/src/ashkenazi.po.d.ts +0 -84
- package/dist/src/ashkenazi.po.js +0 -1
- package/dist/src/calendar.d.ts +0 -112
- package/dist/src/calendar.js +0 -721
- package/dist/src/candles.d.ts +0 -57
- package/dist/src/candles.js +0 -185
- package/dist/src/cities.json +0 -67
- package/dist/src/event.d.ts +0 -233
- package/dist/src/event.js +0 -295
- package/dist/src/getStartAndEnd.d.ts +0 -6
- package/dist/src/getStartAndEnd.js +0 -105
- package/dist/src/hallel.d.ts +0 -6
- package/dist/src/hallel.js +0 -39
- package/dist/src/he-x-NoNikud.po.d.ts +0 -28
- package/dist/src/he-x-NoNikud.po.js +0 -1
- package/dist/src/he.po.d.ts +0 -218
- package/dist/src/he.po.js +0 -1
- package/dist/src/hebcal.d.ts +0 -338
- package/dist/src/hebcal.js +0 -413
- package/dist/src/holidays.d.ts +0 -41
- package/dist/src/holidays.js +0 -324
- package/dist/src/index.d.ts +0 -30
- package/dist/src/index.js +0 -29
- package/dist/src/isAssurBemlacha.d.ts +0 -29
- package/dist/src/isAssurBemlacha.js +0 -82
- package/dist/src/isAveilut.d.ts +0 -22
- package/dist/src/isAveilut.js +0 -48
- package/dist/src/isFastDay.d.ts +0 -21
- package/dist/src/isFastDay.js +0 -31
- package/dist/src/locale.d.ts +0 -1
- package/dist/src/locale.js +0 -11
- package/dist/src/location.d.ts +0 -167
- package/dist/src/location.js +0 -342
- package/dist/src/modern.d.ts +0 -18
- package/dist/src/modern.js +0 -59
- package/dist/src/molad.d.ts +0 -164
- package/dist/src/molad.js +0 -297
- package/dist/src/moladBase.d.ts +0 -15
- package/dist/src/moladBase.js +0 -78
- package/dist/src/moladDate.d.ts +0 -12
- package/dist/src/moladDate.js +0 -58
- package/dist/src/omer.d.ts +0 -128
- package/dist/src/omer.js +0 -385
- package/dist/src/parshaName.d.ts +0 -2
- package/dist/src/parshaName.js +0 -12
- package/dist/src/parshaYear.d.ts +0 -20
- package/dist/src/parshaYear.js +0 -35
- package/dist/src/pkgVersion.d.ts +0 -2
- package/dist/src/pkgVersion.js +0 -2
- package/dist/src/reformatTimeStr.d.ts +0 -8
- package/dist/src/reformatTimeStr.js +0 -47
- package/dist/src/sedra.d.ts +0 -175
- package/dist/src/sedra.js +0 -563
- package/dist/src/sefira.json +0 -63
- package/dist/src/staticHolidays.d.ts +0 -192
- package/dist/src/staticHolidays.js +0 -637
- package/dist/src/tachanun.d.ts +0 -29
- package/dist/src/tachanun.js +0 -120
- package/dist/src/temporal-shim.d.ts +0 -1
- package/dist/src/temporal-shim.js +0 -8
- package/dist/src/zmanim.d.ts +0 -620
- package/dist/src/zmanim.js +0 -1003
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -8
package/dist/src/molad.d.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import './temporal-shim';
|
|
2
|
-
import { Event } from './event';
|
|
3
|
-
import { CalOptions } from './CalOptions';
|
|
4
|
-
import { HDate } from '@hebcal/hdate';
|
|
5
|
-
import './locale';
|
|
6
|
-
/**
|
|
7
|
-
* Represents a *molad* — the calculated moment when the new moon is "born"
|
|
8
|
-
* for a given Hebrew month.
|
|
9
|
-
*
|
|
10
|
-
* The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat
|
|
11
|
-
* before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.
|
|
12
|
-
* Calculations use the traditional chalakim arithmetic
|
|
13
|
-
* (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* import {Molad, months} from '@hebcal/core';
|
|
17
|
-
* const m = new Molad(5784, months.NISAN);
|
|
18
|
-
* console.log(m.getMonthName()); // 'Nisan'
|
|
19
|
-
* console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12
|
|
20
|
-
* console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'
|
|
21
|
-
*/
|
|
22
|
-
export declare class Molad {
|
|
23
|
-
private readonly m;
|
|
24
|
-
private readonly year;
|
|
25
|
-
private readonly month;
|
|
26
|
-
private instant?;
|
|
27
|
-
/**
|
|
28
|
-
* Calculates the molad for a given Hebrew year and month.
|
|
29
|
-
* @param year Hebrew year
|
|
30
|
-
* @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)
|
|
31
|
-
*/
|
|
32
|
-
constructor(year: number, month: number);
|
|
33
|
-
/**
|
|
34
|
-
* The exact Hebrew date of the molad, which often falls on the
|
|
35
|
-
* 28th or 30th of the preceeding month, occasionally on the first of the
|
|
36
|
-
* month, and in extremely rare circumstances the 27th of the month.
|
|
37
|
-
* - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z
|
|
38
|
-
* - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z
|
|
39
|
-
* - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z
|
|
40
|
-
*/
|
|
41
|
-
getMoladDate(): HDate;
|
|
42
|
-
/**
|
|
43
|
-
* The year of the molad (as constructed)
|
|
44
|
-
*/
|
|
45
|
-
getYear(): number;
|
|
46
|
-
/**
|
|
47
|
-
* The month (1=NISSAN, 7=TISHREI) as constructed
|
|
48
|
-
*/
|
|
49
|
-
getMonth(): number;
|
|
50
|
-
/**
|
|
51
|
-
* Returns a transliterated string name of the molad's Hebrew month,
|
|
52
|
-
* for example 'Elul' or 'Cheshvan'.
|
|
53
|
-
*/
|
|
54
|
-
getMonthName(): string;
|
|
55
|
-
/**
|
|
56
|
-
* @returns Day of Week (0=Sunday, 6=Saturday)
|
|
57
|
-
*/
|
|
58
|
-
getDow(): number;
|
|
59
|
-
/**
|
|
60
|
-
* @returns hour of day (0-23)
|
|
61
|
-
*/
|
|
62
|
-
getHour(): number;
|
|
63
|
-
/**
|
|
64
|
-
* @returns minutes past hour (0-59)
|
|
65
|
-
*/
|
|
66
|
-
getMinutes(): number;
|
|
67
|
-
/**
|
|
68
|
-
* @returns parts of a minute (0-17)
|
|
69
|
-
*/
|
|
70
|
-
getChalakim(): number;
|
|
71
|
-
/**
|
|
72
|
-
* Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.
|
|
73
|
-
* This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
|
|
74
|
-
* of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method
|
|
75
|
-
* intentionally uses standard time and not daylight savings time.
|
|
76
|
-
*
|
|
77
|
-
* The returned value is cached after the first call.
|
|
78
|
-
* @example
|
|
79
|
-
* import {Molad, months} from '@hebcal/core';
|
|
80
|
-
* const m = new Molad(5784, months.NISAN);
|
|
81
|
-
* const zdt = m.getInstant();
|
|
82
|
-
* console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'
|
|
83
|
-
* @return the `Temporal.ZonedDateTime` representing the moment of the molad
|
|
84
|
-
*/
|
|
85
|
-
getInstant(): Temporal.ZonedDateTime;
|
|
86
|
-
/**
|
|
87
|
-
* Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time
|
|
88
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
89
|
-
* displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
|
|
90
|
-
*
|
|
91
|
-
* @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.
|
|
92
|
-
*/
|
|
93
|
-
getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime;
|
|
94
|
-
/**
|
|
95
|
-
* Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a
|
|
96
|
-
* href="https://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a>. See the <a
|
|
97
|
-
* href="https://en.wikipedia.org/wiki/Yoel_Sirkis">Bach's</a> opinion on this time. This method returns the time
|
|
98
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
99
|
-
* displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
|
|
100
|
-
*
|
|
101
|
-
* @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.
|
|
102
|
-
*/
|
|
103
|
-
getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime;
|
|
104
|
-
/**
|
|
105
|
-
* Returns the latest time of Kiddush Levana according to the <a
|
|
106
|
-
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
|
|
107
|
-
* halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and
|
|
108
|
-
* molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time
|
|
109
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
110
|
-
* displaying _alos_ before this time if the zman is between _alos_ and _tzais_.
|
|
111
|
-
*
|
|
112
|
-
* @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.
|
|
113
|
-
*/
|
|
114
|
-
getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime;
|
|
115
|
-
/**
|
|
116
|
-
* Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down
|
|
117
|
-
* in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
|
|
118
|
-
* <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
|
|
119
|
-
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
|
|
120
|
-
* {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber
|
|
121
|
-
* agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid
|
|
122
|
-
* Heber's very detailed writeup in Siman Daled (chapter 4) of <a
|
|
123
|
-
* href="https://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>. This method returns the time even if it is during
|
|
124
|
-
* the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_
|
|
125
|
-
* before this time if the zman is between _alos_ and _tzais_.
|
|
126
|
-
*
|
|
127
|
-
* @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.
|
|
128
|
-
*/
|
|
129
|
-
getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime;
|
|
130
|
-
/**
|
|
131
|
-
* Returns a human-readable, localized string announcing the molad —
|
|
132
|
-
* suitable for use on Shabbat Mevarchim. The format includes the Hebrew
|
|
133
|
-
* month name, day of week, hour : minute, and chalakim if non-zero.
|
|
134
|
-
*
|
|
135
|
-
* Time format honors `options.hour12` and `options.location` (12-hour vs.
|
|
136
|
-
* 24-hour); see {@link HebrewCalendar.reformatTimeStr}.
|
|
137
|
-
* @example
|
|
138
|
-
* import {Molad, months} from '@hebcal/core';
|
|
139
|
-
* const m = new Molad(5784, months.NISAN);
|
|
140
|
-
* m.render('en', {hour12: true});
|
|
141
|
-
* // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'
|
|
142
|
-
* m.render('he');
|
|
143
|
-
* // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
|
|
144
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
145
|
-
* @param options used for time formatting (12-hour vs 24-hour)
|
|
146
|
-
*/
|
|
147
|
-
render(locale?: string, options?: CalOptions): string;
|
|
148
|
-
}
|
|
149
|
-
/** Represents a Molad announcement on Shabbat Mevarchim */
|
|
150
|
-
export declare class MoladEvent extends Event {
|
|
151
|
-
readonly molad: Molad;
|
|
152
|
-
private readonly options;
|
|
153
|
-
/**
|
|
154
|
-
* @param date Hebrew date event occurs
|
|
155
|
-
* @param hyear molad year
|
|
156
|
-
* @param hmonth molad month
|
|
157
|
-
* @param options
|
|
158
|
-
*/
|
|
159
|
-
constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions);
|
|
160
|
-
/**
|
|
161
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
162
|
-
*/
|
|
163
|
-
render(locale?: string): string;
|
|
164
|
-
}
|
package/dist/src/molad.js
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import './temporal-shim';
|
|
2
|
-
import { Event, flags } from './event';
|
|
3
|
-
import { HDate, Locale, pad2 } from '@hebcal/hdate';
|
|
4
|
-
import { reformatTimeStr } from './reformatTimeStr';
|
|
5
|
-
import { calculateMolad } from './moladBase';
|
|
6
|
-
import { getMoladAsDate } from './moladDate';
|
|
7
|
-
import './locale'; // Adds Hebrew and Ashkenazic translations
|
|
8
|
-
const enDoW = [
|
|
9
|
-
'Sunday',
|
|
10
|
-
'Monday',
|
|
11
|
-
'Tuesday',
|
|
12
|
-
'Wednesday',
|
|
13
|
-
'Thursday',
|
|
14
|
-
'Friday',
|
|
15
|
-
'Saturday',
|
|
16
|
-
];
|
|
17
|
-
const heDayNames = [
|
|
18
|
-
'רִאשׁוֹן',
|
|
19
|
-
'שֵׁנִי',
|
|
20
|
-
'שְׁלִישִׁי',
|
|
21
|
-
'רְבִיעִי',
|
|
22
|
-
'חֲמִישִׁי',
|
|
23
|
-
'שִׁישִּׁי',
|
|
24
|
-
'שַׁבָּת',
|
|
25
|
-
];
|
|
26
|
-
const frDoW = [
|
|
27
|
-
'Dimanche',
|
|
28
|
-
'Lundi',
|
|
29
|
-
'Mardi',
|
|
30
|
-
'Mercredi',
|
|
31
|
-
'Jeudi',
|
|
32
|
-
'Vendredi',
|
|
33
|
-
'Samedi',
|
|
34
|
-
];
|
|
35
|
-
const night = 'בַּלַּ֥יְלָה';
|
|
36
|
-
function getDayNames(locale) {
|
|
37
|
-
if (Locale.isHebrewLocale(locale)) {
|
|
38
|
-
return heDayNames;
|
|
39
|
-
}
|
|
40
|
-
else if (locale === 'fr') {
|
|
41
|
-
return frDoW;
|
|
42
|
-
}
|
|
43
|
-
return enDoW;
|
|
44
|
-
}
|
|
45
|
-
function getHebrewTimeOfDay(hour) {
|
|
46
|
-
if (hour < 5)
|
|
47
|
-
return night;
|
|
48
|
-
else if (hour < 12)
|
|
49
|
-
return 'בַּבֹּקֶר';
|
|
50
|
-
else if (hour < 17)
|
|
51
|
-
return 'בַּצׇּהֳרַיִים';
|
|
52
|
-
else if (hour < 21)
|
|
53
|
-
return 'בָּעֶרֶב';
|
|
54
|
-
return night;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Represents a *molad* — the calculated moment when the new moon is "born"
|
|
58
|
-
* for a given Hebrew month.
|
|
59
|
-
*
|
|
60
|
-
* The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat
|
|
61
|
-
* before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.
|
|
62
|
-
* Calculations use the traditional chalakim arithmetic
|
|
63
|
-
* (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* import {Molad, months} from '@hebcal/core';
|
|
67
|
-
* const m = new Molad(5784, months.NISAN);
|
|
68
|
-
* console.log(m.getMonthName()); // 'Nisan'
|
|
69
|
-
* console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12
|
|
70
|
-
* console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'
|
|
71
|
-
*/
|
|
72
|
-
export class Molad {
|
|
73
|
-
m;
|
|
74
|
-
year;
|
|
75
|
-
month;
|
|
76
|
-
instant;
|
|
77
|
-
/**
|
|
78
|
-
* Calculates the molad for a given Hebrew year and month.
|
|
79
|
-
* @param year Hebrew year
|
|
80
|
-
* @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)
|
|
81
|
-
*/
|
|
82
|
-
constructor(year, month) {
|
|
83
|
-
this.m = calculateMolad(year, month);
|
|
84
|
-
this.year = year;
|
|
85
|
-
this.month = month;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The exact Hebrew date of the molad, which often falls on the
|
|
89
|
-
* 28th or 30th of the preceeding month, occasionally on the first of the
|
|
90
|
-
* month, and in extremely rare circumstances the 27th of the month.
|
|
91
|
-
* - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z
|
|
92
|
-
* - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z
|
|
93
|
-
* - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z
|
|
94
|
-
*/
|
|
95
|
-
getMoladDate() {
|
|
96
|
-
return this.m.hdate;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* The year of the molad (as constructed)
|
|
100
|
-
*/
|
|
101
|
-
getYear() {
|
|
102
|
-
return this.year;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The month (1=NISSAN, 7=TISHREI) as constructed
|
|
106
|
-
*/
|
|
107
|
-
getMonth() {
|
|
108
|
-
return this.month;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Returns a transliterated string name of the molad's Hebrew month,
|
|
112
|
-
* for example 'Elul' or 'Cheshvan'.
|
|
113
|
-
*/
|
|
114
|
-
getMonthName() {
|
|
115
|
-
return HDate.getMonthName(this.month, this.year);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* @returns Day of Week (0=Sunday, 6=Saturday)
|
|
119
|
-
*/
|
|
120
|
-
getDow() {
|
|
121
|
-
return this.m.hdate.getDay();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @returns hour of day (0-23)
|
|
125
|
-
*/
|
|
126
|
-
getHour() {
|
|
127
|
-
return this.m.hour;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @returns minutes past hour (0-59)
|
|
131
|
-
*/
|
|
132
|
-
getMinutes() {
|
|
133
|
-
return this.m.minutes;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @returns parts of a minute (0-17)
|
|
137
|
-
*/
|
|
138
|
-
getChalakim() {
|
|
139
|
-
return this.m.chalakim;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.
|
|
143
|
-
* This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
|
|
144
|
-
* of 35.2354° is 5.2354° away from the %15 timezone longitude) to get to standard time. This method
|
|
145
|
-
* intentionally uses standard time and not daylight savings time.
|
|
146
|
-
*
|
|
147
|
-
* The returned value is cached after the first call.
|
|
148
|
-
* @example
|
|
149
|
-
* import {Molad, months} from '@hebcal/core';
|
|
150
|
-
* const m = new Molad(5784, months.NISAN);
|
|
151
|
-
* const zdt = m.getInstant();
|
|
152
|
-
* console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'
|
|
153
|
-
* @return the `Temporal.ZonedDateTime` representing the moment of the molad
|
|
154
|
-
*/
|
|
155
|
-
getInstant() {
|
|
156
|
-
this.instant ??= getMoladAsDate(this.m);
|
|
157
|
-
return this.instant;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time
|
|
161
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
162
|
-
* displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
|
|
163
|
-
*
|
|
164
|
-
* @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.
|
|
165
|
-
*/
|
|
166
|
-
getTchilasZmanKidushLevana3Days() {
|
|
167
|
-
const zdt = this.getInstant();
|
|
168
|
-
return zdt.add({ hours: 72 });
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a
|
|
172
|
-
* href="https://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a>. See the <a
|
|
173
|
-
* href="https://en.wikipedia.org/wiki/Yoel_Sirkis">Bach's</a> opinion on this time. This method returns the time
|
|
174
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
175
|
-
* displaying the next _tzais_ if the zman is between _alos_ and _tzais_.
|
|
176
|
-
*
|
|
177
|
-
* @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.
|
|
178
|
-
*/
|
|
179
|
-
getTchilasZmanKidushLevana7Days() {
|
|
180
|
-
const zdt = this.getInstant();
|
|
181
|
-
return zdt.add({ hours: 168 });
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Returns the latest time of Kiddush Levana according to the <a
|
|
185
|
-
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> opinion that it is calculated as
|
|
186
|
-
* halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and
|
|
187
|
-
* molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time
|
|
188
|
-
* even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider
|
|
189
|
-
* displaying _alos_ before this time if the zman is between _alos_ and _tzais_.
|
|
190
|
-
*
|
|
191
|
-
* @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.
|
|
192
|
-
*/
|
|
193
|
-
getSofZmanKidushLevanaBetweenMoldos() {
|
|
194
|
-
const zdt = this.getInstant();
|
|
195
|
-
// add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3
|
|
196
|
-
// seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid
|
|
197
|
-
// DST/ST crossover issues.
|
|
198
|
-
return zdt.add({
|
|
199
|
-
hours: 24 * 14 + 18,
|
|
200
|
-
minutes: 22,
|
|
201
|
-
seconds: 1,
|
|
202
|
-
milliseconds: 666,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down
|
|
207
|
-
* in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the
|
|
208
|
-
* <a href="https://en.wikipedia.org/wiki/Moses_Isserles">Rema</a> who brings down the opinion of the <a
|
|
209
|
-
* href="https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil's</a> of calculating
|
|
210
|
-
* {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber
|
|
211
|
-
* agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid
|
|
212
|
-
* Heber's very detailed writeup in Siman Daled (chapter 4) of <a
|
|
213
|
-
* href="https://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>. This method returns the time even if it is during
|
|
214
|
-
* the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_
|
|
215
|
-
* before this time if the zman is between _alos_ and _tzais_.
|
|
216
|
-
*
|
|
217
|
-
* @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.
|
|
218
|
-
*/
|
|
219
|
-
getSofZmanKidushLevana15Days() {
|
|
220
|
-
const zdt = this.getInstant();
|
|
221
|
-
// 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.
|
|
222
|
-
return zdt.add({ hours: 24 * 15 });
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Returns a human-readable, localized string announcing the molad —
|
|
226
|
-
* suitable for use on Shabbat Mevarchim. The format includes the Hebrew
|
|
227
|
-
* month name, day of week, hour : minute, and chalakim if non-zero.
|
|
228
|
-
*
|
|
229
|
-
* Time format honors `options.hour12` and `options.location` (12-hour vs.
|
|
230
|
-
* 24-hour); see {@link HebrewCalendar.reformatTimeStr}.
|
|
231
|
-
* @example
|
|
232
|
-
* import {Molad, months} from '@hebcal/core';
|
|
233
|
-
* const m = new Molad(5784, months.NISAN);
|
|
234
|
-
* m.render('en', {hour12: true});
|
|
235
|
-
* // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'
|
|
236
|
-
* m.render('he');
|
|
237
|
-
* // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
|
|
238
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
239
|
-
* @param options used for time formatting (12-hour vs 24-hour)
|
|
240
|
-
*/
|
|
241
|
-
render(locale, options) {
|
|
242
|
-
const monthName = Locale.gettext(this.getMonthName(), locale);
|
|
243
|
-
const dayNames = getDayNames(locale);
|
|
244
|
-
const dow = dayNames[this.getDow()];
|
|
245
|
-
const minutes = this.getMinutes();
|
|
246
|
-
const hour = this.getHour();
|
|
247
|
-
const chalakim = this.getChalakim();
|
|
248
|
-
const moladStr = Locale.gettext('Molad', locale);
|
|
249
|
-
const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';
|
|
250
|
-
const chalakimStr = Locale.gettext('chalakim', locale);
|
|
251
|
-
const and = Locale.gettext('and', locale);
|
|
252
|
-
if (Locale.isHebrewLocale(locale)) {
|
|
253
|
-
const ampm = getHebrewTimeOfDay(hour);
|
|
254
|
-
let result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +
|
|
255
|
-
`בְּשָׁעָה ${hour} ${ampm}, ` +
|
|
256
|
-
`ו-${minutes} ${minutesStr}`;
|
|
257
|
-
if (chalakim !== 0) {
|
|
258
|
-
result += ` ו-${chalakim} ${chalakimStr}`;
|
|
259
|
-
}
|
|
260
|
-
if (locale.toLocaleLowerCase() === 'he-x-nonikud') {
|
|
261
|
-
return Locale.hebrewStripNikkud(result);
|
|
262
|
-
}
|
|
263
|
-
return result;
|
|
264
|
-
}
|
|
265
|
-
const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);
|
|
266
|
-
const month = monthName.replace(/'/g, '’');
|
|
267
|
-
const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;
|
|
268
|
-
if (chalakim === 0) {
|
|
269
|
-
return result;
|
|
270
|
-
}
|
|
271
|
-
return result + ` ${and} ${chalakim} ${chalakimStr}`;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
/** Represents a Molad announcement on Shabbat Mevarchim */
|
|
275
|
-
export class MoladEvent extends Event {
|
|
276
|
-
molad;
|
|
277
|
-
options;
|
|
278
|
-
/**
|
|
279
|
-
* @param date Hebrew date event occurs
|
|
280
|
-
* @param hyear molad year
|
|
281
|
-
* @param hmonth molad month
|
|
282
|
-
* @param options
|
|
283
|
-
*/
|
|
284
|
-
constructor(date, hyear, hmonth, options) {
|
|
285
|
-
const m = new Molad(hyear, hmonth);
|
|
286
|
-
const monthName = m.getMonthName();
|
|
287
|
-
super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);
|
|
288
|
-
this.molad = m;
|
|
289
|
-
this.options = options;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* @param [locale] Optional locale name (defaults to empty locale)
|
|
293
|
-
*/
|
|
294
|
-
render(locale) {
|
|
295
|
-
return this.molad.render(locale, this.options);
|
|
296
|
-
}
|
|
297
|
-
}
|
package/dist/src/moladBase.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HDate } from '@hebcal/hdate';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a molad, the moment when the new moon is "born"
|
|
4
|
-
*/
|
|
5
|
-
export type MoladBase = {
|
|
6
|
-
/** Hebrew date */
|
|
7
|
-
readonly hdate: HDate;
|
|
8
|
-
/** hour of day (0-23) */
|
|
9
|
-
readonly hour: number;
|
|
10
|
-
/** minutes past hour (0-59) */
|
|
11
|
-
readonly minutes: number;
|
|
12
|
-
/** parts of a minute (0-17) */
|
|
13
|
-
readonly chalakim: number;
|
|
14
|
-
};
|
|
15
|
-
export declare function calculateMolad(year: number, month: number): MoladBase;
|
package/dist/src/moladBase.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/src/moladDate.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import './temporal-shim';
|
|
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;
|
package/dist/src/moladDate.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import './temporal-shim';
|
|
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
|
-
}
|