Inspired by How do you write dates in Latin?
Challenge
Given a month-and-day date, output that date in abbreviated Latin, as explained below.
Input
Input is flexible, following conventions from other date and sequence challenges. You may choose to:
- Take a date in mm/dd or dd/mm format or two separate month,day arguments;
- Take a date in your language's date format;
- Take an integer in interval [0, 364] corresponding to a day in the year;
- Take some other reasonable input that can encode all 365 days of the year;
- Take no user input but output the current day's date;
- Take no input and output all 365 days of the year in order;
Importantly, you only need to care about the month and day, not about the year, and you can assume that the year is not a leap year.
Output
Output is the date in abbreviated Latin, as specified in this section in BNF, and as explained more verbosely in the next section.
<output> ::= <delay> <event> <month>
<event> ::= "Kal" | "Non" | "Eid"
<month> ::= "Ian" | "Feb" | "Mar" | "Apr" | "Mai" | "Iun" | "Iul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
<delay> ::= "" | <one-day-delay> | <n-days-delay>
<one-day-delay> ::= "prid"
<n-day-delay> ::= "a d" <roman-numeral>
<roman-numeral> ::= "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X" | "XI" | "XII" | "XIII" | "XIV" | "XV" | "XVI" | "XVII" | "XVIII" | "XIX"
How do you write dates in abbreviated Latin?
Adapted from How do you write dates in Latin?
There are 36 special days in the year.
- A date which is a special day is encoded by giving the name of that special day;
- A date which is just before a special day is encoded by writing
prid
followed by the name of that special day; - Another day is encoded by writing
a d
followed by the number of days between that date and the next special day, counting inclusively, using Roman numerals, followed by the name of that special day.
Counting inclusively, there are for instance 3 days between January 3rd and January 5th.
The Roman counting system is oddly inclusive to modern taste. Whenever we would say that something is n days earlier, the Romans would have said n+1. The day just before the special day is two days before it (we'd say one day) and uses prid
instead of numbering, so the unnamed days start their numbering at 3.
The 36 special days are:
- The Kalendae, first day of the month:
01/01, 02/01, ..., 12/01
, writtenKal <month>
, respectively:Kal Ian
,Kal Feb
,Kal Mar
,Kal Apr
,Kal Mai
,Kal Iun
,Kal Iul
,Kal Aug
,Kal Sep
,Kal Oct
,Kal Nov
,Kal Dec
; - The Nonae, 5th or 7th day of the month:
01/05, 02/05, 03/07, 04/05, 05/07, 06/05, 07/07, 08/05, 09/05, 10/07, 11/05, 12/05
, writtenNon <month>
, respectively:Non Ian, Non Feb, Non Mar, Non Apr, Non Mai, Non Iun, Non Iul, Non Aug, Non Sep, Non Oct, Non Nov, Non Dec
; - The Ides, 13th or 15th day of the month:
01/13, 02/13, 03/15, 04/13, 05/15, 06/13, 07/15, 08/13, 09/13, 10/15, 11/13, 12/13
, writtenEid <month>
, respectively:Eid Ian, Eid Feb, Eid Mar, Eid Apr, Eid Mai, Eid Iun, Eid Iul, Eid Aug, Eid Sep, Eid Oct, Eid Nov, Eid Dec
.
Note the Nonae and Ides come two days later in the four months of March, May, July and October.
Because of these rules, only Roman numerals between 3 and 19 are required.
Test cases
mm/dd --> abbrev. Lat.
01/01 --> Kal Ian
01/02 --> a d IV Non Ian
01/03 --> a d III Non Ian
01/04 --> prid Non Ian
01/05 --> Non Ian
02/02 --> a d IV Non Feb
02/27 --> a d III Kal Mar
02/28 --> prid Kal Mar
03/01 --> Kal Mar
03/02 --> a d VI Non Mar
04/02 --> a d IV Non Apr
05/02 --> a d VI Non Mai
06/02 --> a d IV Non Iun
07/02 --> a d VI Non Iul
08/02 --> a d IV Non Aug
08/05 --> Non Aug
09/02 --> a d IV Non Sep
10/02 --> a d VI Non Oct
10/15 --> Eid Oct
10/12 --> a d IV Eid Oct
10/13 --> a d III Eid Oct
10/14 --> prid Eid Oct
10/17 --> a d XVI Kal Nov
11/02 --> a d IV Non Nov
12/02 --> a d IV Non Dec
12/14 --> a d XIX Kal Ian
12/30 --> a d III Kal Ian
12/31 --> prid Kal Ian
Rules
- This is code-golf, the shortest code in bytes wins!
<delay> ::= "" | <one-day-delay> | <n-days-delay>
\$\endgroup\$