diff --git a/README.md b/README.md index 3e2ac6e..b8f5c71 100644 --- a/README.md +++ b/README.md @@ -768,6 +768,7 @@ Class representing halachic times * [.sunrise()](#Zmanim+sunrise) ⇒ <code>Date</code> * [.sunset()](#Zmanim+sunset) ⇒ <code>Date</code> * [.dawn()](#Zmanim+dawn) ⇒ <code>Date</code> + * [.dusk()](#Zmanim+dusk) ⇒ <code>Date</code> * [.hour()](#Zmanim+hour) ⇒ <code>number</code> * [.hourMins()](#Zmanim+hourMins) ⇒ <code>number</code> * [.gregEve()](#Zmanim+gregEve) ⇒ <code>Date</code> @@ -816,6 +817,10 @@ Initialize a Zmanim instance. ### zmanim.dawn() ⇒ <code>Date</code> **Kind**: instance method of [<code>Zmanim</code>](#Zmanim) +<a name="Zmanim+dusk"></a> + +### zmanim.dusk() ⇒ <code>Date</code> +**Kind**: instance method of [<code>Zmanim</code>](#Zmanim) <a name="Zmanim+hour"></a> ### zmanim.hour() ⇒ <code>number</code> @@ -1952,12 +1957,23 @@ To add candle-lighting options, set `options.candlelighting=true` and set `options.location` to an instance of `Location`. By default, candle lighting time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars -are observable in the night time sky with the naked eye). +are observable in the night time sky with the naked eye). The default Havdalah +option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon. These defaults can be changed using these options: * `options.candleLightingMins` - minutes before sundown to light candles * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72). Havdalah times are supressed when `options.havdalahMins=0`. +If both `options.candlelighting=true` and `options.location` is specified, +Chanukah candle-lighting times and minor fast start/end times will also be generated. +Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening) +on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on +Saturday night (see above). + +Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and +end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon +in the evening). + Two options also exist for generating an Event with the Hebrew date: * `options.addHebrewDates` - print the Hebrew date for the entire date range * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events diff --git a/hebcal.d.ts b/hebcal.d.ts index 5f65877..c4f82a9 100644 --- a/hebcal.d.ts +++ b/hebcal.d.ts @@ -309,6 +309,7 @@ declare module '@hebcal/core' { sunrise(): Date; sunset(): Date; dawn(): Date; + dusk(): Date; hour(): number; hourMins(): number; gregEve(): Date; diff --git a/package.json b/package.json index caf09ad..861e9cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hebcal/core", - "version": "2.8.1", + "version": "2.9.0", "author": "Michael J. Radwin (https://github.com/mjradwin)", "contributors": [ "Eyal Schachter (https://github.com/Scimonster)", diff --git a/po/he.po b/po/he.po index 86b9d33..ec68069 100644 --- a/po/he.po +++ b/po/he.po @@ -792,3 +792,9 @@ msgstr "רֹאשׁ חודש טֵבֵת" msgid "min" msgstr "דקות" + +msgid "Fast begins" +msgstr "כניסת הצום" + +msgid "Fast ends" +msgstr "יציאת הצום" diff --git a/src/candles.js b/src/candles.js index efbb662..e0d48ae 100644 --- a/src/candles.js +++ b/src/candles.js @@ -262,7 +262,6 @@ function makeTimedEvent(hd, time, desc, ev, timeFormat) { */ export function makeWeekdayChanukahCandleLighting(ev, hd, location, timeFormat) { const zmanim = new Zmanim(hd.greg(), location.getLatitude(), location.getLongitude()); - const candleLightingTime = zmanim.tzeit(TZEIT_3MEDIUM_STARS); - // const candleLightingTime = zmanim.sunset(); + const candleLightingTime = zmanim.dusk(); return makeTimedEvent(hd, candleLightingTime, ev.getDesc(), ev, timeFormat); } diff --git a/src/candles.spec.js b/src/candles.spec.js index 63081c8..4e64364 100644 --- a/src/candles.spec.js +++ b/src/candles.spec.js @@ -274,17 +274,17 @@ test('chanukah-candles', (t) => { const events = HebrewCalendar.calendar(options); const actual = events.map(eventTitleDateTime); const expected = [ - {date: '2020-12-10', time: '17:01', desc: 'Chanukah: 1 Candle'}, + {date: '2020-12-10', time: '16:46', desc: 'Chanukah: 1 Candle'}, {date: '2020-12-11', time: '15:56', desc: 'Chanukah: 2 Candles'}, {date: '2020-12-11', time: '15:56', desc: 'Candle lighting'}, {date: '2020-12-12', time: '17:01', desc: 'Chanukah: 3 Candles'}, {date: '2020-12-12', time: '17:01', desc: 'Havdalah'}, - {date: '2020-12-13', time: '17:02', desc: 'Chanukah: 4 Candles'}, - {date: '2020-12-14', time: '17:02', desc: 'Chanukah: 5 Candles'}, - {date: '2020-12-15', time: '17:02', desc: 'Chanukah: 6 Candles'}, - {date: '2020-12-16', time: '17:02', desc: 'Chanukah: 7 Candles'}, + {date: '2020-12-13', time: '16:46', desc: 'Chanukah: 4 Candles'}, + {date: '2020-12-14', time: '16:47', desc: 'Chanukah: 5 Candles'}, + {date: '2020-12-15', time: '16:47', desc: 'Chanukah: 6 Candles'}, + {date: '2020-12-16', time: '16:47', desc: 'Chanukah: 7 Candles'}, {date: '2020-12-16', time: undefined, desc: 'Rosh Chodesh Tevet'}, - {date: '2020-12-17', time: '17:03', desc: 'Chanukah: 8 Candles'}, + {date: '2020-12-17', time: '16:48', desc: 'Chanukah: 8 Candles'}, {date: '2020-12-18', time: undefined, desc: 'Chanukah: 8th Day'}, {date: '2020-12-18', time: '15:58', desc: 'Candle lighting'}, {date: '2020-12-19', time: '17:04', desc: 'Havdalah'}, diff --git a/src/hebcal.js b/src/hebcal.js index ae425cb..73886c9 100644 --- a/src/hebcal.js +++ b/src/hebcal.js @@ -28,7 +28,8 @@ import {Sedra, ParshaEvent} from './sedra'; import {greg as g} from './greg'; import {DafYomiEvent} from './dafyomi'; import {Location} from './location'; -import {makeCandleEvent, HavdalahEvent, makeFastStartEnd} from './candles'; +import {makeCandleEvent, HavdalahEvent, makeFastStartEnd, + makeWeekdayChanukahCandleLighting} from './candles'; const SUN = 0; // const MON = 1; @@ -348,12 +349,23 @@ export const HebrewCalendar = { * `options.location` to an instance of `Location`. By default, candle lighting * time is 18 minutes before sundown (40 minutes for Jerusalem) and Havdalah is * calculated according to Tzeit Hakochavim - Nightfall (the point when 3 small stars - * are observable in the night time sky with the naked eye). + * are observable in the night time sky with the naked eye). The default Havdalah + * option (Tzeit Hakochavim) is calculated when the sun is 8.5° below the horizon. * These defaults can be changed using these options: * * `options.candleLightingMins` - minutes before sundown to light candles * * `options.havdalahMins` - minutes after sundown for Havdalah (typical values are 42, 50, or 72). * Havdalah times are supressed when `options.havdalahMins=0`. * + * If both `options.candlelighting=true` and `options.location` is specified, + * Chanukah candle-lighting times and minor fast start/end times will also be generated. + * Chanukah candle-lighting is at dusk (when the sun is 6.0° below the horizon in the evening) + * on weekdays, at regular candle-lighting time on Fridays, and at regular Havdalah time on + * Saturday night (see above). + * + * Minor fasts begin at Alot HaShachar (sun is 16.1° below the horizon in the morning) and + * end when 3 medium-sized stars are observable in the night sky (sun is 7.083° below the horizon + * in the evening). + * * Two options also exist for generating an Event with the Hebrew date: * * `options.addHebrewDates` - print the Hebrew date for the entire date range * * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events @@ -452,9 +464,11 @@ export const HebrewCalendar = { candlesEv = makeCandleEvent(e, hd, dow, location, timeFormat, candleLightingMinutes, havdalahMinutes); if (eFlags === CHANUKAH_CANDLES && candlesEv && !options.noHolidays) { + const chanukahEv = (dow === FRI || dow === SAT) ? candlesEv : + makeWeekdayChanukahCandleLighting(e, hd, location, timeFormat); const attrs = { - eventTime: candlesEv.eventTime, - eventTimeStr: candlesEv.eventTimeStr, + eventTime: chanukahEv.eventTime, + eventTimeStr: chanukahEv.eventTimeStr, }; const chanukahDay = e.chanukahDay; if (chanukahDay) { diff --git a/src/hebcal.spec.js b/src/hebcal.spec.js index 6d57306..097065b 100644 --- a/src/hebcal.spec.js +++ b/src/hebcal.spec.js @@ -328,9 +328,9 @@ test('renderBrief', (t) => { ['Shabbat Zachor', 'שַׁבָּת זָכוֹר'], ['Parashat Tetzaveh', 'פרשת תְּצַוֶּה'], ['Havdalah', 'הַבדָלָה'], - ['Fast begins', 'Fast begins'], + ['Fast begins', 'כניסת הצום'], ['Ta\'anit Esther', 'תַּעֲנִית אֶסְתֵּר'], - ['Fast ends', 'Fast ends'], + ['Fast ends', 'יציאת הצום'], ['Erev Purim', 'עֶרֶב פּוּרִים'], ['Purim', 'פּוּרִים'], ['Shushan Purim', 'שׁוּשָׁן פּוּרִים'], diff --git a/src/zmanim.js b/src/zmanim.js index 972bb0e..470a003 100644 --- a/src/zmanim.js +++ b/src/zmanim.js @@ -63,7 +63,7 @@ export class Zmanim { sunriseEnd: this.sun.timeAtAngle(0.3, true), sunsetStart: this.sun.timeAtAngle(0.3, false), dawn: this.dawn(), - dusk: this.sun.timeAtAngle(6, false), + dusk: this.dusk(), nauticalDawn: this.sun.timeAtAngle(12, true), nauticalDusk: this.sun.timeAtAngle(12, false), nightEnd: this.sun.timeAtAngle(18, true), @@ -88,6 +88,10 @@ export class Zmanim { dawn() { return this.sun.timeAtAngle(6, true); } + /** @return {Date} */ + dusk() { + return this.sun.timeAtAngle(6, false); + } /** @return {number} */ hour() { return (this.sunset() - this.sunrise()) / 12; // ms in hour