@hebcal/core 5.4.0 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/locale.d.ts CHANGED
@@ -1,80 +1 @@
1
- /**
2
- * A locale in Hebcal is used for translations/transliterations of
3
- * holidays. `@hebcal/core` supports four locales by default
4
- * * `en` - default, Sephardic transliterations (e.g. "Shabbat")
5
- * * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
6
- * * `he` - Hebrew (e.g. "שַׁבָּת")
7
- * * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
8
- */
9
- export class Locale {
10
- /**
11
- * Returns translation only if `locale` offers a non-empty translation for `id`.
12
- * Otherwise, returns `undefined`.
13
- * @param {string} id Message ID to translate
14
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
15
- * @return {string | undefined}
16
- */
17
- static lookupTranslation(id: string, locale?: string | undefined): string | undefined;
18
- /**
19
- * By default, if no translation was found, returns `id`.
20
- * @param {string} id Message ID to translate
21
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
22
- * @return {string}
23
- */
24
- static gettext(id: string, locale?: string | undefined): string;
25
- /**
26
- * Register locale translations.
27
- * @param {string} locale Locale name (i.e.: `'he'`, `'fr'`)
28
- * @param {LocaleData} data parsed data from a `.po` file.
29
- */
30
- static addLocale(locale: string, data: LocaleData): void;
31
- /**
32
- * Adds a translation to `locale`, replacing any previous translation.
33
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
34
- * @param {string} id Message ID to translate
35
- * @param {string} translation Translation text
36
- */
37
- static addTranslation(locale: string, id: string, translation: string): void;
38
- /**
39
- * Adds multiple translations to `locale`, replacing any previous translations.
40
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
41
- * @param {LocaleData} data parsed data from a `.po` file.
42
- */
43
- static addTranslations(locale: string, data: LocaleData): void;
44
- /**
45
- * Activates a locale. Throws an error if the locale has not been previously added.
46
- * After setting the locale to be used, all strings marked for translations
47
- * will be represented by the corresponding translation in the specified locale.
48
- * @param {string} locale Locale name (i.e: `'he'`, `'fr'`)
49
- * @return {LocaleData}
50
- */
51
- static useLocale(locale: string): LocaleData;
52
- /**
53
- * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
54
- * @return {string}
55
- */
56
- static getLocaleName(): string;
57
- /**
58
- * Returns the names of registered locales
59
- * @return {string[]}
60
- */
61
- static getLocaleNames(): string[];
62
- /**
63
- * @param {number} n
64
- * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
65
- * @return {string}
66
- */
67
- static ordinal(n: number, locale?: string | undefined): string;
68
- /**
69
- * @private
70
- * @param {number} n
71
- * @return {string}
72
- */
73
- private static getEnOrdinal;
74
- /**
75
- * Removes nekudot from Hebrew string
76
- * @param {string} str
77
- * @return {string}
78
- */
79
- static hebrewStripNikkud(str: string): string;
80
- }
1
+ export {};
@@ -1,5 +1,41 @@
1
+ import { GeoLocation } from '@hebcal/noaa';
1
2
  /** Class representing Location */
