2 karma · joined Oct 2, 2023 (3y ago) · 3 submissions
comment 3mo ago · link · parent
I maintain an Elixir library (Calendrical) that does this. England, for example, is just three segments spliced onto a Julian base:
defmodule England do
use Calendrical.Composite,
calendars: [
~D[1155-03-25 Calendrical.Julian.March25], # year starts on Lady Day
~D[1751-03-25 Calendrical.Julian.Jan1], # New Year moved to Jan 1
~D[1752-09-14 Calendrical.Gregorian] # the 11-day jump
],
base_calendar: Calendrical.Julian
end
The "missing" days simply aren't valid dates, and stepping across the boundary jumps: England.days_in_month(1752, 9) #=> 19
England.valid_date?(1752, 9, 3) #=> false
Date.shift(~D[1752-09-02 England], day: 1) #=> ~D[1752-09-14 England]comment 2y ago · link · parent
I'm the author of Image and I'd welcome feedback on improving areas where you see lack of polish (there's a reason its not yet 1.0, but it is getting closer - primarily rewriting the color model).
Comments here are fine, or in the repo at https://github.com/kipcole9/image