r-lib / clock

A Date-Time Library for R
https://clock.r-lib.org
Other
102 stars 5 forks source link

Calendar: Julian #183

Open DavisVaughan opened 3 years ago

DavisVaughan commented 3 years ago
julian_year_month_day()
julian_year_month_weekday()

Using: https://github.com/r-lib/clock/blob/master/inst/include/date/julian.h

jonthegeek commented 1 year ago

Are you open to PRs to implement these? It would be a learning effort for me (working with cpp) but one I've wanted to take on.

DavisVaughan commented 1 year ago

Not quite yet, I may end up just doing this myself in the next clock release, but I also have a plan to clean up some of the clock internals and possibly change the internal format some, so i wouldn't want that to interfere with your pr. I appreciate it though!

bbolker commented 1 year ago

I'm very interested in this, but it feels like there are a lot of potential complications.

Kerzhner, I. M. 1984. “Converting Dates from the Julian (Old Style) or French Republican (Revolutionary) Calendars to the Gregorian (New Style) Calendar.” Taxon 33 (3): 410–12. https://doi.org/10.2307/1220979.

PS the link to julian.h above is broken ...

DavisVaughan commented 1 year ago

Here's an updated link, not sure about all the particular details you mentioned yet https://github.com/HowardHinnant/date/blob/master/include/date/julian.h

bbolker commented 1 year ago

Thanks. It looks like it simply implements the calendar and allows conversion - doesn't tell you anything about dates. https://howardhinnant.github.io/date/julian.html I suspect it won't handle the New Year's Day/Lady Day shift correctly ...

joeroe commented 1 year ago

@bbolker The CRAN packages aion (for calendar dates) and era (for fractional years) support the Julian calendar, if it's any use.