hebcal / hebcal-es6

perpetual Jewish Calendar with holidays, Shabbat and holiday candle lighting and havdalah times, Torah readings, and more
https://hebcal.github.io/api/core/
GNU General Public License v2.0
102 stars 16 forks source link

Molad renders always to english ? #342

Closed ssarfaty closed 1 year ago

ssarfaty commented 1 year ago

hi, i have wrote the following code:

import {MoladEvent, Locale, HebrewCalendar, months, HDate, Location, Event, ParshaEvent, Zmanim} from '@hebcal/core';

const options = {
  year: parseInt(year),
  start: new Date(2023,9,14),
  end: new Date(2023,9,14),
  isHebrewYear: false,
  candlelighting: true,
  location: Location.lookup('Jerusalem'),
  sedrot: true,
  omer: true,
  shabbatMevarchim: true,
  molad: true,
  il: true,
  locale: 'he'
};

const events = HebrewCalendar.calendar(options);

for (const ev of events) 
{
  const hd = ev.getDate();
  const date = hd.renderGematriya(true);
  console.log("1: " + date);
  console.log("2: " + hd.getDay());
  console.log("3: " + ev.render('he'));  
  }

}

i have hard coded the date to the date that there is a MEVARCHIM and MOLAD

the outcome of this code is that when it get to the MOLAD event, although i specified 'he' in the rendering the outcome of the MOLAD is in English:

3: Molad Tishrei: Fri, 49 minutes and 0 chalakim after 5:00

mjradwin commented 1 year ago

Thanks for the bug report. We don't have a Hebrew template for molad events. Would you be able to help us create one? We're not familiar with how molad typically gets printed/rendered in Hebrew text.

mjradwin commented 1 year ago

My Hebrew isn't very good. Is something like this correct?

מוֹלָד הָלְּבָנָה תִּשְׁרֵי יִהְיֶה בַּיּוֹם שִׁישִּׁי בשָׁבוּעַ, בְּשָׁעָה 5 בַּבֹּקֶר, ו-49 דַּקּוֹת ו-0 חֲלָקִים

or perhaps

מוֹלָד הָלְּבָנָה תִּשְׁרֵי יִהְיֶה בַּיּוֹם שִׁישִּׁי בשָׁבוּעַ, 5 שָׁעוֹת ו-49 דַּקּוֹת ו-0 חֲלָקִים

@dsadinoff please also chime in if you're watching this space.

There appears to be an article that discusses exactly how it should be rendered, but again, my Hebrew isn't very solid.

https://hakirah.org/Vol%206%20Loewinger.pdf

ssarfaty commented 1 year ago

the first one is the better choice (hebrew wise) מוֹלָד הָלְּבָנָה תִּשְׁרֵי יִהְיֶה בַּיּוֹם שִׁישִּׁי בשָׁבוּעַ, בְּשָׁעָה 5 בַּבֹּקֶר, ו-49 דַּקּוֹת ו-0 חֲלָקִים

dsadinoff commented 1 year ago

@mjradwin can you please remind me what, if any, UI there would be for this? What day would it appear?
Hint: Tishrei is a poor example, since that's the only molad (ironically) that is never announced in shul.

mjradwin commented 1 year ago

@dsadinoff that's funny, I knew that we didn't announce Mevarchim HaChodesh for Tishrei because Rosh Hashana takes precedence over Rosh Chodesh... but somehow missed this for the Molad implementation.

Regarding UI, it can appear on the command-line app with the --molad flag, for example:

mradwin@mjr-m1mac hebcal % ./hebcal -h -x --molad          
1/21/2023 Molad Sh'vat: Sat, 56 minutes and 10 chalakim after 23:00
2/18/2023 Molad Adar: Mon, 40 minutes and 11 chalakim after 12:00
3/18/2023 Molad Nisan: Wed, 24 minutes and 12 chalakim after 1:00
4/15/2023 Molad Iyyar: Thu, 8 minutes and 13 chalakim after 14:00
5/20/2023 Molad Sivan: Sat, 52 minutes and 14 chalakim after 2:00
6/17/2023 Molad Tamuz: Sun, 36 minutes and 15 chalakim after 15:00
7/15/2023 Molad Av: Tue, 20 minutes and 16 chalakim after 4:00
8/12/2023 Molad Elul: Wed, 4 minutes and 17 chalakim after 17:00
10/14/2023 Molad Cheshvan: Sat, 33 minutes and 1 chalakim after 18:00
11/11/2023 Molad Kislev: Mon, 17 minutes and 2 chalakim after 7:00
12/9/2023 Molad Tevet: Tue, 1 minutes and 3 chalakim after 20:00
mradwin@mjr-m1mac hebcal % 

