hebcal/hebcal-js

Wrong gregorian date prior to greg. year 1

Closed this issue · 4 comments

Hello,

var hdate = new Hebcal.HDate(18, 10, 3761);
hdate.greg() => Mon Jan 01 0001 00:00:00 GMT+0220

And whenever we go under that, it's completely broken. The day before :

var hdate = new Hebcal.HDate(17, 10, 3761);
hdate.greg() => Thu Dec 31 -504 00:00:00 GMT+0220

500 years before :

var hdate = new Hebcal.HDate(17, 10, 3261);
Tue Jan 03 -1003 00:00:00 GMT+0220

And one more day before :

var hdate = new Hebcal.HDate(16, 10, 3261);
hdate.greg() => Tue Jan 01 -899 00:00:00 GMT+0220

That's a very big issue for me !

Hebcal wasn't designed to handle anything before Gregorian year 1.

@mjradwin okay, that's very problematic for the app I'm doing... Have you a recommandation of some sort to achieve what I'm trying to ?

It's going to be inaccurate before ~350CE anyways because that's when the calendar was switched to calculated instead of based on observation.

Well, in PHP there is a function doing the conversion, and it works exactly as you would expect :

echo jdtogregorian(jewishtojd(4,18,3761));
echo "\n\n\n";
echo jdtogregorian(jewishtojd(2,10,2259));

I thought it would be simple to find the same kind of things in the huge JS ecosystem, but apparently not :/ Hebcal is amazing BTW, it's really a shame it doesn't handle this since it does so much things incredibly well.