dhlab-basel / JDNConvertibleCalendar

Different calendars can be freely converted using Julian Day Number
GNU Affero General Public License v3.0
4 stars 3 forks source link

Evaluate existing calendar conversion libs #1

Open tobiasschweizer opened 6 years ago

tobiasschweizer commented 6 years ago

A search on npmjs.com for "calendar Julian " returned the following results:

This libs should be evaluated (in order to check for correctness of our own implementation).

Ideally, the conversions functions (everything in JDNCalendarConversion) could be handled in a separate or even external module. I could image putting all of the conversions offered by https://www.fourmilab.ch/documents/calendar/ in a separate module that could be used by JDNConvertibleCalendar.

jlayt commented 6 years ago

Hi,

Saw your post on the Angular blog via Twitter. In the past I've maintained a couple of C++ libraries for calendar conversions via Julian Days and picker widgets, and built up a lot of documentation on various calendar systems. My last (incomplete) effort implementing a subset of them can be found here:

https://github.com/KDE/kholidays/blob/master/src/parsers/qcalendarsystem_p.h https://github.com/KDE/kholidays/blob/master/src/parsers/qcalendarsystem.cpp

It's GPL, so feel free to pillage the code or algorithms, the source reference for each is provided (some key algorithms are sadly copyright or license restricted, this version only includes those I know are GPL compatible). It's missing translations of day/month names and auto-tests (I have them somewhere on my hard-drive...), those restricted algorithms (I have them too if you want, but they are mostly on fourmilab anyway), and the astronomical calendars which I never completed, but it may be a useful start point.

I do some DH-related web dev these days, but not Angular, so I may not be able to contribute code, but I'd be happy to try answer questions if you need help.

John.

tobiasschweizer commented 6 years ago

Hi John,

Thanks a lot for offering your help. If you want, you can have a look at this open PR: #4

It basically implements the algorithms given by John Meeus, but some tweaks were necessary too. Maybe you could give us some advice about missing or incomplete tests in https://github.com/dhlab-basel/JDNConvertibleCalendar/blob/wip/formula/test/UnitTests.ts

I had a look at your code and discovered that you have negative JDs. I think the algorithms of Meeus only work for non negative JDs.

Btw: This library is not restricted to Angular, there is another development https://github.com/dhlab-basel/JDNConvertibleCalendarDateAdapter that contains all the Angular specific things.

Thanks again!

Tobias