Skip to content

Commit

Permalink
Tish'a B'Av (observed) on Av 10
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Dec 21, 2020
1 parent 267495a commit 6c3d2c7
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 13 deletions.
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/core",
"version": "2.9.0",
"version": "2.10.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"contributors": [
"Eyal Schachter (https://github.com/Scimonster)",
Expand All @@ -21,6 +21,8 @@
],
"description": "A perpetual Jewish Calendar API",
"main": "./dist/index.js",
"browser": "./dist/bundle.js",
"module": "./dist/index.mjs",
"typings": "hebcal.d.ts",
"repository": {
"type": "git",
Expand Down Expand Up @@ -56,7 +58,7 @@
"babel": {
"testOptions": {
"presets": [
"@babel/env"
"@babel/preset-env"
]
}
},
Expand All @@ -75,7 +77,7 @@
"@rollup/plugin-node-resolve": "^11.0.1",
"ava": "^3.14.0",
"core-js": "^3.8.1",
"eslint": "^7.15.0",
"eslint": "^7.16.0",
"eslint-config-google": "^0.14.0",
"gematriya": "^2.0.0",
"jsdoc": "^3.6.6",
Expand All @@ -84,6 +86,6 @@
"rollup": "^2.35.1",
"rollup-plugin-terser": "^7.0.2",
"tsd-jsdoc": "^2.5.0",
"ttag-cli": "^1.8.8"
"ttag-cli": "^1.9.0"
}
}
10 changes: 8 additions & 2 deletions po/he.po
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,13 @@ msgid "min"
msgstr "דקות"

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

msgid "Fast ends"
msgstr "יציאת הצום"
msgstr "סיום הצום"

msgid "Rosh Hashanah LaBehemot"
msgstr "ראש השנה למעשר בהמה"

msgid "Tish'a B'Av (observed)"
msgstr "תִּשְׁעָה בְּאָב נִדחֶה"
29 changes: 25 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,28 @@ export default [
babel({
babelHelpers: 'bundled',
presets: [
['@babel/env', {
['@babel/preset-env', {
modules: false,
targets: {
node: '10.21.0',
},
}],
],
exclude: ['node_modules/**'],
}),
nodeResolve(),
commonjs(),
],
},
{
input: 'src/index.js',
output: {file: pkg.module, format: 'es', name: pkg.name},
plugins: [
json({compact: true}),
babel({
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', {
modules: false,
targets: {
node: '10.21.0',
Expand All @@ -30,15 +51,15 @@ export default [
{
input: 'src/index.js',
output: [
{file: 'dist/bundle.js', format: 'umd', name: 'hebcal__core', indent: false},
{file: 'dist/bundle.min.js', format: 'umd', name: 'hebcal__core', plugins: [terser()]},
{file: pkg.browser, format: 'iife', name: 'hebcal', indent: false},
{file: 'dist/bundle.min.js', format: 'iife', name: 'hebcal', plugins: [terser()]},
],
plugins: [
json({compact: true}),
babel({
babelHelpers: 'bundled',
presets: [
['@babel/env', {
['@babel/preset-env', {
modules: false,
targets: {
edge: '17',
Expand Down
4 changes: 3 additions & 1 deletion src/hebcal.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,16 +876,18 @@ export const HebrewCalendar = {
add(new HolidayEvent(tamuz17, 'Tzom Tammuz', MINOR_FAST, tamuz17attrs));

let av9dt = new HDate(9, AV, year);
let av9title = 'Tish\'a B\'Av';
let av9attrs;
if (av9dt.getDay() == SAT) {
av9dt = av9dt.next();
av9attrs = {observed: true};
av9title += ' (observed)';
}

add(
new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9dt.abs())), 'Shabbat Chazon', SPECIAL_SHABBAT),
new HolidayEvent(av9dt.prev(), 'Erev Tish\'a B\'Av', MAJOR_FAST, av9attrs),
new HolidayEvent(av9dt, 'Tish\'a B\'Av', MAJOR_FAST, av9attrs),
new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),
new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT, av9dt.abs() + 7)), 'Shabbat Nachamu', SPECIAL_SHABBAT),
);

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', 'תחילת הצום'],
['Ta\'anit Esther', 'תַּעֲנִית אֶסְתֵּר'],
['Fast ends', 'יציאת הצום'],
['Fast ends', 'סיום הצום'],
['Erev Purim', 'עֶרֶב פּוּרִים'],
['Purim', 'פּוּרִים'],
['Shushan Purim', 'שׁוּשָׁן פּוּרִים'],
Expand Down
1 change: 1 addition & 0 deletions src/holidays.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class HolidayEvent extends Event {
basename() {
return this.getDesc().replace(/ \d{4}$/, '')
.replace(/ \(CH''M\)$/, '')
.replace(/ \(observed\)$/, '')
.replace(/ \(Hoshana Raba\)$/, '')
.replace(/ [IV]+$/, '')
.replace(/: \d Candles?$/, '')
Expand Down
30 changes: 30 additions & 0 deletions src/holidays.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,33 @@ function diaspora5771() {
2011-09-24 Leil Selichot
2011-09-28 Erev Rosh Hashana`.split('\n').sort();
}

// eslint-disable-next-line require-jsdoc
function eventTitleDateHebrew(ev) {
return {
date: ev.getDate().greg().toISOString().substring(0, 10),
basename: ev.basename(),
desc: ev.getDesc(),
};
}

test('9av-observed', (t) => {
const events = HebrewCalendar.calendar({year: 2015, numYears: 10});
const av9 = events.filter((ev) => ev.getDesc().substring(0, 11) === 'Tish\'a B\'Av');
const actual = av9.map(eventTitleDateHebrew);
const expected = [
{date: '2015-07-26', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av (observed)'},
{date: '2016-08-14', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av (observed)'},
{date: '2017-08-01', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av'},
{date: '2018-07-22', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av (observed)'},
{date: '2019-08-11', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av (observed)'},
{date: '2020-07-30', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av'},
{date: '2021-07-18', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av'},
{date: '2022-08-07', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av (observed)'},
{date: '2023-07-27', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av'},
{date: '2024-08-13', basename: 'Tish\'a B\'Av', desc: 'Tish\'a B\'Av'},
];
t.deepEqual(actual, expected);
t.is(av9[0].render('he'), 'תִּשְׁעָה בְּאָב נִדחֶה');
t.is(av9[2].render('he'), 'תִּשְׁעָה בְּאָב');
});

0 comments on commit 6c3d2c7

Please sign in to comment.