Arvelie date calculator

Encode and decode dates written in the 100 rabbits' arvelie date format. By default, this uses their wiki's year zero of 2006, but you can change the year zero to any year.




How these dates work

The specification was terse and hard to understand. This is my best attempt at understanding it; it appears to be correct.

The first 364 days of the year, up to and including December 30 on non-leap years and December 29 on leap years, are written as letter + two digits, the digits being a number between 01 and 13. The letter is any of the 26 from A to Z. The first day of the year is A00, the second is A01, and the fourteenth day of the year is A13. The fifteenth day rolls over to the next letter, so it's written B00. This system continues for 364 days up to day Z13, which is December 29 on leap years and December 30 on leap years.

The 365th and 366th days of the year are written with a plus, +00 and +01. The leap day +01 exists only on leap years. The specification on the xxiivv wiki says that the leap day +01 "precedes" the 365th day +00, which would imply that the last days of the year are Z13, +01 and +00 in that order, but the examples clearly show +01 being used for December 31 so I believe that this is just an error. My implementation here has Z13, +00 and +01 as the last days of the year.

The year zero can be decided arbitrarily based on project. The 100 rabbits crew use 2006 for their stuff, so I've set it as the default.