On the web, it shows up in the "description" field of the "Shabbat Mevarchim" even when Hebcal exports calendar data to Apple/Google/Outlook, or can show up in our JSON API, for example: https://www.hebcal.com/hebcal?cfg=json&v=1&molad=on&year=5784&yt=H

Here's an example of the current English rendering and the proposed Hebrew rendering

Molad Nisan: Mon, 57 minutes and 7 chalakim after 22:00 מוֹלָד הָלְּבָנָה נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, בְּשָׁעָה 22 בַּלַּ֥יְלָה, ו-57 דַּקּוֹת ו-7 חֲלָקִים

Molad Iyyar: Wed, 41 minutes and 8 chalakim after 11:00 מוֹלָד הָלְּבָנָה אִיָיר יִהְיֶה בַּיּוֹם רְבִיעִי בשָׁבוּעַ, בְּשָׁעָה 11 בַּבֹּקֶר, ו-41 דַּקּוֹת ו-8 חֲלָקִים

Molad Sivan: Fri, 25 minutes and 9 chalakim after 0:00 מוֹלָד הָלְּבָנָה סִיוָן יִהְיֶה בַּיּוֹם שִׁישִּׁי בשָׁבוּעַ, בְּשָׁעָה 0 בַּלַּ֥יְלָה, ו-25 דַּקּוֹת ו-9 חֲלָקִים

Molad Tamuz: Sat, 9 minutes and 10 chalakim after 13:00 מוֹלָד הָלְּבָנָה תַּמּוּז יִהְיֶה בַּיּוֹם שַׁבָּת בשָׁבוּעַ, בְּשָׁעָה 13 בַּצׇּהֳרַיִם, ו-9 דַּקּוֹת ו-10 חֲלָקִים

Molad Av: Mon, 53 minutes and 11 chalakim after 1:00 מוֹלָד הָלְּבָנָה אָב יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, בְּשָׁעָה 1 בַּלַּ֥יְלָה, ו-53 דַּקּוֹת ו-11 חֲלָקִים

Molad Elul: Tue, 37 minutes and 12 chalakim after 14:00 מוֹלָד הָלְּבָנָה אֱלוּל יִהְיֶה בַּיּוֹם שְׁלִישִׁי בשָׁבוּעַ, בְּשָׁעָה 14 בַּצׇּהֳרַיִם, ו-37 דַּקּוֹת ו-12 חֲלָקִים

Molad Cheshvan: Sat, 33 minutes and 1 chalakim after 18:00 מוֹלָד הָלְּבָנָה חֶשְׁוָן יִהְיֶה בַּיּוֹם שַׁבָּת בשָׁבוּעַ, בְּשָׁעָה 18 בָּעֶרֶב, ו-33 דַּקּוֹת ו-1 חֲלָקִים

Molad Kislev: Mon, 17 minutes and 2 chalakim after 7:00 מוֹלָד הָלְּבָנָה כִּסְלֵו יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, בְּשָׁעָה 7 בַּבֹּקֶר, ו-17 דַּקּוֹת ו-2 חֲלָקִים

Molad Tevet: Tue, 1 minutes and 3 chalakim after 20:00 מוֹלָד הָלְּבָנָה טֵבֵת יִהְיֶה בַּיּוֹם שְׁלִישִׁי בשָׁבוּעַ, בְּשָׁעָה 20 בָּעֶרֶב, ו-1 דַּקּוֹת ו-3 חֲלָקִים

Molad Sh'vat: Thu, 45 minutes and 4 chalakim after 8:00 מוֹלָד הָלְּבָנָה שְׁבָט יִהְיֶה בַּיּוֹם חֲמִישִׁי בשָׁבוּעַ, בְּשָׁעָה 8 בַּבֹּקֶר, ו-45 דַּקּוֹת ו-4 חֲלָקִים

Molad Adar I: Fri, 29 minutes and 5 chalakim after 21:00 מוֹלָד הָלְּבָנָה אַדָר א׳ יִהְיֶה בַּיּוֹם שִׁישִּׁי בשָׁבוּעַ, בְּשָׁעָה 21 בַּלַּ֥יְלָה, ו-29 דַּקּוֹת ו-5 חֲלָקִים

Molad Adar II: Sun, 13 minutes and 6 chalakim after 10:00 מוֹלָד הָלְּבָנָה אַדָר ב׳ יִהְיֶה בַּיּוֹם רִאשׁוֹן בשָׁבוּעַ, בְּשָׁעָה 10 בַּבֹּקֶר, ו-13 דַּקּוֹת ו-6 חֲלָקִים

mjradwin commented 1 year ago

Fixed in @hebcal/core version 4.3.5