Skip to content

Commit

Permalink
Add Hebrew translations for Fast start/end times.
Browse files Browse the repository at this point in the history
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.

hebcal/hebcal#204
  • Loading branch information
mjradwin committed Dec 17, 2020
1 parent 4dd9281 commit 267495a
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 17 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hebcal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ declare module '@hebcal/core' {
sunrise(): Date;
sunset(): Date;
dawn(): Date;
dusk(): Date;
hour(): number;
hourMins(): number;
gregEve(): Date;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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)",
Expand Down
6 changes: 6 additions & 0 deletions po/he.po
Original file line number Diff line number Diff line change
Expand Up @@ -792,3 +792,9 @@ msgstr "רֹאשׁ חודש טֵבֵת"

msgid "min"
msgstr "דקות"

msgid "Fast begins"
msgstr "כניסת הצום"

msgid "Fast ends"
msgstr "יציאת הצום"
3 changes: 1 addition & 2 deletions src/candles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
12 changes: 6 additions & 6 deletions src/candles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
22 changes: 18 additions & 4 deletions src/hebcal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/hebcal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', 'שׁוּשָׁן פּוּרִים'],
Expand Down
6 changes: 5 additions & 1 deletion src/zmanim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
Expand Down

0 comments on commit 267495a

Please sign in to comment.