@hebcal/core 5.1.1 → 5.2.1

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.1.1 */
1
+ /*! @hebcal/core v5.2.1 */
2
2
  'use strict';
3
3
 
4
4
  /** @private */
@@ -1794,7 +1794,9 @@ const flags = {
1794
1794
  /** Daily page of Jerusalem Talmud (Yerushalmi) */
1795
1795
  YERUSHALMI_YOMI: 0x1000000,
1796
1796
  /** Nach Yomi */
1797
- NACH_YOMI: 0x2000000
1797
+ NACH_YOMI: 0x2000000,
1798
+ /** Daily Learning */
1799
+ DAILY_LEARNING: 0x4000000
1798
1800
  };
1799
1801
  const flagToCategory = [[flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [flags.CHANUKAH_CANDLES, 'holiday', 'major'], [flags.HEBREW_DATE, 'hebdate'], [flags.MINOR_FAST, 'holiday', 'fast'], [flags.MINOR_HOLIDAY, 'holiday', 'minor'], [flags.MODERN_HOLIDAY, 'holiday', 'modern'], [flags.MOLAD, 'molad'], [flags.OMER_COUNT, 'omer'], [flags.PARSHA_HASHAVUA, 'parashat'],
1800
1802
  // backwards-compat
@@ -3816,7 +3818,21 @@ class Zmanim {
3816
3818
  shkiah() {
3817
3819
  return this.sunset();
3818
3820
  }
3819
-
3821
+ /**
3822
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
3823
+ * between sunset and tzeis hakochavim.
3824
+ * One opinion on how to calculate this time is that
3825
+ * it is 13.5 minutes before tzies 7.083
3826
+ * @return {Date}
3827
+ */
3828
+ beinHaShmashos() {
3829
+ const tzeit = this.tzeit(7.083);
3830
+ const millis = tzeit.getTime();
3831
+ if (isNaN(millis)) {
3832
+ return tzeit;
3833
+ }
3834
+ return new Date(millis - 13.5 * 60 * 1000);
3835
+ }
3820
3836
  /**
3821
3837
  * Uses timeFormat to return a date like '20:34'
3822
3838
  * @param {Date} dt
@@ -4188,7 +4204,9 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4188
4204
  }
4189
4205
 
4190
4206
  /**
4191
- * Makes a candle-lighting event for Chankah (not on Friday/Saturday)
4207
+ * Makes a candle-lighting event for Chankah (not on Friday/Saturday).
4208
+ * At one point this used civil dusk (6 degrees below horizon).
4209
+ * Another source suggests 4.6667 degrees below horizon.
4192
4210
  * @private
4193
4211
  * @param {Event} ev
4194
4212
  * @param {HDate} hd
@@ -4198,8 +4216,7 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4198
4216
  function makeWeekdayChanukahCandleLighting(ev, hd, options) {
4199
4217
  const location = options.location;
4200
4218
  const zmanim = new Zmanim(location, hd.greg(), options.useElevation);
4201
- const candleLightingTime = zmanim.dusk();
4202
- // const candleLightingTime = zmanim.tzeit(4.6667);
4219
+ const candleLightingTime = zmanim.beinHaShmashos();
4203
4220
  return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, options);
4204
4221
  }
4205
4222
 
@@ -6317,7 +6334,7 @@ class DailyLearning {
6317
6334
  }
6318
6335
 
6319
6336
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6320
- const version = '5.1.1';
6337
+ const version = '5.2.1';
6321
6338
 
6322
6339
  const NONE$1 = 0;
6323
6340
  const HALF = 1;
@@ -7398,7 +7415,8 @@ class HebrewCalendar {
7398
7415
  *
7399
7416
  * If both `options.candlelighting=true` and `options.location` is specified,
7400
7417
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7401
- * Chanukah candle-lighting is at dusk (when the sun is 6. below the horizon in the evening)
7418
+ * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before
7419
+ * the sun is 7.083° below the horizon in the evening)
7402
7420
  * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7403
7421
  * Saturday night (see above).
7404
7422
  *
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.1.1 */
1
+ /*! @hebcal/core v5.2.1 */
2
2
  /** @private */
3
3
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4
4
  /** @private */
@@ -1792,7 +1792,9 @@ const flags = {
1792
1792
  /** Daily page of Jerusalem Talmud (Yerushalmi) */
1793
1793
  YERUSHALMI_YOMI: 0x1000000,
1794
1794
  /** Nach Yomi */
1795
- NACH_YOMI: 0x2000000
1795
+ NACH_YOMI: 0x2000000,
1796
+ /** Daily Learning */
1797
+ DAILY_LEARNING: 0x4000000
1796
1798
  };
1797
1799
  const flagToCategory = [[flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [flags.CHANUKAH_CANDLES, 'holiday', 'major'], [flags.HEBREW_DATE, 'hebdate'], [flags.MINOR_FAST, 'holiday', 'fast'], [flags.MINOR_HOLIDAY, 'holiday', 'minor'], [flags.MODERN_HOLIDAY, 'holiday', 'modern'], [flags.MOLAD, 'molad'], [flags.OMER_COUNT, 'omer'], [flags.PARSHA_HASHAVUA, 'parashat'],
1798
1800
  // backwards-compat
@@ -3814,7 +3816,21 @@ class Zmanim {
3814
3816
  shkiah() {
3815
3817
  return this.sunset();
3816
3818
  }
3817
-
3819
+ /**
3820
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
3821
+ * between sunset and tzeis hakochavim.
3822
+ * One opinion on how to calculate this time is that
3823
+ * it is 13.5 minutes before tzies 7.083
3824
+ * @return {Date}
3825
+ */
3826
+ beinHaShmashos() {
3827
+ const tzeit = this.tzeit(7.083);
3828
+ const millis = tzeit.getTime();
3829
+ if (isNaN(millis)) {
3830
+ return tzeit;
3831
+ }
3832
+ return new Date(millis - 13.5 * 60 * 1000);
3833
+ }
3818
3834
  /**
3819
3835
  * Uses timeFormat to return a date like '20:34'
3820
3836
  * @param {Date} dt
@@ -4186,7 +4202,9 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4186
4202
  }
4187
4203
 
4188
4204
  /**
4189
- * Makes a candle-lighting event for Chankah (not on Friday/Saturday)
4205
+ * Makes a candle-lighting event for Chankah (not on Friday/Saturday).
4206
+ * At one point this used civil dusk (6 degrees below horizon).
4207
+ * Another source suggests 4.6667 degrees below horizon.
4190
4208
  * @private
4191
4209
  * @param {Event} ev
4192
4210
  * @param {HDate} hd
@@ -4196,8 +4214,7 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4196
4214
  function makeWeekdayChanukahCandleLighting(ev, hd, options) {
4197
4215
  const location = options.location;
4198
4216
  const zmanim = new Zmanim(location, hd.greg(), options.useElevation);
4199
- const candleLightingTime = zmanim.dusk();
4200
- // const candleLightingTime = zmanim.tzeit(4.6667);
4217
+ const candleLightingTime = zmanim.beinHaShmashos();
4201
4218
  return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, options);
4202
4219
  }
4203
4220
 
@@ -6315,7 +6332,7 @@ class DailyLearning {
6315
6332
  }
6316
6333
 
6317
6334
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6318
- const version = '5.1.1';
6335
+ const version = '5.2.1';
6319
6336
 
6320
6337
  const NONE$1 = 0;
6321
6338
  const HALF = 1;
@@ -7396,7 +7413,8 @@ class HebrewCalendar {
7396
7413
  *
7397
7414
  * If both `options.candlelighting=true` and `options.location` is specified,
7398
7415
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7399
- * Chanukah candle-lighting is at dusk (when the sun is 6. below the horizon in the evening)
7416
+ * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before
7417
+ * the sun is 7.083° below the horizon in the evening)
7400
7418
  * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7401
7419
  * Saturday night (see above).
7402
7420
  *
package/hebcal.d.ts CHANGED
@@ -91,6 +91,8 @@ declare module '@hebcal/core' {
91
91
  YERUSHALMI_YOMI = 0x1000000,
92
92
  /** Nach Yomi */
93
93
  NACH_YOMI = 0x2000000,
94
+ /** Daily Learning */
95
+ DAILY_LEARNING = 0x4000000,
94
96
  }
95
97
 
96
98
  export type UnitTypeShort = 'd' | 'w' | 'M' | 'y';
@@ -455,6 +457,13 @@ declare module '@hebcal/core' {
455
457
  neitzHaChama(): Date;
456
458
  /** Alias for sunset */
457
459
  shkiah(): Date;
460
+ /**
461
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
462
+ * between sunset and tzeis hakochavim.
463
+ * One opinion on how to calculate this time is that
464
+ * it is 13.5 minutes before tzies 7.083
465
+ */
466
+ beinHaShmashos(): Date;
458
467
  /**
459
468
  * Returns sunrise + `offset` minutes (either positive or negative).
460
469
  * @param offset minutes
@@ -497,7 +506,7 @@ declare module '@hebcal/core' {
497
506
  * @param id - Message ID to translate
498
507
  * @param [locale] - Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
499
508
  */
500
- static lookupTranslation(id: string, locale?: string): string;
509
+ static lookupTranslation(id: string, locale?: string): string | undefined;
501
510
  /**
502
511
  * By default, if no translation was found, returns `id`.
503
512
  * @param id - Message ID to translate
@@ -700,7 +709,7 @@ declare module '@hebcal/core' {
700
709
  * @param date - Hebrew Date, Gregorian date, or absolute R.D. day number
701
710
  * @param il - use the Israeli schedule for holidays
702
711
  */
703
- static getHolidaysOnDate(date: HDate | Date | number, il?: boolean): Event[];
712
+ static getHolidaysOnDate(date: HDate | Date | number, il?: boolean): Event[] | undefined;
704
713
 
705
714
  /**
706
715
  * Calculates a birthday or anniversary (non-yahrzeit).
@@ -723,7 +732,7 @@ declare module '@hebcal/core' {
723
732
  * @param gdate - Gregorian or Hebrew date of event
724
733
  * @returns anniversary occurring in hyear
725
734
  */
726
- static getBirthdayOrAnniversary(hyear: number, gdate: Date | HDate): HDate;
735
+ static getBirthdayOrAnniversary(hyear: number, gdate: Date | HDate): HDate | undefined;
727
736
 
728
737
  /**
729
738
  * Calculates yahrzeit.
@@ -754,7 +763,7 @@ declare module '@hebcal/core' {
754
763
  * @param gdate - Gregorian or Hebrew date of death
755
764
  * @returns anniversary occurring in hyear
756
765
  */
757
- static getYahrzeit(hyear: number, gdate: Date | HDate): HDate;
766
+ static getYahrzeit(hyear: number, gdate: Date | HDate): HDate | undefined;
758
767
 
759
768
  /**
760
769
  * Helper function to format a 23-hour (00:00-23:59) time in US format ("8:13pm") or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.1.1",
3
+ "version": "5.2.1",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -51,7 +51,7 @@
51
51
  "prepublish": "npm run build",
52
52
  "po2json": "node ./po2json.cjs po/*.po",
53
53
  "version": "node ./version.cjs package.json src/pkgVersion.js",
54
- "readme": "npx -p jsdoc-to-markdown jsdoc2md dist/index.js",
54
+ "readme": "cp dist/index.mjs tmp.js && npx -p jsdoc-to-markdown jsdoc2md tmp.js && rm -f tmp.js",
55
55
  "pretest": "npm run build",
56
56
  "lint": "eslint src",
57
57
  "coverage": "nyc --concurrency 2 ava",
@@ -86,7 +86,7 @@
86
86
  "eslint": "^8.56.0",
87
87
  "eslint-config-google": "^0.14.0",
88
88
  "jsdoc": "^4.0.2",
89
- "jsdoc-to-markdown": "^8.0.0",
89
+ "jsdoc-to-markdown": "^8.0.1",
90
90
  "nyc": "^15.1.0",
91
91
  "quick-lru": "^7.0.0",
92
92
  "rollup": "^4.9.6",