2
- export class Location extends GeoLocation {
3
+ export declare class Location extends GeoLocation {
4
+ private readonly il;
5
+ private readonly cc?;
6
+ private readonly geoid?;
7
+ /**
8
+ * Initialize a Location instance
9
+ * @param {number} latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
10
+ * @param {number} longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
11
+ * @param {boolean} il - in Israel (true) or Diaspora (false)
12
+ * @param {string} tzid - Olson timezone ID, e.g. "America/Chicago"
13
+ * @param {string} [cityName] - optional descriptive city name
14
+ * @param {string} [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR")
15
+ * @param {string|number} [geoid] - optional string or numeric geographic ID
16
+ * @param {number} [elevation] - in meters (default `0`)
17
+ */
18
+ constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName?: string, countryCode?: string, geoid?: string | number, elevation?: number);
19
+ /** @return {boolean} */
20
+ getIsrael(): boolean;
21
+ /** @return {string | null} */
22
+ getName(): string | null;
23
+ /**
24
+ * Returns the location name, up to the first comma
25
+ * @return {string | null}
26
+ */
27
+ getShortName(): string | null;
28
+ /** @return {string | undefined} */
29
+ getCountryCode(): string | undefined;
30
+ /** @return {string} */
31
+ getTzid(): string;
32
+ /**
33
+ * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
34
+ * @return {Intl.DateTimeFormat}
35
+ */
36
+ getTimeFormatter(): Intl.DateTimeFormat;
37
+ /** @return {string | number | undefined} */
38
+ getGeoId(): string | number | undefined;
3
39
  /**
4
40
  * Creates a location object from one of 60 "classic" Hebcal city names.
5
41
  * The following city names are supported:
@@ -17,16 +53,18 @@ export class Location extends GeoLocation {
17
53
  * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
18
54
  * 'Washington DC', 'Worcester'
19
55
  * @param {string} name
20
- * @return {Location}
56
+ * @return {Location|undefined}
21
57
  */
22
- static lookup(name: string): Location;
58
+ static lookup(name: string): Location | undefined;
59
+ /** @return {string} */
60
+ toString(): string;
23
61
  /**
24
62
  * Converts legacy Hebcal timezone to a standard Olson tzid.
25
63
  * @param {number} tz integer, GMT offset in hours
26
64
  * @param {string} dst 'none', 'eu', 'usa', or 'israel'
27
- * @return {string}
65
+ * @return {string | undefined}
28
66
  */
29
- static legacyTzToTzid(tz: number, dst: string): string;
67
+ static legacyTzToTzid(tz: number, dst: string): string | undefined;
30
68
  /**
31
69
  * Converts timezone info from Zip-Codes.com to a standard Olson tzid.
32
70
  * @example
@@ -46,40 +84,4 @@ export class Location extends GeoLocation {
46
84
  * @return {boolean}
47
85
  */
48
86
  static addLocation(cityName: string, location: Location): boolean;
49
- /**
50
- * Initialize a Location instance
51
- * @param {number} latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
52
- * @param {number} longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
53
- * @param {boolean} il - in Israel (true) or Diaspora (false)
54
- * @param {string} tzid - Olson timezone ID, e.g. "America/Chicago"
55
- * @param {string} cityName - optional descriptive city name
56
- * @param {string} countryCode - ISO 3166 alpha-2 country code (e.g. "FR")
57
- * @param {string} [geoid] - optional string or numeric geographic ID
58
- * @param {number} [elevation] - in meters (default `0`)
59
- */
60
- constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName: string, countryCode: string, geoid?: string | undefined, elevation?: number | undefined);
61
- il: boolean;
62
- cc: string;
63
- geoid: string | undefined;
64
- /** @return {boolean} */
65
- getIsrael(): boolean;
66
- /** @return {string} */
67
- getName(): string;
68
- /**
69
- * Returns the location name, up to the first comma
70
- * @return {string}
71
- */
72
- getShortName(): string;
73
- /** @return {string} */
74
- getCountryCode(): string;
75
- /** @return {string} */
76
- getTzid(): string;
77
- /**
78
- * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
79
- * @return {Intl.DateTimeFormat}
80
- */
81
- getTimeFormatter(): Intl.DateTimeFormat;
82
- /** @return {string} */
83
- getGeoId(): string;
84
87
  }
85
- import { GeoLocation } from '@hebcal/noaa';
package/dist/modern.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { HDate } from '@hebcal/hdate';
1
2
  /**
2
3
  * Yom HaShoah first observed in 1951.
3
4
  * When the actual date of Yom Hashoah falls on a Friday, the
@@ -9,12 +10,11 @@
9
10
  * @param {number} year
10
11
  * @return {HDate|null}
11
12
  */
12
- export function dateYomHaShoah(year: number): HDate | null;
13
+ export declare function dateYomHaShoah(year: number): HDate | null;
13
14
  /**
14
15
  * Yom HaAtzma'ut only celebrated after 1948
15
16
  * @private
16
17
  * @param {number} year
17
18
  * @return {HDate|null}
18
19
  */
19
- export function dateYomHaZikaron(year: number): HDate | null;
20
- import { HDate } from '@hebcal/hdate';
20
+ export declare function dateYomHaZikaron(year: number): HDate | null;
package/dist/molad.d.ts CHANGED
@@ -1,19 +1,18 @@
1
+ import { Event } from './event';
2
+ import { CalOptions } from './CalOptions';
3
+ import { HDate } from '@hebcal/hdate';
4
+ import '../src/locale';
1
5
  /**
2
6
  * Represents a molad, the moment when the new moon is "born"
3
7
  */
