7
2
Today (March 15) is the Ides of March, best known for being the date that Julius Caesar was assassinated.
What's “Ides”? Well, the ancient Romans didn't simply number the days of month from 1 to 31 like we do. Instead, they had a more complex system of counting backwards to the Kalends, Nones, or Ides.
Challenge
Write, in as few bytes as possible, a program that will display the current date (on the Gregorian calendar, in the local timezone) using the abbreviated Roman-style convention described below. Your program should work until at least the end of 2037.
Roman dates
Months of the year
These should look familiar to you: Ianuarius, Februarius, Martius, Aprilis, Maius, Iunius, Iulius (Quintilis), Augustus (Sextilis), September, October, November, December.
Your program is to abbreviate all months to three letters, using the classical Latin alphabet (all caps, with J=I and U=V). That is, IAN
, FEB
, MAR
, APR
, MAI
, IVN
, IVL
, AVG
, SEP
, OCT
, NOV
, DEC
.
Special dates of the month
- Kalendis, or the Kalends (abbr.
KAL
) is the first day of each month. - Idibus, or the Ides (abbr.
ID
) is the 15th day of March, May, July, or October; but the 13th day of the other eight months. - Nonas, or the Nones (abbr.
NON
) is 8 days before the Ides (5th or 7th of the month)
Other days of the month
Other days of the month are numbered by counting backwards and inclusively to the next reference date (Kalends, Ides, or Nones). Notation is AD
(abbreviation for ante diem, no relation to Jesus of Nazareth) followed by the appropriate Roman numeral.
Exception: Write PR
(for pridie) instead of AD II
for the day before Kalends, Nones, or Ides.
The leap day
In leap years, two days (February 24 and 25 in modern reckoning) are given the date AD VI KAL MAR
. (You do not need to distinguish the two days in your program.) February 14-23 are AD XVI KAL MAR
through AD VII KAL MAR
as in non-leap years. Feb 26 = AD V KAL MAR
, Feb 27 = AD IV KAL MAR
, Feb 28 = AD III KAL MAR
, and Feb 29 = PR KAL MAR
, offset by one from the corresponding dates in non-leap years.
Example
In March, the output of your program should be:
- On March 1:
KAL MAR
- On March 2:
AD VI NON MAR
- On March 3:
AD V NON MAR
- On March 4:
AD IV NON MAR
- On March 5:
AD III NON MAR
- On March 6:
PR NON MAR
- On March 7:
NON MAR
- On March 8:
AD VIII ID MAR
- ...
- On March 13:
AD III ID MAR
- On March 14:
PR ID MAR
- On March 15:
ID MAR
- On March 16:
AD XVII KAL APR
- ...
- On March 30:
AD III KAL APR
- On March 31:
PR KAL APR