@hebcal/core 3.33.4 → 3.33.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -261
- package/dist/bundle.js +408 -303
- package/dist/bundle.min.js +2 -2
- package/dist/hdate-bundle.js +312 -244
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +77 -62
- package/dist/hdate.mjs +77 -62
- package/dist/index.js +190 -118
- package/dist/index.mjs +174 -122
- package/hebcal.d.ts +116 -115
- package/package.json +3 -3
package/hebcal.d.ts
CHANGED
|
@@ -417,6 +417,18 @@ declare module '@hebcal/core' {
|
|
|
417
417
|
tzeitTime(angle: number, timeFormat: Intl.DateTimeFormat): any[];
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
export interface Headers {
|
|
421
|
+
'content-type'?: string;
|
|
422
|
+
'plural-forms'?: string;
|
|
423
|
+
}
|
|
424
|
+
export interface Translations {
|
|
425
|
+
[key: string]: any;
|
|
426
|
+
}
|
|
427
|
+
export interface LocaleData {
|
|
428
|
+
headers: Headers;
|
|
429
|
+
translations: Translations;
|
|
430
|
+
}
|
|
431
|
+
|
|
420
432
|
/**
|
|
421
433
|
* A locale in Hebcal is used for translations/transliterations of
|
|
422
434
|
* holidays. @hebcal/core supports three locales by default
|
|
@@ -424,54 +436,43 @@ declare module '@hebcal/core' {
|
|
|
424
436
|
* * `ashkenazi` - Ashkenazi transliterations (e.g. "Shabbos")
|
|
425
437
|
* * `he` - Hebrew (e.g. "שַׁבָּת")
|
|
426
438
|
*/
|
|
427
|
-
export
|
|
428
|
-
export interface Headers {
|
|
429
|
-
'content-type'?: string;
|
|
430
|
-
'plural-forms'?: string;
|
|
431
|
-
}
|
|
432
|
-
export interface Translations {
|
|
433
|
-
[key: string]: any;
|
|
434
|
-
}
|
|
435
|
-
export interface LocaleData {
|
|
436
|
-
headers: Headers;
|
|
437
|
-
translations: Translations;
|
|
438
|
-
}
|
|
439
|
+
export class Locale {
|
|
439
440
|
/**
|
|
440
441
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
441
442
|
* Otherwise, returns `undefined`.
|
|
442
443
|
* @param id - Message ID to translate
|
|
443
444
|
* @param [locale] - Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
444
445
|
*/
|
|
445
|
-
|
|
446
|
+
static lookupTranslation(id: string, locale?: string): string;
|
|
446
447
|
/**
|
|
447
448
|
* By default, if no translation was found, returns `id`.
|
|
448
449
|
* @param id - Message ID to translate
|
|
449
450
|
* @param [locale] - Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
450
451
|
*/
|
|
451
|
-
|
|
452
|
+
static gettext(id: string, locale?: string): string;
|
|
452
453
|
/**
|
|
453
454
|
* Register locale translations.
|
|
454
455
|
* @param locale - Locale name (i.e.: `'he'`, `'fr'`)
|
|
455
456
|
* @param data - parsed data from a `.po` file.
|
|
456
457
|
*/
|
|
457
|
-
|
|
458
|
+
static addLocale(locale: string, data: LocaleData): void;
|
|
458
459
|
/**
|
|
459
460
|
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
460
461
|
* After setting the locale to be used, all strings marked for translations
|
|
461
462
|
* will be represented by the corresponding translation in the specified locale.
|
|
462
463
|
* @param locale - Locale name (i.e: `'he'`, `'fr'`)
|
|
463
464
|
*/
|
|
464
|
-
|
|
465
|
+
static useLocale(locale: string): LocaleData;
|
|
465
466
|
/**
|
|
466
467
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
467
468
|
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
static getLocaleName(): string;
|
|
470
|
+
static getLocaleNames(): string[];
|
|
471
|
+
static ordinal(n: number, locale?: string): string;
|
|
471
472
|
/**
|
|
472
473
|
* Removes nekudot from Hebrew string
|
|
473
474
|
*/
|
|
474
|
-
|
|
475
|
+
static hebrewStripNikkud(str: string): string;
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
/**
|
|
@@ -486,89 +487,89 @@ declare module '@hebcal/core' {
|
|
|
486
487
|
dd: number;
|
|
487
488
|
};
|
|
488
489
|
|
|
490
|
+
/**
|
|
491
|
+
* Options to configure which events are returned
|
|
492
|
+
*/
|
|
493
|
+
export type CalOptions = {
|
|
494
|
+
/** latitude/longitude/tzid used for candle-lighting */
|
|
495
|
+
location?: Location;
|
|
496
|
+
/** Gregorian or Hebrew year */
|
|
497
|
+
year?: number;
|
|
498
|
+
/** to interpret year as Hebrew year */
|
|
499
|
+
isHebrewYear?: boolean;
|
|
500
|
+
/** Gregorian or Hebrew month (to filter results to a single month) */
|
|
501
|
+
month?: number;
|
|
502
|
+
/** generate calendar for multiple years (default 1) */
|
|
503
|
+
numYears?: number;
|
|
504
|
+
/** use specific start date (requires end date) */
|
|
505
|
+
start?: Date | HDate | number;
|
|
506
|
+
/** use specific end date (requires start date) */
|
|
507
|
+
end?: Date | HDate | number;
|
|
508
|
+
/** calculate candle-lighting and havdalah times */
|
|
509
|
+
candlelighting?: boolean;
|
|
510
|
+
/** minutes before sundown to light candles (default 18) */
|
|
511
|
+
candleLightingMins?: number;
|
|
512
|
+
/**
|
|
513
|
+
* minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
514
|
+
* If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
|
|
515
|
+
* Nightfall (the point when 3 small stars are observable in the night time sky with
|
|
516
|
+
* the naked eye). If `0`, Havdalah times are supressed.
|
|
517
|
+
*/
|
|
518
|
+
havdalahMins?: number;
|
|
519
|
+
/**
|
|
520
|
+
* degrees for solar depression for Havdalah.
|
|
521
|
+
* Default is 8.5 degrees for 3 small stars.
|
|
522
|
+
* Use 7.083 degress for 3 medium-sized stars.
|
|
523
|
+
* Havdalah times are supressed when `havdalahDeg=0`.
|
|
524
|
+
*/
|
|
525
|
+
havdalahDeg?: number;
|
|
526
|
+
/** calculate parashah hashavua on Saturdays */
|
|
527
|
+
sedrot?: boolean;
|
|
528
|
+
/** Israeli holiday and sedra schedule */
|
|
529
|
+
il?: boolean;
|
|
530
|
+
/** suppress minor fasts */
|
|
531
|
+
noMinorFast?: boolean;
|
|
532
|
+
/** suppress modern holidays */
|
|
533
|
+
noModern?: boolean;
|
|
534
|
+
/** suppress Rosh Chodesh & Shabbat Mevarchim */
|
|
535
|
+
noRoshChodesh?: boolean;
|
|
536
|
+
shabbatMevarchim?: boolean;
|
|
537
|
+
/** suppress Special Shabbat */
|
|
538
|
+
noSpecialShabbat?: boolean;
|
|
539
|
+
/** suppress regular holidays */
|
|
540
|
+
noHolidays?: boolean;
|
|
541
|
+
/** include Daf Yomi */
|
|
542
|
+
dafyomi?: boolean;
|
|
543
|
+
/** include Mishna Yomi */
|
|
544
|
+
mishnaYomi?: boolean;
|
|
545
|
+
/** include Days of the Omer */
|
|
546
|
+
omer?: boolean;
|
|
547
|
+
/** include event announcing the molad */
|
|
548
|
+
molad?: boolean;
|
|
549
|
+
/** use Ashkenazi transliterations for event titles (default Sephardi transliterations) */
|
|
550
|
+
ashkenazi?: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* translate event titles according to a locale
|
|
553
|
+
* Default value is `en`, also built-in are `he` and `ashkenazi`.
|
|
554
|
+
* Additional locales (such as `ru` or `fr`) are provided by the
|
|
555
|
+
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
556
|
+
*/
|
|
557
|
+
locale?: string;
|
|
558
|
+
/** print the Hebrew date for the entire date range */
|
|
559
|
+
addHebrewDates?: boolean;
|
|
560
|
+
/** print the Hebrew date for dates with some events */
|
|
561
|
+
addHebrewDatesForEvents?: boolean;
|
|
562
|
+
/** use bitmask from `flags` to filter events */
|
|
563
|
+
mask?: number;
|
|
564
|
+
};
|
|
565
|
+
|
|
489
566
|
/**
|
|
490
567
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
491
568
|
* This class is used to calculate holidays, rosh chodesh, candle lighting & havdalah times,
|
|
492
569
|
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
493
570
|
* Event names can be rendered in several languges using the `locale` option.
|
|
494
571
|
*/
|
|
495
|
-
export
|
|
496
|
-
/**
|
|
497
|
-
* Options to configure which events are returned
|
|
498
|
-
*/
|
|
499
|
-
export type Options = {
|
|
500
|
-
/** latitude/longitude/tzid used for candle-lighting */
|
|
501
|
-
location?: Location;
|
|
502
|
-
/** Gregorian or Hebrew year */
|
|
503
|
-
year?: number;
|
|
504
|
-
/** to interpret year as Hebrew year */
|
|
505
|
-
isHebrewYear?: boolean;
|
|
506
|
-
/** Gregorian or Hebrew month (to filter results to a single month) */
|
|
507
|
-
month?: number;
|
|
508
|
-
/** generate calendar for multiple years (default 1) */
|
|
509
|
-
numYears?: number;
|
|
510
|
-
/** use specific start date (requires end date) */
|
|
511
|
-
start?: Date | HDate | number;
|
|
512
|
-
/** use specific end date (requires start date) */
|
|
513
|
-
end?: Date | HDate | number;
|
|
514
|
-
/** calculate candle-lighting and havdalah times */
|
|
515
|
-
candlelighting?: boolean;
|
|
516
|
-
/** minutes before sundown to light candles (default 18) */
|
|
517
|
-
candleLightingMins?: number;
|
|
518
|
-
/**
|
|
519
|
-
* minutes after sundown for Havdalah (typical values are 42, 50, or 72).
|
|
520
|
-
* If `undefined` (the default), calculate Havdalah according to Tzeit Hakochavim -
|
|
521
|
-
* Nightfall (the point when 3 small stars are observable in the night time sky with
|
|
522
|
-
* the naked eye). If `0`, Havdalah times are supressed.
|
|
523
|
-
*/
|
|
524
|
-
havdalahMins?: number;
|
|
525
|
-
/**
|
|
526
|
-
* degrees for solar depression for Havdalah.
|
|
527
|
-
* Default is 8.5 degrees for 3 small stars.
|
|
528
|
-
* Use 7.083 degress for 3 medium-sized stars.
|
|
529
|
-
* Havdalah times are supressed when `havdalahDeg=0`.
|
|
530
|
-
*/
|
|
531
|
-
havdalahDeg?: number;
|
|
532
|
-
/** calculate parashah hashavua on Saturdays */
|
|
533
|
-
sedrot?: boolean;
|
|
534
|
-
/** Israeli holiday and sedra schedule */
|
|
535
|
-
il?: boolean;
|
|
536
|
-
/** suppress minor fasts */
|
|
537
|
-
noMinorFast?: boolean;
|
|
538
|
-
/** suppress modern holidays */
|
|
539
|
-
noModern?: boolean;
|
|
540
|
-
/** suppress Rosh Chodesh & Shabbat Mevarchim */
|
|
541
|
-
noRoshChodesh?: boolean;
|
|
542
|
-
shabbatMevarchim?: boolean;
|
|
543
|
-
/** suppress Special Shabbat */
|
|
544
|
-
noSpecialShabbat?: boolean;
|
|
545
|
-
/** suppress regular holidays */
|
|
546
|
-
noHolidays?: boolean;
|
|
547
|
-
/** include Daf Yomi */
|
|
548
|
-
dafyomi?: boolean;
|
|
549
|
-
/** include Mishna Yomi */
|
|
550
|
-
mishnaYomi?: boolean;
|
|
551
|
-
/** include Days of the Omer */
|
|
552
|
-
omer?: boolean;
|
|
553
|
-
/** include event announcing the molad */
|
|
554
|
-
molad?: boolean;
|
|
555
|
-
/** use Ashkenazi transliterations for event titles (default Sephardi transliterations) */
|
|
556
|
-
ashkenazi?: boolean;
|
|
557
|
-
/**
|
|
558
|
-
* translate event titles according to a locale
|
|
559
|
-
* Default value is `en`, also built-in are `he` and `ashkenazi`.
|
|
560
|
-
* Additional locales (such as `ru` or `fr`) are provided by the
|
|
561
|
-
* {@link https://github.com/hebcal/hebcal-locales @hebcal/locales} package
|
|
562
|
-
*/
|
|
563
|
-
locale?: string;
|
|
564
|
-
/** print the Hebrew date for the entire date range */
|
|
565
|
-
addHebrewDates?: boolean;
|
|
566
|
-
/** print the Hebrew date for dates with some events */
|
|
567
|
-
addHebrewDatesForEvents?: boolean;
|
|
568
|
-
/** use bitmask from `flags` to filter events */
|
|
569
|
-
mask?: number;
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
+
export class HebrewCalendar {
|
|
572
573
|
/**
|
|
573
574
|
* Generates a list of holidays and other hebrew date events based on `options`.
|
|
574
575
|
* This is the main interface to the `@hebcal/core` library, and can be used to
|
|
@@ -576,7 +577,7 @@ declare module '@hebcal/core' {
|
|
|
576
577
|
* Parashat HaShavua, Daf Yomi, days of the omer, and the molad.
|
|
577
578
|
* Event names can be rendered in several languges using the `locale` option.
|
|
578
579
|
*/
|
|
579
|
-
|
|
580
|
+
static calendar(options: CalOptions): Event[];
|
|
580
581
|
|
|
581
582
|
/**
|
|
582
583
|
* Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
|
|
@@ -584,21 +585,21 @@ declare module '@hebcal/core' {
|
|
|
584
585
|
* or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme
|
|
585
586
|
* @param year - Hebrew year
|
|
586
587
|
*/
|
|
587
|
-
|
|
588
|
+
static getHolidaysForYear(year: number): Map<string, Event[]>;
|
|
588
589
|
|
|
589
590
|
/**
|
|
590
591
|
* Returns an array of holidays for the year
|
|
591
592
|
* @param year - Hebrew year
|
|
592
593
|
* @param il - use the Israeli schedule for holidays
|
|
593
594
|
*/
|
|
594
|
-
|
|
595
|
+
static getHolidaysForYearArray(year: number, il: boolean): Event[];
|
|
595
596
|
|
|
596
597
|
/**
|
|
597
598
|
* Returns an array of Events on this date (or undefined if no events)
|
|
598
599
|
* @param date - Hebrew Date, Gregorian date, or absolute R.D. day number
|
|
599
600
|
* @param il - use the Israeli schedule for holidays
|
|
600
601
|
*/
|
|
601
|
-
|
|
602
|
+
static getHolidaysOnDate(date: HDate | Date | number, il?: boolean): Event[];
|
|
602
603
|
|
|
603
604
|
/**
|
|
604
605
|
* Calculates a birthday or anniversary (non-yahrzeit).
|
|
@@ -621,7 +622,7 @@ declare module '@hebcal/core' {
|
|
|
621
622
|
* @param gdate - Gregorian or Hebrew date of event
|
|
622
623
|
* @returns anniversary occurring in hyear
|
|
623
624
|
*/
|
|
624
|
-
|
|
625
|
+
static getBirthdayOrAnniversary(hyear: number, gdate: Date | HDate): HDate;
|
|
625
626
|
|
|
626
627
|
/**
|
|
627
628
|
* Calculates yahrzeit.
|
|
@@ -652,25 +653,25 @@ declare module '@hebcal/core' {
|
|
|
652
653
|
* @param gdate - Gregorian or Hebrew date of death
|
|
653
654
|
* @returns anniversary occurring in hyear
|
|
654
655
|
*/
|
|
655
|
-
|
|
656
|
+
static getYahrzeit(hyear: number, gdate: Date | HDate): HDate;
|
|
656
657
|
|
|
657
658
|
/**
|
|
658
659
|
* Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
|
|
659
|
-
* keep as "20:13" for any other locale/country. Uses `
|
|
660
|
+
* keep as "20:13" for any other locale/country. Uses `Options` to determine
|
|
660
661
|
* locale.
|
|
661
662
|
* @param timeStr - original time like "20:30"
|
|
662
663
|
* @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
|
|
663
664
|
* @param options
|
|
664
665
|
*/
|
|
665
|
-
|
|
666
|
+
static reformatTimeStr(timeStr: string, suffix: string, options: CalOptions): string;
|
|
666
667
|
|
|
667
|
-
|
|
668
|
+
static version(): string;
|
|
668
669
|
|
|
669
670
|
/**
|
|
670
671
|
* Convenience function to create an instance of `Sedra` or reuse a previously
|
|
671
672
|
* created and cached instance.
|
|
672
673
|
*/
|
|
673
|
-
|
|
674
|
+
static getSedra(hyear: number, il: boolean): Sedra;
|
|
674
675
|
}
|
|
675
676
|
|
|
676
677
|
/**
|
|
@@ -723,36 +724,36 @@ declare module '@hebcal/core' {
|
|
|
723
724
|
/**
|
|
724
725
|
* Gregorian date helper functions.
|
|
725
726
|
*/
|
|
726
|
-
export
|
|
727
|
+
export class greg {
|
|
727
728
|
/**
|
|
728
729
|
* Long names of the Gregorian months (1='January', 12='December')
|
|
729
730
|
*/
|
|
730
|
-
|
|
731
|
+
static monthNames: string[];
|
|
731
732
|
/**
|
|
732
733
|
* Returns true if the object is a Javascript Date
|
|
733
734
|
*/
|
|
734
|
-
|
|
735
|
+
static isDate(obj: any): boolean;
|
|
735
736
|
/**
|
|
736
737
|
* Returns true if the Gregorian year is a leap year
|
|
737
738
|
* @param year - Gregorian year
|
|
738
739
|
*/
|
|
739
|
-
|
|
740
|
+
static isLeapYear(year: number): boolean;
|
|
740
741
|
/**
|
|
741
742
|
* Number of days in the Gregorian month for given year
|
|
742
743
|
* @param month - Gregorian month (1=January, 12=December)
|
|
743
744
|
* @param year - Gregorian year
|
|
744
745
|
*/
|
|
745
|
-
|
|
746
|
+
static daysInMonth(month: number, year: number): number;
|
|
746
747
|
/**
|
|
747
748
|
* Returns number of days since January 1 of that year
|
|
748
749
|
* @param date - Gregorian date
|
|
749
750
|
*/
|
|
750
|
-
|
|
751
|
+
static dayOfYear(date: Date): number;
|
|
751
752
|
/**
|
|
752
753
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
753
754
|
* @param date - Gregorian date
|
|
754
755
|
*/
|
|
755
|
-
|
|
756
|
+
static greg2abs(date: Date): number;
|
|
756
757
|
/**
|
|
757
758
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
758
759
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
@@ -761,7 +762,7 @@ declare module '@hebcal/core' {
|
|
|
761
762
|
* (April, 1993), pages 383-404 for an explanation.
|
|
762
763
|
* @param theDate - R.D. number of days
|
|
763
764
|
*/
|
|
764
|
-
|
|
765
|
+
static abs2greg(theDate: number): Date;
|
|
765
766
|
}
|
|
766
767
|
|
|
767
768
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "3.33.
|
|
3
|
+
"version": "3.33.7",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"pretest": "npm run build",
|
|
48
48
|
"typedef": "npx jsdoc -t node_modules/tsd-jsdoc/dist -r ./src/",
|
|
49
49
|
"lint": "eslint src",
|
|
50
|
-
"coverage": "nyc ava",
|
|
51
|
-
"test": "ava"
|
|
50
|
+
"coverage": "nyc ava --concurrency 2",
|
|
51
|
+
"test": "ava --concurrency 3"
|
|
52
52
|
},
|
|
53
53
|
"license": "GPL-2.0",
|
|
54
54
|
"ava": {
|