Created
March 18, 2014 10:25
-
-
Save zeroows/9617376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toJD: function(year, month, day) { | |
var date = this._validate(year, month, day, | |
$.calendars.local.invalidDate || $.calendars.regional[''].invalidDate); | |
year = date.year(); | |
month = date.month(); | |
day = date.day(); | |
if (year < 0) { year++; } // No year zero | |
// Jean Meeus algorithm, "Astronomical Algorithms", 1991 | |
if (month < 3) { | |
month += 12; | |
year--; | |
} | |
var a = Math.floor(year / 100); | |
var b = 2 - a + Math.floor(a / 4); | |
return Math.floor(365.25 * (year + 4716)) + | |
Math.floor(30.6001 * (month + 1)) + day + b - 1524.5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment