Open snoopyjc opened 4 years ago
Should be a relatively straight-forward addition
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}
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.
Yes that will work too - just watch the leap years!
-joe Sent from my AT&T iPhone
On Oct 23, 2020, at 7:36 PM, Neil Freeman notifications@github.com wrote:
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.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
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.
How about: year, month, day = hebrew.from_gregorian(*ymd, civil=True)
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
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: