Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hebrew Calendar should include method to return date where Tishrei is 1 #36

Open
snoopyjc opened this issue Oct 18, 2020 · 7 comments
Open
Assignees

Comments

@snoopyjc
Copy link

snoopyjc commented Oct 18, 2020

The first month of civil year is Tishrei, and that is also when the year changes, so please add another method to return that method of month counting (Tishrei=1). This is also consistent with the Jewish calendar in Excel.

Per Wikipedia:

Nowadays, the day most commonly referred to as the "New Year" is 1 Tishrei (Rosh Hashanah, lit. "head of the year"), even though Tishrei is the seventh month of the ecclesiastical year. 1 Tishrei is the civil new year, and the date on which the year number advances. Tishrei marks the end of one agricultural year and the beginning of another,[31] and thus 1 Tishrei is considered the new year for most agriculture-related commandments, including Shmita, Yovel, Maaser Rishon, Maaser Sheni, and Maaser Ani.

@fitnr fitnr self-assigned this Oct 22, 2020
@fitnr
Copy link
Owner

fitnr commented Oct 22, 2020

Should be a relatively straight-forward addition

@snoopyjc
Copy link
Author

Thanks!! Here is the mapping, which is different in Leap years:

    ecclesiastical_to_civil = {7: 1, 8: 2, 9: 3, 10: 4, 11: 5, 12: 6, 1: 7, 2: 8, 3: 9, 4: 10, 5: 11, 6: 12}
    ecclesiastical_leap_to_civil = {7: 1, 8: 2, 9: 3, 10: 4, 11: 5, 12: 6, 13: 7, 1: 8, 2: 9, 3: 10, 4: 11, 5: 12, 6: 13}

@fitnr
Copy link
Owner

fitnr commented Oct 23, 2020

Took me a second to figure out what this is. I think that the modulo operator (%) is more useful for this kind of thing than hard-coding a dictionary.

@snoopyjc
Copy link
Author

snoopyjc commented Oct 23, 2020 via email

@fitnr
Copy link
Owner

fitnr commented Nov 7, 2020

While this is easy to add mathematically, I'm going to spend a little more time figuring out the best way to handle it in a backward-compatible way in the existing function calls. I'll try to get it in the next release.

@snoopyjc
Copy link
Author

snoopyjc commented Nov 7, 2020

How about: year, month, day = hebrew.from_gregorian(*ymd, civil=True)

@fitnr
Copy link
Owner

fitnr commented Nov 7, 2020

Yeah, that's probably the most straightforward way. There are several supporting functions, so the cleanest way to incorporate will probably involve some refactoring.

In the meantime, the hebrew.to_civil function added v2.3.0 should be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants