@hebcal/core 5.3.12 → 5.3.13
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 +22 -0
- package/dist/HebrewDateEvent.d.ts +14 -0
- package/dist/ParshaEvent.d.ts +19 -0
- package/dist/ashkenazi.po.d.ts +68 -0
- package/dist/bundle.js +326 -37
- package/dist/bundle.min.js +2 -2
- package/dist/candles.d.ts +74 -0
- package/dist/dateFormat.d.ts +33 -0
- package/dist/event.d.ts +144 -0
- package/dist/hallel.d.ts +7 -0
- package/dist/hdate.d.ts +395 -0
- package/dist/he.po.d.ts +306 -0
- package/dist/hebcal.d.ts +444 -0
- package/dist/holidays.d.ts +65 -0
- package/dist/index.cjs +326 -37
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +327 -38
- package/dist/locale-ashkenazi.d.ts +1 -0
- package/dist/locale-he.d.ts +1 -0
- package/dist/locale.d.ts +80 -0
- package/dist/location.d.ts +85 -0
- package/dist/modern.d.ts +20 -0
- package/dist/molad.d.ts +65 -0
- package/dist/omer.d.ts +26 -0
- package/dist/pkgVersion.d.ts +1 -0
- package/dist/reformatTimeStr.d.ts +8 -0
- package/dist/sedra.d.ts +111 -0
- package/dist/staticHolidays.d.ts +212 -0
- package/dist/staticHols.d.ts +175 -0
- package/dist/tachanun.d.ts +8 -0
- package/dist/throwTypeError.d.ts +5 -0
- package/dist/zmanim.d.ts +321 -0
- package/package.json +13 -9
- package/hebcal.d.ts +0 -1361
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
* @param {Event} e
|
|
4
|
+
* @param {HDate} hd
|
|
5
|
+
* @param {CalOptions} options
|
|
6
|
+
* @param {boolean} isFriday
|
|
7
|
+
* @param {boolean} isSaturday
|
|
8
|
+
* @return {Event}
|
|
9
|
+
*/
|
|
10
|
+
export function makeCandleEvent(e: Event, hd: HDate, options: CalOptions, isFriday: boolean, isSaturday: boolean): Event;
|
|
11
|
+
/**
|
|
12
|
+
* Makes a pair of events representing fast start and end times
|
|
13
|
+
* @private
|
|
14
|
+
* @param {Event} ev
|
|
15
|
+
* @param {CalOptions} options
|
|
16
|
+
* @return {Event}
|
|
17
|
+
*/
|
|
18
|
+
export function makeFastStartEnd(ev: Event, options: CalOptions): Event;
|
|
19
|
+
/**
|
|
20
|
+
* Makes a candle-lighting event for Chankah (not on Friday/Saturday).
|
|
21
|
+
* At one point this used civil dusk (6 degrees below horizon).
|
|
22
|
+
* Another source suggests 4.6667 degrees below horizon.
|
|
23
|
+
* @private
|
|
24
|
+
* @param {Event} ev
|
|
25
|
+
* @param {HDate} hd
|
|
26
|
+
* @param {CalOptions} options
|
|
27
|
+
* @return {TimedEvent}
|
|
28
|
+
*/
|
|
29
|
+
export function makeWeekdayChanukahCandleLighting(ev: Event, hd: HDate, options: CalOptions): TimedEvent;
|
|
30
|
+
/** An event that has an `eventTime` and `eventTimeStr` */
|
|
31
|
+
export class TimedEvent extends Event {
|
|
32
|
+
/**
|
|
33
|
+
* @param {HDate} date
|
|
34
|
+
* @param {string} desc Description (not translated)
|
|
35
|
+
* @param {number} mask
|
|
36
|
+
* @param {Date} eventTime
|
|
37
|
+
* @param {Location} location
|
|
38
|
+
* @param {Event} linkedEvent
|
|
39
|
+
* @param {CalOptions} options
|
|
40
|
+
*/
|
|
41
|
+
constructor(date: HDate, desc: string, mask: number, eventTime: Date, location: Location, linkedEvent: Event, options: CalOptions);
|
|
42
|
+
eventTime: Date;
|
|
43
|
+
location: Location;
|
|
44
|
+
eventTimeStr: string;
|
|
45
|
+
fmtTime: string;
|
|
46
|
+
linkedEvent: Event | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** Havdalah after Shabbat or holiday */
|
|
49
|
+
export class HavdalahEvent extends TimedEvent {
|
|
50
|
+
/**
|
|
51
|
+
* @param {HDate} date
|
|
52
|
+
* @param {number} mask
|
|
53
|
+
* @param {Date} eventTime
|
|
54
|
+
* @param {Location} location
|
|
55
|
+
* @param {number} havdalahMins
|
|
56
|
+
* @param {Event} linkedEvent
|
|
57
|
+
* @param {CalOptions} options
|
|
58
|
+
*/
|
|
59
|
+
constructor(date: HDate, mask: number, eventTime: Date, location: Location, havdalahMins: number, linkedEvent: Event, options: CalOptions);
|
|
60
|
+
havdalahMins: number | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Candle lighting before Shabbat or holiday */
|
|
63
|
+
export class CandleLightingEvent extends TimedEvent {
|
|
64
|
+
/**
|
|
65
|
+
* @param {HDate} date
|
|
66
|
+
* @param {number} mask
|
|
67
|
+
* @param {Date} eventTime
|
|
68
|
+
* @param {Location} location
|
|
69
|
+
* @param {Event} linkedEvent
|
|
70
|
+
* @param {CalOptions} options
|
|
71
|
+
*/
|
|
72
|
+
constructor(date: HDate, mask: number, eventTime: Date, location: Location, linkedEvent: Event, options: CalOptions);
|
|
73
|
+
}
|
|
74
|
+
import { Event } from './event.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
* @param {string} tzid
|
|
4
|
+
* @param {Date} date
|
|
5
|
+
* @return {string}
|
|
6
|
+
*/
|
|
7
|
+
export function getPseudoISO(tzid: string, date: Date): string;
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
* @param {string} tzid
|
|
11
|
+
* @param {Date} date
|
|
12
|
+
* @return {number}
|
|
13
|
+
*/
|
|
14
|
+
export function getTimezoneOffset(tzid: string, date: Date): number;
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @param {number} number
|
|
18
|
+
* @return {string}
|
|
19
|
+
*/
|
|
20
|
+
export function pad4(number: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
* @param {number} number
|
|
24
|
+
* @return {string}
|
|
25
|
+
*/
|
|
26
|
+
export function pad2(number: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns YYYY-MM-DD in the local timezone
|
|
29
|
+
* @private
|
|
30
|
+
* @param {Date} dt
|
|
31
|
+
* @return {string}
|
|
32
|
+
*/
|
|
33
|
+
export function isoDateString(dt: Date): string;
|
package/dist/event.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Holiday flags for Event
|
|
3
|
+
*/
|
|
4
|
+
export type flags = number;
|
|
5
|
+
export namespace flags {
|
|
6
|
+
let CHAG: number;
|
|
7
|
+
let LIGHT_CANDLES: number;
|
|
8
|
+
let YOM_TOV_ENDS: number;
|
|
9
|
+
let CHUL_ONLY: number;
|
|
10
|
+
let IL_ONLY: number;
|
|
11
|
+
let LIGHT_CANDLES_TZEIS: number;
|
|
12
|
+
let CHANUKAH_CANDLES: number;
|
|
13
|
+
let ROSH_CHODESH: number;
|
|
14
|
+
let MINOR_FAST: number;
|
|
15
|
+
let SPECIAL_SHABBAT: number;
|
|
16
|
+
let PARSHA_HASHAVUA: number;
|
|
17
|
+
let DAF_YOMI: number;
|
|
18
|
+
let OMER_COUNT: number;
|
|
19
|
+
let MODERN_HOLIDAY: number;
|
|
20
|
+
let MAJOR_FAST: number;
|
|
21
|
+
let SHABBAT_MEVARCHIM: number;
|
|
22
|
+
let MOLAD: number;
|
|
23
|
+
let USER_EVENT: number;
|
|
24
|
+
let HEBREW_DATE: number;
|
|
25
|
+
let MINOR_HOLIDAY: number;
|
|
26
|
+
let EREV: number;
|
|
27
|
+
let CHOL_HAMOED: number;
|
|
28
|
+
let MISHNA_YOMI: number;
|
|
29
|
+
let YOM_KIPPUR_KATAN: number;
|
|
30
|
+
let YERUSHALMI_YOMI: number;
|
|
31
|
+
let NACH_YOMI: number;
|
|
32
|
+
let DAILY_LEARNING: number;
|
|
33
|
+
}
|
|
34
|
+
/** Represents an Event with a title, date, and flags */
|
|
35
|
+
export class Event {
|
|
36
|
+
/**
|
|
37
|
+
* Constructs Event
|
|
38
|
+
* @param {HDate} date Hebrew date event occurs
|
|
39
|
+
* @param {string} desc Description (not translated)
|
|
40
|
+
* @param {number} [mask=0] optional bitmask of holiday flags (see {@link flags})
|
|
41
|
+
* @param {Object} [attrs={}] optional additional attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
|
|
42
|
+
*/
|
|
43
|
+
constructor(date: HDate, desc: string, mask?: number | undefined, attrs?: Object | undefined);
|
|
44
|
+
date: HDate;
|
|
45
|
+
desc: string;
|
|
46
|
+
mask: number;
|
|
47
|
+
/**
|
|
48
|
+
* Hebrew date of this event
|
|
49
|
+
* @return {HDate}
|
|
50
|
+
*/
|
|
51
|
+
getDate(): HDate;
|
|
52
|
+
/**
|
|
53
|
+
* Untranslated description of this event
|
|
54
|
+
* @return {string}
|
|
55
|
+
*/
|
|
56
|
+
getDesc(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Bitmask of optional event flags. See {@link flags}
|
|
59
|
+
* @return {number}
|
|
60
|
+
*/
|
|
61
|
+
getFlags(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Returns (translated) description of this event
|
|
64
|
+
* @example
|
|
65
|
+
* const ev = new Event(new HDate(6, 'Sivan', 5749), 'Shavuot', flags.CHAG);
|
|
66
|
+
* ev.render('en'); // 'Shavuot'
|
|
67
|
+
* ev.render('he'); // 'שָׁבוּעוֹת'
|
|
68
|
+
* ev.render('ashkenazi'); // 'Shavuos'
|
|
69
|
+
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
70
|
+
* @return {string}
|
|
71
|
+
*/
|
|
72
|
+
render(locale?: string | undefined): string;
|
|
73
|
+
/**
|
|
74
|
+
* Returns a brief (translated) description of this event.
|
|
75
|
+
* For most events, this is the same as render(). For some events, it procudes
|
|
76
|
+
* a shorter text (e.g. without a time or added description).
|
|
77
|
+
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
78
|
+
* @return {string}
|
|
79
|
+
*/
|
|
80
|
+
renderBrief(locale?: string | undefined): string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional holiday-specific Emoji or `null`.
|
|
83
|
+
* @return {string}
|
|
84
|
+
*/
|
|
85
|
+
getEmoji(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Returns a simplified (untranslated) description for this event. For example,
|
|
88
|
+
* the {@link HolidayEvent} class supports
|
|
89
|
+
* "Erev Pesach" => "Pesach", and "Sukkot III (CH''M)" => "Sukkot".
|
|
90
|
+
* For many holidays the basename and the event description are the same.
|
|
91
|
+
* @return {string}
|
|
92
|
+
*/
|
|
93
|
+
basename(): string;
|
|
94
|
+
/**
|
|
95
|
+
* Returns a URL to hebcal.com or sefaria.org for more detail on the event.
|
|
96
|
+
* Returns `undefined` for events with no detail page.
|
|
97
|
+
* @return {string}
|
|
98
|
+
*/
|
|
99
|
+
url(): string;
|
|
100
|
+
/**
|
|
101
|
+
* Is this event observed in Israel?
|
|
102
|
+
* @example
|
|
103
|
+
* const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
|
|
104
|
+
* ev1.observedInIsrael(); // false
|
|
105
|
+
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
106
|
+
* ev2.observedInIsrael(); // true
|
|
107
|
+
* @return {boolean}
|
|
108
|
+
*/
|
|
109
|
+
observedInIsrael(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Is this event observed in the Diaspora?
|
|
112
|
+
* @example
|
|
113
|
+
* const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
|
|
114
|
+
* ev1.observedInDiaspora(); // true
|
|
115
|
+
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
116
|
+
* ev2.observedInDiaspora(); // true
|
|
117
|
+
* @return {boolean}
|
|
118
|
+
*/
|
|
119
|
+
observedInDiaspora(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Is this event observed in Israel/Diaspora?
|
|
122
|
+
* @example
|
|
123
|
+
* const ev1 = new Event(new HDate(7, 'Sivan', 5749), 'Shavuot II', flags.CHAG | flags.CHUL_ONLY);
|
|
124
|
+
* ev1.observedIn(false); // true
|
|
125
|
+
* ev1.observedIn(true); // false
|
|
126
|
+
* const ev2 = new Event(new HDate(26, 'Kislev', 5749), 'Chanukah: 3 Candles', 0);
|
|
127
|
+
* ev2.observedIn(false); // true
|
|
128
|
+
* ev2.observedIn(true); // true
|
|
129
|
+
* @param {boolean} il
|
|
130
|
+
* @return {boolean}
|
|
131
|
+
*/
|
|
132
|
+
observedIn(il: boolean): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Makes a clone of this Event object
|
|
135
|
+
* @return {Event}
|
|
136
|
+
*/
|
|
137
|
+
clone(): Event;
|
|
138
|
+
/**
|
|
139
|
+
* Returns a list of event categories
|
|
140
|
+
* @return {string[]}
|
|
141
|
+
*/
|
|
142
|
+
getCategories(): string[];
|
|
143
|
+
}
|
|
144
|
+
import { HDate } from './hdate.js';
|
package/dist/hallel.d.ts
ADDED
package/dist/hdate.d.ts
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple Hebrew date object with numeric fields `yy`, `mm`, and `dd`
|
|
3
|
+
* @typedef {Object} SimpleHebrewDate
|
|
4
|
+
* @property {number} yy Hebrew year
|
|
5
|
+
* @property {number} mm Hebrew month of year (1=NISAN, 7=TISHREI)
|
|
6
|
+
* @property {number} dd Day of month (1-30)
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
/** Represents a Hebrew date */
|
|
10
|
+
export class HDate {
|
|
11
|
+
/**
|
|
12
|
+
* Converts Hebrew date to R.D. (Rata Die) fixed days.
|
|
13
|
+
* R.D. 1 is the imaginary date Monday, January 1, 1 on the Gregorian
|
|
14
|
+
* Calendar.
|
|
15
|
+
* @param {number} year Hebrew year
|
|
16
|
+
* @param {number} month Hebrew month
|
|
17
|
+
* @param {number} day Hebrew date (1-30)
|
|
18
|
+
* @return {number}
|
|
19
|
+
*/
|
|
20
|
+
static hebrew2abs(year: number, month: number, day: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
* @param {string} locale
|
|
24
|
+
* @return {string}
|
|
25
|
+
*/
|
|
26
|
+
private static getDayOfTranslation;
|
|
27
|
+
/**
|
|
28
|
+
* @private
|
|
29
|
+
* @param {string} units
|
|
30
|
+
* @return {string}
|
|
31
|
+
*/
|
|
32
|
+
private static standardizeUnits;
|
|
33
|
+
/**
|
|
34
|
+
* Returns true if Hebrew year is a leap year
|
|
35
|
+
* @param {number} year Hebrew year
|
|
36
|
+
* @return {boolean}
|
|
37
|
+
*/
|
|
38
|
+
static isLeapYear(year: number): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Number of months in this Hebrew year (either 12 or 13 depending on leap year)
|
|
41
|
+
* @param {number} year Hebrew year
|
|
42
|
+
* @return {number}
|
|
43
|
+
*/
|
|
44
|
+
static monthsInYear(year: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Number of days in Hebrew month in a given year (29 or 30)
|
|
47
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
48
|
+
* @param {number} year Hebrew year
|
|
49
|
+
* @return {number}
|
|
50
|
+
*/
|
|
51
|
+
static daysInMonth(month: number, year: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a transliterated string name of Hebrew month in year,
|
|
54
|
+
* for example 'Elul' or 'Cheshvan'.
|
|
55
|
+
* @param {number} month Hebrew month (e.g. months.TISHREI)
|
|
56
|
+
* @param {number} year Hebrew year
|
|
57
|
+
* @return {string}
|
|
58
|
+
*/
|
|
59
|
+
static getMonthName(month: number, year: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the Hebrew month number (NISAN=1, TISHREI=7)
|
|
62
|
+
* @param {number|string} month A number, or Hebrew month name string
|
|
63
|
+
* @return {number}
|
|
64
|
+
*/
|
|
65
|
+
static monthNum(month: number | string): number;
|
|
66
|
+
/**
|
|
67
|
+
* Number of days in the hebrew YEAR
|
|
68
|
+
* @param {number} year Hebrew year
|
|
69
|
+
* @return {number}
|
|
70
|
+
*/
|
|
71
|
+
static daysInYear(year: number): number;
|
|
72
|
+
/**
|
|
73
|
+
* true if Cheshvan is long in Hebrew year
|
|
74
|
+
* @param {number} year Hebrew year
|
|
75
|
+
* @return {boolean}
|
|
76
|
+
*/
|
|
77
|
+
static longCheshvan(year: number): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* true if Kislev is short in Hebrew year
|
|
80
|
+
* @param {number} year Hebrew year
|
|
81
|
+
* @return {boolean}
|
|
82
|
+
*/
|
|
83
|
+
static shortKislev(year: number): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Converts Hebrew month string name to numeric
|
|
86
|
+
* @param {string|number} monthName monthName
|
|
87
|
+
* @return {number}
|
|
88
|
+
*/
|
|
89
|
+
static monthFromName(monthName: string | number): number;
|
|
90
|
+
/**
|
|
91
|
+
* Note: Applying this function to d+6 gives us the DAYNAME on or after an
|
|
92
|
+
* absolute day d. Similarly, applying it to d+3 gives the DAYNAME nearest to
|
|
93
|
+
* absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
|
|
94
|
+
* date d, and applying it to d+7 gives the DAYNAME following absolute date d.
|
|
95
|
+
* @param {number} dayOfWeek
|
|
96
|
+
* @param {number} absdate
|
|
97
|
+
* @return {number}
|
|
98
|
+
*/
|
|
99
|
+
static dayOnOrBefore(dayOfWeek: number, absdate: number): number;
|
|
100
|
+
/**
|
|
101
|
+
* Tests if the object is an instance of `HDate`
|
|
102
|
+
* @param {any} obj
|
|
103
|
+
* @return {boolean}
|
|
104
|
+
*/
|
|
105
|
+
static isHDate(obj: any): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Construct a new instance of `HDate` from a Gematriya-formatted string
|
|
108
|
+
* @example
|
|
109
|
+
* HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
|
|
110
|
+
* HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
|
|
111
|
+
* HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
|
|
112
|
+
* @param {string} str
|
|
113
|
+
* @param {number} currentThousands
|
|
114
|
+
* @return {HDate}
|
|
115
|
+
*/
|
|
116
|
+
static fromGematriyaString(str: string, currentThousands?: number): HDate;
|
|
117
|
+
/**
|
|
118
|
+
* Create a Hebrew date. There are 3 basic forms for the `HDate()` constructor.
|
|
119
|
+
*
|
|
120
|
+
* 1. No parameters - represents the current Hebrew date at time of instantiation
|
|
121
|
+
* 2. One parameter
|
|
122
|
+
* * `Date` - represents the Hebrew date corresponding to the Gregorian date using
|
|
123
|
+
* local time. Hours, minutes, seconds and milliseconds are ignored.
|
|
124
|
+
* * `HDate` - clones a copy of the given Hebrew date
|
|
125
|
+
* * `number` - Converts absolute R.D. days to Hebrew date.
|
|
126
|
+
* R.D. 1 == the imaginary date January 1, 1 (Gregorian)
|
|
127
|
+
* 3. Three parameters: Hebrew day, Hebrew month, Hebrew year. Hebrew day should
|
|
128
|
+
* be a number between 1-30, Hebrew month can be a number or string, and
|
|
129
|
+
* Hebrew year is always a number.
|
|
130
|
+
* @example
|
|
131
|
+
* import {HDate, months} from '@hebcal/core';
|
|
132
|
+
*
|
|
133
|
+
* const hd1 = new HDate();
|
|
134
|
+
* const hd2 = new HDate(new Date(2008, 10, 13));
|
|
135
|
+
* const hd3 = new HDate(15, 'Cheshvan', 5769);
|
|
136
|
+
* const hd4 = new HDate(15, months.CHESHVAN, 5769);
|
|
137
|
+
* const hd5 = new HDate(733359); // ==> 15 Cheshvan 5769
|
|
138
|
+
* const monthName = 'אייר';
|
|
139
|
+
* const hd6 = new HDate(5, monthName, 5773);
|
|
140
|
+
* @param {number|Date|HDate} [day] - Day of month (1-30) if a `number`.
|
|
141
|
+
* If a `Date` is specified, represents the Hebrew date corresponding to the
|
|
142
|
+
* Gregorian date using local time.
|
|
143
|
+
* If an `HDate` is specified, clones a copy of the given Hebrew date.
|
|
144
|
+
* @param {number|string} [month] - Hebrew month of year (1=NISAN, 7=TISHREI)
|
|
145
|
+
* @param {number} [year] - Hebrew year
|
|
146
|
+
*/
|
|
147
|
+
constructor(day?: number | HDate | Date | undefined, month?: string | number | undefined, year?: number | undefined, ...args: any[]);
|
|
148
|
+
/**
|
|
149
|
+
* @private
|
|
150
|
+
* @type {number}
|
|
151
|
+
*/
|
|
152
|
+
private dd;
|
|
153
|
+
private mm;
|
|
154
|
+
yy: number;
|
|
155
|
+
/**
|
|
156
|
+
* @private
|
|
157
|
+
* @type {number}
|
|
158
|
+
*/
|
|
159
|
+
private rd;
|
|
160
|
+
/**
|
|
161
|
+
* Gets the Hebrew year of this Hebrew date
|
|
162
|
+
* @return {number}
|
|
163
|
+
*/
|
|
164
|
+
getFullYear(): number;
|
|
165
|
+
/**
|
|
166
|
+
* Tests if this date occurs during a leap year
|
|
167
|
+
* @return {boolean}
|
|
168
|
+
*/
|
|
169
|
+
isLeapYear(): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the Hebrew month (1=NISAN, 7=TISHREI) of this Hebrew date
|
|
172
|
+
* @return {number}
|
|
173
|
+
*/
|
|
174
|
+
getMonth(): number;
|
|
175
|
+
/**
|
|
176
|
+
* The Tishrei-based month of the date. 1 is Tishrei, 7 is Nisan, 13 is Elul in a leap year
|
|
177
|
+
* @return {number}
|
|
178
|
+
*/
|
|
179
|
+
getTishreiMonth(): number;
|
|
180
|
+
/**
|
|
181
|
+
* Number of days in the month of this Hebrew date
|
|
182
|
+
* @return {number}
|
|
183
|
+
*/
|
|
184
|
+
daysInMonth(): number;
|
|
185
|
+
/**
|
|
186
|
+
* Gets the day within the month (1-30)
|
|
187
|
+
* @return {number}
|
|
188
|
+
*/
|
|
189
|
+
getDate(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Gets the day of the week. 0=Sunday, 6=Saturday
|
|
192
|
+
* @return {number}
|
|
193
|
+
*/
|
|
194
|
+
getDay(): number;
|
|
195
|
+
/**
|
|
196
|
+
* Sets the day of the month of the date. Returns the object it was called upon
|
|
197
|
+
* @private
|
|
198
|
+
* @param {number|string} month A number, or Hebrew month name string
|
|
199
|
+
* @return {HDate}
|
|
200
|
+
*/
|
|
201
|
+
private setMonth;
|
|
202
|
+
/**
|
|
203
|
+
* @private
|
|
204
|
+
* @param {number} date
|
|
205
|
+
* @return {HDate}
|
|
206
|
+
*/
|
|
207
|
+
private setDate;
|
|
208
|
+
/**
|
|
209
|
+
* Converts to Gregorian date
|
|
210
|
+
* @return {Date}
|
|
211
|
+
*/
|
|
212
|
+
greg(): Date;
|
|
213
|
+
/**
|
|
214
|
+
* Returns R.D. (Rata Die) fixed days.
|
|
215
|
+
* R.D. 1 == Monday, January 1, 1 (Gregorian)
|
|
216
|
+
* Note also that R.D. = Julian Date − 1,721,424.5
|
|
217
|
+
* https://en.wikipedia.org/wiki/Rata_Die#Dershowitz_and_Reingold
|
|
218
|
+
* @return {number}
|
|
219
|
+
*/
|
|
220
|
+
abs(): number;
|
|
221
|
+
/**
|
|
222
|
+
* Returns a transliterated Hebrew month name, e.g. `'Elul'` or `'Cheshvan'`.
|
|
223
|
+
* @return {string}
|
|
224
|
+
*/
|
|
225
|
+
getMonthName(): string;
|
|
226
|
+
/**
|
|
227
|
+
* Renders this Hebrew date as a translated or transliterated string,
|
|
228
|
+
* including ordinal e.g. `'15th of Cheshvan, 5769'`.
|
|
229
|
+
* @example
|
|
230
|
+
* import {HDate, months} from '@hebcal/core';
|
|
231
|
+
*
|
|
232
|
+
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
233
|
+
* console.log(hd.render('en')); // '15th of Cheshvan, 5769'
|
|
234
|
+
* console.log(hd.render('he')); // '15 חֶשְׁוָן, 5769'
|
|
235
|
+
* @param {string} [locale] Optional locale name (defaults to active locale).
|
|
236
|
+
* @param {boolean} [showYear=true] Display year (defaults to true).
|
|
237
|
+
* @return {string}
|
|
238
|
+
*/
|
|
239
|
+
render(locale?: string | undefined, showYear?: boolean | undefined): string;
|
|
240
|
+
/**
|
|
241
|
+
* Renders this Hebrew date in Hebrew gematriya, regardless of locale.
|
|
242
|
+
* @example
|
|
243
|
+
* import {HDate, months} from '@hebcal/core';
|
|
244
|
+
* const hd = new HDate(15, months.CHESHVAN, 5769);
|
|
245
|
+
* console.log(hd.renderGematriya()); // 'ט״ו חֶשְׁוָן תשס״ט'
|
|
246
|
+
* @param {boolean} [suppressNikud]
|
|
247
|
+
* @return {string}
|
|
248
|
+
*/
|
|
249
|
+
renderGematriya(suppressNikud?: boolean | undefined): string;
|
|
250
|
+
/**
|
|
251
|
+
* Returns an `HDate` representing the a dayNumber before the current date.
|
|
252
|
+
* Sunday=0, Saturday=6
|
|
253
|
+
* @example
|
|
254
|
+
* new HDate(new Date('Wednesday February 19, 2014')).before(6).greg() // Sat Feb 15 2014
|
|
255
|
+
* @param {number} day day of week
|
|
256
|
+
* @return {HDate}
|
|
257
|
+
*/
|
|
258
|
+
before(day: number): HDate;
|
|
259
|
+
/**
|
|
260
|
+
* Returns an `HDate` representing the a dayNumber on or before the current date.
|
|
261
|
+
* Sunday=0, Saturday=6
|
|
262
|
+
* @example
|
|
263
|
+
* new HDate(new Date('Wednesday February 19, 2014')).onOrBefore(6).greg() // Sat Feb 15 2014
|
|
264
|
+
* new HDate(new Date('Saturday February 22, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
265
|
+
* new HDate(new Date('Sunday February 23, 2014')).onOrBefore(6).greg() // Sat Feb 22 2014
|
|
266
|
+
* @param {number} dow day of week
|
|
267
|
+
* @return {HDate}
|
|
268
|
+
*/
|
|
269
|
+
onOrBefore(dow: number): HDate;
|
|
270
|
+
/**
|
|
271
|
+
* Returns an `HDate` representing the nearest dayNumber to the current date
|
|
272
|
+
* Sunday=0, Saturday=6
|
|
273
|
+
* @example
|
|
274
|
+
* new HDate(new Date('Wednesday February 19, 2014')).nearest(6).greg() // Sat Feb 22 2014
|
|
275
|
+
* new HDate(new Date('Tuesday February 18, 2014')).nearest(6).greg() // Sat Feb 15 2014
|
|
276
|
+
* @param {number} dow day of week
|
|
277
|
+
* @return {HDate}
|
|
278
|
+
*/
|
|
279
|
+
nearest(dow: number): HDate;
|
|
280
|
+
/**
|
|
281
|
+
* Returns an `HDate` representing the a dayNumber on or after the current date.
|
|
282
|
+
* Sunday=0, Saturday=6
|
|
283
|
+
* @example
|
|
284
|
+
* new HDate(new Date('Wednesday February 19, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
285
|
+
* new HDate(new Date('Saturday February 22, 2014')).onOrAfter(6).greg() // Sat Feb 22 2014
|
|
286
|
+
* new HDate(new Date('Sunday February 23, 2014')).onOrAfter(6).greg() // Sat Mar 01 2014
|
|
287
|
+
* @param {number} dow day of week
|
|
288
|
+
* @return {HDate}
|
|
289
|
+
*/
|
|
290
|
+
onOrAfter(dow: number): HDate;
|
|
291
|
+
/**
|
|
292
|
+
* Returns an `HDate` representing the a dayNumber after the current date.
|
|
293
|
+
* Sunday=0, Saturday=6
|
|
294
|
+
* @example
|
|
295
|
+
* new HDate(new Date('Wednesday February 19, 2014')).after(6).greg() // Sat Feb 22 2014
|
|
296
|
+
* new HDate(new Date('Saturday February 22, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
297
|
+
* new HDate(new Date('Sunday February 23, 2014')).after(6).greg() // Sat Mar 01 2014
|
|
298
|
+
* @param {number} day day of week
|
|
299
|
+
* @return {HDate}
|
|
300
|
+
*/
|
|
301
|
+
after(day: number): HDate;
|
|
302
|
+
/**
|
|
303
|
+
* Returns the next Hebrew date
|
|
304
|
+
* @return {HDate}
|
|
305
|
+
*/
|
|
306
|
+
next(): HDate;
|
|
307
|
+
/**
|
|
308
|
+
* Returns the previous Hebrew date
|
|
309
|
+
* @return {HDate}
|
|
310
|
+
*/
|
|
311
|
+
prev(): HDate;
|
|
312
|
+
/**
|
|
313
|
+
* Returns a cloned `HDate` object with a specified amount of time added
|
|
314
|
+
*
|
|
315
|
+
* Units are case insensitive, and support plural and short forms.
|
|
316
|
+
* Note, short forms are case sensitive.
|
|
317
|
+
*
|
|
318
|
+
* | Unit | Shorthand | Description
|
|
319
|
+
* | --- | --- | --- |
|
|
320
|
+
* | `day` | `d` | days |
|
|
321
|
+
* | `week` | `w` | weeks |
|
|
322
|
+
* | `month` | `M` | months |
|
|
323
|
+
* | `year` | `y` | years |
|
|
324
|
+
* @param {number} number
|
|
325
|
+
* @param {string} [units]
|
|
326
|
+
* @return {HDate}
|
|
327
|
+
*/
|
|
328
|
+
add(number: number, units?: string | undefined): HDate;
|
|
329
|
+
/**
|
|
330
|
+
* Returns a cloned `HDate` object with a specified amount of time subracted
|
|
331
|
+
*
|
|
332
|
+
* Units are case insensitive, and support plural and short forms.
|
|
333
|
+
* Note, short forms are case sensitive.
|
|
334
|
+
*
|
|
335
|
+
* | Unit | Shorthand | Description
|
|
336
|
+
* | --- | --- | --- |
|
|
337
|
+
* | `day` | `d` | days |
|
|
338
|
+
* | `week` | `w` | weeks |
|
|
339
|
+
* | `month` | `M` | months |
|
|
340
|
+
* | `year` | `y` | years |
|
|
341
|
+
* @example
|
|
342
|
+
* import {HDate, months} from '@hebcal/core';
|
|
343
|
+
*
|
|
344
|
+
* const hd1 = new HDate(15, months.CHESHVAN, 5769);
|
|
345
|
+
* const hd2 = hd1.add(1, 'weeks'); // 7 Kislev 5769
|
|
346
|
+
* const hd3 = hd1.add(-3, 'M'); // 30 Av 5768
|
|
347
|
+
* @param {number} number
|
|
348
|
+
* @param {string} [units]
|
|
349
|
+
* @return {HDate}
|
|
350
|
+
*/
|
|
351
|
+
subtract(number: number, units?: string | undefined): HDate;
|
|
352
|
+
/**
|
|
353
|
+
* Returns the difference in days between the two given HDates.
|
|
354
|
+
*
|
|
355
|
+
* The result is positive if `this` date is comes chronologically
|
|
356
|
+
* after the `other` date, and negative
|
|
357
|
+
* if the order of the two dates is reversed.
|
|
358
|
+
*
|
|
359
|
+
* The result is zero if the two dates are identical.
|
|
360
|
+
* @example
|
|
361
|
+
* import {HDate, months} from '@hebcal/core';
|
|
362
|
+
*
|
|
363
|
+
* const hd1 = new HDate(25, months.KISLEV, 5770);
|
|
364
|
+
* const hd2 = new HDate(15, months.CHESHVAN, 5769);
|
|
365
|
+
* const days = hd1.deltaDays(hd2); // 394
|
|
366
|
+
* @param {HDate} other Hebrew date to compare
|
|
367
|
+
* @return {number}
|
|
368
|
+
*/
|
|
369
|
+
deltaDays(other: HDate): number;
|
|
370
|
+
/**
|
|
371
|
+
* Compares this date to another date, returning `true` if the dates match.
|
|
372
|
+
* @param {HDate} other Hebrew date to compare
|
|
373
|
+
* @return {boolean}
|
|
374
|
+
*/
|
|
375
|
+
isSameDate(other: HDate): boolean;
|
|
376
|
+
/** @return {string} */
|
|
377
|
+
toString(): string;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A simple Hebrew date object with numeric fields `yy`, `mm`, and `dd`
|
|
381
|
+
*/
|
|
382
|
+
export type SimpleHebrewDate = {
|
|
383
|
+
/**
|
|
384
|
+
* Hebrew year
|
|
385
|
+
*/
|
|
386
|
+
yy: number;
|
|
387
|
+
/**
|
|
388
|
+
* Hebrew month of year (1=NISAN, 7=TISHREI)
|
|
389
|
+
*/
|
|
390
|
+
mm: number;
|
|
391
|
+
/**
|
|
392
|
+
* Day of month (1-30)
|
|
393
|
+
*/
|
|
394
|
+
dd: number;
|
|
395
|
+
};
|