@hebcal/core 5.1.0 → 5.2.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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.1.0 */
1
+ /*! @hebcal/core v5.2.0 */
2
2
  'use strict';
3
3
 
4
4
  /** @private */
@@ -1696,7 +1696,11 @@ function fixDate(date) {
1696
1696
  date.yy += 1;
1697
1697
  }
1698
1698
  date.dd -= daysInMonth(date.mm, date.yy);
1699
- date.mm += 1;
1699
+ if (date.mm === monthsInYear(date.yy)) {
1700
+ date.mm = 1; // rollover to NISAN
1701
+ } else {
1702
+ date.mm += 1;
1703
+ }
1700
1704
  fix(date);
1701
1705
  }
1702
1706
  fixMonth(date);
@@ -3812,7 +3816,21 @@ class Zmanim {
3812
3816
  shkiah() {
3813
3817
  return this.sunset();
3814
3818
  }
3815
-
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
+ }
3816
3834
  /**
3817
3835
  * Uses timeFormat to return a date like '20:34'
3818
3836
  * @param {Date} dt
@@ -4184,7 +4202,9 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4184
4202
  }
4185
4203
 
4186
4204
  /**
4187
- * 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.
4188
4208
  * @private
4189
4209
  * @param {Event} ev
4190
4210
  * @param {HDate} hd
@@ -4194,8 +4214,7 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4194
4214
  function makeWeekdayChanukahCandleLighting(ev, hd, options) {
4195
4215
  const location = options.location;
4196
4216
  const zmanim = new Zmanim(location, hd.greg(), options.useElevation);
4197
- const candleLightingTime = zmanim.dusk();
4198
- // const candleLightingTime = zmanim.tzeit(4.6667);
4217
+ const candleLightingTime = zmanim.beinHaShmashos();
4199
4218
  return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, options);
4200
4219
  }
4201
4220
 
@@ -6313,7 +6332,7 @@ class DailyLearning {
6313
6332
  }
6314
6333
 
6315
6334
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6316
- const version = '5.1.0';
6335
+ const version = '5.2.0';
6317
6336
 
6318
6337
  const NONE$1 = 0;
6319
6338
  const HALF = 1;
@@ -7394,7 +7413,8 @@ class HebrewCalendar {
7394
7413
  *
7395
7414
  * If both `options.candlelighting=true` and `options.location` is specified,
7396
7415
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7397
- * 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)
7398
7418
  * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7399
7419
  * Saturday night (see above).
7400
7420
  *
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.1.0 */
1
+ /*! @hebcal/core v5.2.0 */
2
2
  /** @private */
3
3
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4
4
  /** @private */
@@ -1694,7 +1694,11 @@ function fixDate(date) {
1694
1694
  date.yy += 1;
1695
1695
  }
1696
1696
  date.dd -= daysInMonth(date.mm, date.yy);
1697
- date.mm += 1;
1697
+ if (date.mm === monthsInYear(date.yy)) {
1698
+ date.mm = 1; // rollover to NISAN
1699
+ } else {
1700
+ date.mm += 1;
1701
+ }
1698
1702
  fix(date);
1699
1703
  }
1700
1704
  fixMonth(date);