4
- export class Molad {
8
+ export declare class Molad {
9
+ private readonly m;
5
10
  /**
6
11
  * Calculates the molad for a Hebrew month
7
12
  * @param {number} year
8
13
  * @param {number} month
9
14
  */
10
15
  constructor(year: number, month: number);
11
- year: number;
12
- month: number;
13
- dow: number;
14
- hour: number;
15
- minutes: number;
16
- chalakim: number;
17
16
  /**
18
17
  * @return {number}
19
18
  */
@@ -47,10 +46,12 @@ export class Molad {
47
46
  * @param {CalOptions} options
48
47
  * @return {string}
49
48
  */
50
- render(locale?: string | undefined, options: CalOptions): string;
49
+ render(locale?: string, options?: CalOptions): string;
51
50
  }
52
51
  /** Represents a Molad announcement on Shabbat Mevarchim */
53
- export class MoladEvent extends Event {
52
+ export declare class MoladEvent extends Event {
53
+ readonly molad: Molad;
54
+ private readonly options;
54
55
  /**
55
56
  * @param {HDate} date Hebrew date event occurs
56
57
  * @param {number} hyear molad year
@@ -58,8 +59,9 @@ export class MoladEvent extends Event {
58
59
  * @param {CalOptions} options
59
60
  */
60
61
  constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions);
61
- molad: Molad;
62
- options: CalOptions;
62
+ /**
63
+ * @param {string} [locale] Optional locale name (defaults to active locale).
64
+ * @return {string}
65
+ */
66
+ render(locale?: string): string;
63
67
  }
64
- import { Event } from './event.js';
65
- import { HDate } from '@hebcal/hdate';
package/dist/omer.d.ts CHANGED
@@ -1,18 +1,36 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import { Event } from './event';
3
+ import '../src/locale';
1
4
  /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
2
- export class OmerEvent extends Event {
5
+ export declare class OmerEvent extends Event {
6
+ private readonly weekNumber;
7
+ private readonly daysWithinWeeks;
8
+ readonly omer: number;
9
+ emoji?: string;
3
10
  /**
4
11
  * @param {HDate} date
5
12
  * @param {number} omerDay
6
13
  */
7
14
  constructor(date: HDate, omerDay: number);
8
- weekNumber: number;
9
- daysWithinWeeks: number;
10
- omer: number;
11
15
  /**
12
16
  * @param {string} lang
13
17
  * @return {string}
14
18
  */
15
19
  sefira(lang?: string): string;
20
+ /**
21
+ * @todo use gettext()
22
+ * @param {string} [locale] Optional locale name (defaults to active locale).
23
+ * @return {string}
24
+ */
25
+ render(locale?: string): string;
26
+ /**
27
+ * Returns translation of "Omer day 22" without ordinal numbers.
28
+ * @param {string} [locale] Optional locale name (defaults to active locale).
29
+ * @return {string}
30
+ */
31
+ renderBrief(locale?: string): string;
32
+ /** @return {string} */
33
+ getEmoji(): string;
16
34
  /** @return {number} */
17
35
  getWeeks(): number;
18
36
  /** @return {number} */
@@ -22,5 +40,6 @@ export class OmerEvent extends Event {
22
40
  * @return {string}
23
41
  */
24
42
  getTodayIs(locale: string): string;
43
+ /** @return {string} */
44
+ url(): string;
25
45
  }
26
- import { Event } from './event.js';
@@ -1 +1,2 @@
1
- export const version: "5.4.0";
1
+ /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
+ export declare const version = "5.4.2";
@@ -1,3 +1,4 @@
1
+ import { CalOptions } from './CalOptions';
1
2
  /**
2
3
  * @private
3
4
  * @param {string} timeStr - original time like "20:30"
@@ -5,4 +6,4 @@
5
6
  * @param {CalOptions} options
6
7
  * @return {string}
7
8
  */
8
- export function reformatTimeStr(timeStr: string, suffix: string, options: CalOptions): string;
9
+ export declare function reformatTimeStr(timeStr: string, suffix: string, options?: CalOptions): string;
package/dist/sedra.d.ts CHANGED
@@ -1,8 +1,100 @@
1
+ import { HDate } from '@hebcal/hdate';
2
+ import '../src/locale';
3
+ /** The result from `Sedra.lookup()` */
4
+ export type SedraResult = {
5
+ /**
6
+ * Name of the parsha (or parshiyot) read on
7
+ * Hebrew date, e.g. `['Noach']` or `['Matot', 'Masei']`
8
+ */
9
+ parsha: string[];
10
+ /**
11
+ * True if this is a regular parasha HaShavua
12
+ * Torah reading, false if it's a special holiday reading
13
+ */
14
+ chag: boolean;
15
+ /**
16
+ * The parsha number (or numbers) using 1-indexing.
17
+ * A `number` for a regular (single) parsha, and a `number[]`
18
+ * for a doubled parsha.
19
+ * For Parashat *Bereshit*, `num` would be equal to `1`, and for
20
+ * *Matot-Masei* it would be `[42, 43]`
21
+ */
22
+ num?: number | number[];
23
+ };
24
+ /**
25
+ * Represents Parashah HaShavua for an entire Hebrew year
26
+ */
27
+ export declare class Sedra {
28
+ private readonly year;
29
+ private readonly il;
30
+ private readonly firstSaturday;
31
+ private readonly theSedraArray;
32
+ /**
33
+ * Caculates the Parashah HaShavua for an entire Hebrew year
34
+ * @param {number} hyear - Hebrew year (e.g. 5749)
35
+ * @param {boolean} il - Use Israel sedra schedule (false for Diaspora)
36
+ */
37
+ constructor(hyear: number, il: boolean);
38
+ /**
39
+ * Returns the parsha (or parshiyot) read on Hebrew date
40
+ * @param {HDate|number} hd Hebrew date or R.D. days
41
+ * @return {string[]}
42
+ */
43
+ get(hd: HDate | number): string[];
44
+ /**
45
+ * Looks up parsha for the date, then returns a translated or transliterated string
46
+ * @param {HDate|number} hd Hebrew date or R.D. days
47
+ * @param {string} [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale
48
+ * @return {string}
49
+ */
50
+ getString(hd: HDate | number, locale?: string): string;
51
+ /**
52
+ * Checks to see if this day would be a regular parasha HaShavua
53
+ * Torah reading or special holiday reading
54
+ * @param {HDate|number} hd Hebrew date or R.D. days
55
+ * @return {boolean}
56
+ */
57
+ isParsha(hd: HDate | number): boolean;
58
+ /**
59
+ * Returns the date that a parsha occurs
60
+ * or `null` if the parsha doesn't occur this year
61
+ * @param {number|string|string[]} parsha
62
+ * @return {HDate|null}
63
+ */
64
+ find(parsha: number | string | string[]): HDate | null;
65
+ /**
66
+ * Returns the underlying annual sedra schedule.
67
+ * Used by `@hebcal/triennial`
68
+ * @return {NumberOrString[]}
69
+ */
70
+ getSedraArray(): NumberOrString[];
71
+ /**
72
+ * R.D. date of the first Saturday on or after Rosh Hashana
73
+ * @return {number}
74
+ */
75
+ getFirstSaturday(): number;
76
+ /** @return {number} */
77
+ getYear(): number;
78
+ /**
79
+ * Returns an object describing the parsha on the first Saturday on or after `hd`
80
+ * @param {HDate|number} hd Hebrew date or R.D. days
81
+ * @return {SedraResult}
82
+ */
83
+ lookup(hd: HDate | number): SedraResult;
84
+ }
85
+ /**
86
+ * The 54 parshiyot of the Torah as transilterated strings
87
+ * parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[52] == "Ha'azinu".
88
+ * @readonly
89
+ * @type {string[]}
90
+ */
91
+ export declare const parshiot: string[];
92
+ type NumberOrString = number | string;
1
93
  /**
2
94
  * @private
3
95
  * @param {number} hyear
4
96
  * @param {boolean} il
5
97
  * @return {Sedra}
6
98
  */
7
- export function getSedra_(hyear: number, il: boolean): Sedra;
8
- import { Sedra } from '@hebcal/hdate';
99
+ export declare function getSedra_(hyear: number, il: boolean): Sedra;
100
+ export {};