CALENDAR_DOT_EXE - Added Jewish Calendar Support
Sep 29, 2022
So I didn't end up writing a blog post announcing CALENDAR_DOT_EXE, a 1,999,998 year calendar for the Nintendo Entertainment System. I suppose I could do that now, especially considering I recently added support for the Jewish calendar system and because the Jewish new year (Rosh Hashanah) happened earlier this week, I may as well write a post about it. A picture of CALENDAR_DOT_EXE with the Jewish calendar on the current month as of writing this post can be seen below.
On December 31st, 2020, I released a calendar for the Nintendo Entertainment System called "CALENDAR_DOT_EXE". That calendar would present calendars for years -999,999 through 999,999 on the Gregorian, Julian, and Roman calendars (the Roman calendar is the Julian calendar up until October 4th, 1582 and then jumps to October 11th, 1582 and uses the Gregorian calendar. There are some other quirks around year 1 BC as well involving leap years.).
On April 4th, 2021, I added support for 3 calendar systems Matt Parker ("Stand-up Maths" on Youtube) discussed in a the video "Leap Years: we can do better". The link to that video is below. The calendar systems discussed in that video, which I named "Parker A", "Parker B", and "Parker C" were selectable from the main screen of CALENDAR_DOT_EXE by inputting the Konami Code (Up, Up, Down, Down, Left, Right, Left, Right, B, A) in the date select screen.
Leap Years: we can do better - Youtube video
There were not many updates, especially major updates, until late August of this year, when I decided to add the Jewish Calendar. The Jewish calendar system was a lot more difficult of an addition than I expected initially.
Calendar Systems and Their Rules
I will be explaining the rules for the Julian, Gregorian, Roman and Jewish calendars below. All of these calendars have one major thing in common, which is that there is no year 0. The last day of year -1 is followed by the first day of year 1 in all of those calendar systems. I will be describing the rules for positive years, but negative years can be figured out if you add 1 to the year, so -1 becomes 0, -5000 becomes -4999, etc...
I should also mention that I will interchangeably use the terms BC (Before Christ) and BCE (Before Common Era) along with AD (Anno Domini) and CE (Common Era). In Christian contexts, I will use BC and AD, and in non-Christian contexts, I will use BCE and CE. This will mostly apply in using BC and AD in the Gregorian calendar and the period of time after the Council of Nicea in the Julian calendar and BCE and CE in other situations relating to those calendars.
In 46 BCE, Julius Caesar proposed a change to the calendar. Before then, a high priest (Caesar's job) decided whether to add a short month to the year when the calendar drifted away enough from the seasons every few years. That short month would fequently be added or withheld for political reasons, as Senate terms started at the start of the year, which means the high priest could make terms longer or shorter. There was also another issue, as Caesar had been away from Rome to conquest for about a decade, which were the events that lead to the 4 Triumphs.
In Caesar's calendar system, a year would be 365 days for three years followed by a fourth year that would be 366 days. An automated system was created that did not need him to be in Rome to keep the calendar aligned to the Sun. That hip new calendar seems to have caught on, enough for Julius to get a month named after him, even if it caused year 45 BCE to be 445 days long and called "the year of confusion".
Julian Calendar Rules
- If the year is divisible by 4, the year is a leap year, therefore 366 days long
- All other years are not leap years, therefore 365 days long
(Fun Fact: Leap days are on February 25th, not February 29th, even if only leap years have February 29th and all years have February 25th)
This brings the average year length to 365.25 days.
Eventually, Pope Gregory around year 1582 AD had noticed or was informed that the calendar was drifting from the Sun since the Council of Nicea, which established the rules for determining Easter as the first Sunday after the first full moon on or after March 21st. March 21st was set as the vernal equinox, but because the Julian Calendar was drifting over time, March 21st was drifting farther and farther away from the actual vernal equinox. To fix that, a new calendar system was created in 1582 AD based on the Julian calendar to realign March 21st to the vernal equinox. Unfortunately, while that calendar system is what most countries use now, at least for business relations with other countries, the calendar wasn't hip cool enough for one of our months to be named Greg...
Gregorian Calendar Rules
- If the year is divisible by 4 but not divisible by 100, the year is a leap year, therefore 366 days long
- If the year is divisible by 4 and dibisible by 400, the year is a leap year, therefore 366 days long
- All other years are not leap years, therefore 365 days long
Worded another way, a year is only a leap year if it is divisible by 4, unless the year ends in 00, then it must also be divisible by 400 to be a leap year. This brings the average year length to 365.2425 days.
Because the Julian and Gregorian calendars were created and implemented in Rome, I decided to include the "Roman" calendar. The initial switch from the Julian to Gregorian calendar caused 10 days to be skipped in Rome in 1582 AD. Those days were skipped in October of that year. Until (and through) October 4th, 1582 AD, the Julian calendar, then the next day was October 15th, 1582 AD and used the Gregorian calendar.
There was also another complication, because after Julius Caesar's death, the high priests misinterpreted the rules of the Julian Calendar and set leap years every 3 years instead of every 4 years for a few decades. Agustus Caesar eventually stopped leap years for a period of time to resync the calendar. This action was cool and rad enough for Augustus to get a month named after him.
The leap year error was described by Macrobius Ambrosius Theodosius ambigously. I'll post what Wikipedia says he said and link to the Wikipedia page.
Caesar's regulation of the civil year to accord with his revised measurement was proclaimed publicly by edict, and the arrangement might have continued to stand had not the correction itself of the calendar led the priests to introduce a new error of their own; for they proceeded to insert the intercalary day, which represented the four quarter-days, at the beginning of each fourth year instead of at its end, although the intercalation ought to have been made at the end of each fourth year and before the beginning of the fifth. This error continued for thirty-six years by which time twelve intercalary days had been inserted instead of the number actually due, namely nine. But when this error was at length recognised, it too was corrected, by an order of Augustus, that twelve years should be allowed to pass without an intercalary day, since the sequence of twelve such years would account for the three days which, in the course of thirty-six years, had been introduced by the premature actions of the priests.
Julian Calendar Wikipedia Page (Leap Year Error)
CALENDAR_DOT_EXE uses Joseph Justus Scaliger's interpretation of Macrobius's description, which is that 42 BCE was the first leap year along with every 3 years after 42 BCE until 8 BCE (the last leap year would have been 9 BCE) when Augustus Caesar stopped leap years from occurring until after 4 CE.
Roman Calendar Rules
- Years 42 BCE, 39 BCE, 36 BCE, 33 BCE, 30 BCE, 27 BCE, 24 BCE, 21 BCE, 18 BCE, 15 BCE, 12 BCE, and 9 BCE are leap years, and are therefore 366 days long
- No years from 8 BCE to 5 CE are leap years, and are therefore 365 days long
- Years before 42 BCE behave like Julian calendar years
- Years after 4 CE until (and including) 1582 AD behave like Julian calendar years
- Years after 1582 AD behave like Gregorian calendar years
- October 4th, 1582 AD was followed by October 15th, 1582 AD
And now onto the calendar system that I added most recently with I would say are the most complicated rules. This calendar system is a lunisolar calendar, so the months are based on an entire moon cycle, but the year is shifted using a leap month from time to time to realign the calendar with the seasons.
There is some context also that is needed to make things make a little more sense. Please don't get too angry with me if I get some details a little bit wrong, as I am neither Jewish nor a scholar in Judaism.
The calendar starts at year 2 AM (Anno Mundi, or "year of the world") on a Friday, which is set as the day Adam was created. Year starts are determined by the molad (moon "birth") of the month Tishrei, which is the month that the calendar year goes up by 1, although a different month, "Nissan", is considered the first month of the year for other reasons. Molad Tishrei of year 2 AM is set at Friday 14 hours and 0 chalkim. The other days of creation were the last 5 days of year 1 AM. Technically there would have not been any days before Elul (the month before Tishrei) 25 of year 1 AM, but the molad of Tishrei on year 1 AM would have been Monday 5 hours and 204 chalakim.
I should probably explain a few terms quick. A chalakim is 1/1080 of an hour. A molad is the moment of the new moon or the moon's "birth".
Dates and years before Elul 25 of year 1 AM are completely speculative.
Jewish Calendar Rules
These rules are complicated enough that I'll split it into more than 1 section.
Years can be 12 or 13 months long and can have 353, 354, 355, 383, 384, or 385 days.
First we will determine if the year is a leap year and when the molad of Tishrei for the particular year is
- Determine which year out of the 19 year "metonic" cycle the year is (year mod 19)
- If the year is a the 3rd, 6th, 8th, 11th, 14th, 17th, or 19th year of the metonic cycle, the year is a leap year, and are therefore 13 months long
- All other years are not leap years, and are therefore 12 months long
- Determine the amount of months between Tishrei 1 of year 1 AM and Tishrei 1 of the year you want to find the calendar for and multiply that amount of months by 29 days, 12 hours, and 793 chalakim to get the molad of Tishrei of that year. Simplify that value to get a day of the week, hour value, and chalakim value. There are 1080 chalakim in an hour, 24 hours in a day, and 7 days of a week.
We now have molad Tishrei for the year we want to know the calendar for. Now we need to figure out if we need to postpone the beginning of the year at all. There are slightly different rules depending on if the year is after year 3 AM or not. Let's start with the rules for years after 3 AM.
- If molad Tishrei occurs on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day, then end checking rules
- If molad Tishrei is on or after 18 hours, postpone Tishrei 1 by 1 day. If this causes Tishrei 1 to land on Sunday, Wednesday, or Friday, postpone Tishrei 1 by a second day. If Tichrei 1 is postponed by 1 or 2 days due to this rule, end checking rules.
- If molad Tishrei on a year that is not a leap year falls on a Tuesday at 9 hours 204 chalakim, postpone Tishrei 1 by 2 days, then end checking rules.
- If molad Tishrei on a year immediately following a leap year falls on a Monday at 15 hours 589 chalakim, postpone Tishrei 1 by 1 day, then end checking rules.
The first rule exists to prevent Yom Kippur from landig on a Friday or Sunday and to prevent Hoshana Rabba from landing on a Saturday (Shabbat). The second rule exists to make sure the crescent moon is visible by the end of Tishrei 1. The third rule exists to prevent the year from being too long. The fourth rule exists to prevent the previous year from being too short.
Notice in the previous section I mentioned Tishrei 1 of year 2 AM was a Friday. That breaks rule 1, but fear not! That is fixed with exceptions. It could be argued that there was no need for Hoshana Rabba to not land on Shabbat or Yom Kippur to not land on a Friday or Sunday because they are days dealing with forgiveness from sin, especially for the previous year, so rule 1 (and rules 3 and 4 as a result) would no longer apply. This causes an issue for year 3 AM, as if rule 2 were followed fully for year 3 AM, year 2 AM would be 356 days long, which is not a valid amount of days, so rule 2 does not fully apply for year 3 AM.
With that said, years 3 AM and before use only the following rule
- If molad Tishrei is on or after 18 hours, postpone Tishrei 1 by 1 day.
If you somehow interested in CALENDAR_DOT_EXE after dealing with that barely organized infodump, you can find it on my GitHub in the following link. The ROM file can be found at bin/calendar-dot-exe.nes in the repository.
CALENDAR_DOT_EXE Repo on GitHub