@@ -3810,7 +3814,21 @@ class Zmanim {
3810
3814
  shkiah() {
3811
3815
  return this.sunset();
3812
3816
  }
3813
-
3817
+ /**
3818
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
3819
+ * between sunset and tzeis hakochavim.
3820
+ * One opinion on how to calculate this time is that
3821
+ * it is 13.5 minutes before tzies 7.083
3822
+ * @return {Date}
3823
+ */
3824
+ beinHaShmashos() {
3825
+ const tzeit = this.tzeit(7.083);
3826
+ const millis = tzeit.getTime();
3827
+ if (isNaN(millis)) {
3828
+ return tzeit;
3829
+ }
3830
+ return new Date(millis - 13.5 * 60 * 1000);
3831
+ }
3814
3832
  /**
3815
3833
  * Uses timeFormat to return a date like '20:34'
3816
3834
  * @param {Date} dt
@@ -4182,7 +4200,9 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4182
4200
  }
4183
4201
 
4184
4202
  /**
4185
- * Makes a candle-lighting event for Chankah (not on Friday/Saturday)
4203
+ * Makes a candle-lighting event for Chankah (not on Friday/Saturday).
4204
+ * At one point this used civil dusk (6 degrees below horizon).
4205
+ * Another source suggests 4.6667 degrees below horizon.
4186
4206
  * @private
4187
4207
  * @param {Event} ev
4188
4208
  * @param {HDate} hd
@@ -4192,8 +4212,7 @@ function makeTimedEvent(hd, time, desc, ev, options) {
4192
4212
  function makeWeekdayChanukahCandleLighting(ev, hd, options) {
4193
4213
  const location = options.location;
4194
4214
  const zmanim = new Zmanim(location, hd.greg(), options.useElevation);
4195
- const candleLightingTime = zmanim.dusk();
4196
- // const candleLightingTime = zmanim.tzeit(4.6667);
4215
+ const candleLightingTime = zmanim.beinHaShmashos();
4197
4216
  return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, options);
4198
4217
  }
4199
4218
 
@@ -6311,7 +6330,7 @@ class DailyLearning {
6311
6330
  }
6312
6331
 
6313
6332
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
6314
- const version = '5.1.0';
6333
+ const version = '5.2.0';
6315
6334
 
6316
6335
  const NONE$1 = 0;
6317
6336
  const HALF = 1;
@@ -7392,7 +7411,8 @@ class HebrewCalendar {
7392
7411
  *
7393
7412
  * If both `options.candlelighting=true` and `options.location` is specified,
7394
7413
  * Chanukah candle-lighting times and minor fast start/end times will also be generated.
7395
- * Chanukah candle-lighting is at dusk (when the sun is 6. below the horizon in the evening)
7414
+ * Chanukah candle-lighting is at Bein HaShmashos (13.5 minutes before
7415
+ * the sun is 7.083° below the horizon in the evening)
7396
7416
  * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on
7397
7417
  * Saturday night (see above).
7398
7418
  *
package/hebcal.d.ts CHANGED
@@ -455,6 +455,13 @@ declare module '@hebcal/core' {
455
455
  neitzHaChama(): Date;
456
456
  /** Alias for sunset */
457
457
  shkiah(): Date;
458
+ /**
459
+ * Rabbeinu Tam holds that bein hashmashos is a specific time
460
+ * between sunset and tzeis hakochavim.
461
+ * One opinion on how to calculate this time is that
462
+ * it is 13.5 minutes before tzies 7.083
463
+ */
464
+ beinHaShmashos(): Date;
458
465
  /**
459
466
  * Returns sunrise + `offset` minutes (either positive or negative).
460
467
  * @param offset minutes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
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",
@@ -71,8 +71,8 @@
71
71
  "temporal-polyfill": "^0.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@babel/core": "^7.23.7",
75
- "@babel/preset-env": "^7.23.8",
74
+ "@babel/core": "^7.23.9",
75
+ "@babel/preset-env": "^7.23.9",
76
76
  "@babel/register": "^7.23.7",
77
77
  "@hebcal/hdate": "^0.9.1",
78
78
  "@hebcal/noaa": "^0.8.11",
@@ -81,15 +81,15 @@
81
81
  "@rollup/plugin-json": "^6.1.0",
82
82
  "@rollup/plugin-node-resolve": "^15.2.3",
83
83
  "@rollup/plugin-terser": "^0.4.4",
84
- "ava": "^6.0.1",
85
- "core-js": "^3.35.0",
84
+ "ava": "^6.1.1",
85
+ "core-js": "^3.35.1",
86
86
  "eslint": "^8.56.0",
87
87
  "eslint-config-google": "^0.14.0",
88
88
  "jsdoc": "^4.0.2",
89
89
  "jsdoc-to-markdown": "^8.0.0",
90
90
  "nyc": "^15.1.0",
91
91
  "quick-lru": "^7.0.0",
92
- "rollup": "^4.9.5",
92
+ "rollup": "^4.9.6",
93
93
  "ttag-cli": "^1.10.10"
94
94
  }
95
95
  }