This post is largely for my own benefit, but I figured it might be interesting to others too, in terms of what you need to think about when coding against the Hebrew calendar. Currently I'm trying to work out what it means to add a year to a date in the Hebrew calendar, at which point it's useful to have some reference tables.
Month names
There are two month numbering systems, which Noda Time calls Civil and Scriptural. In leap years, the number/name mapping in the civil numbering system is offset for the second half of the year, due to Adar being split into Adar I and Adar II.
Number | Scriptural | Civil (non-leap) | Civil (leap) |
---|---|---|---|
1 | Nisan | Tishri | Tishri |
2 | Iyar | Heshvan | Heshvan |
3 | Sivan | Kislev | Kislev |
4 | Tamuz | Tevet | Tevet |
5 | Av | Shevat | Shevat |
6 | Elul | Adar | Adar I |
7 | Tishri | Nisan | Adar II |
8 | Heshvan | Iyar | Nisan |
9 | Kislev | Sivan | Iyar |
10 | Tevet | Tamuz | Sivan |
11 | Shevat | Av | Tamuz |
12 | Adar / Adar I | Elul | Av |
13 | Adar II | Elul |
(Heshvan is sometimes lengthened to Marcheshvan; it's also called Cheshvan. Heshvan is the version in CLDR, which is why I've used it here. Other month names have similar variations, e.g. Tishri vs Tishrei. These are only English versions of Hebrew names, of course.)
Sample years
In unit tests it's useful to have some sample data for specific situations. Here's the data for a complete leap cycle of 19 years. (This period maps to years 1639 to 1659 in the Gregorian calendar.)
Year | Leap? | Days in Cheshvan | Days in Kislev |
---|---|---|---|
5400 | No | 29 | 30 |
5401 | No | 29 | 29 |
5402 | Yes | 30 | 30 |
5403 | No | 29 | 30 |
5404 | Yes | 29 | 29 |
5405 | No | 30 | 30 |
5406 | No | 29 | 30 |
5407 | Yes | 30 | 30 |
5408 | No | 29 | 29 |
5409 | No | 30 | 30 |
5410 | Yes | 29 | 30 |
5411 | No | 30 | 30 |
5412 | No | 29 | 29 |
5413 | Yes | 29 | 30 |
5414 | No | 30 | 30 |
5415 | Yes | 30 | 30 |
5416 | No | 29 | 29 |
5417 | No | 29 | 30 |
5418 | Yes | 30 | 30 |
5419 | No | 30 | 30 |
No comments:
Post a Comment