I've been toiling for days on how to calculate the current day of the year on the Julian calendar. I have a function to get the current Julian Date (time since start of Julian period), and I have a function to get the Gregorian day of the year. I haven't found any accurate answer, and my closest find was still 2 days behind what it should've been at the time.
I'd use this to find if there are any Julian calendar holidays currently. I'd like to be able to get the day of the month, but I can figure that out later, and day of the year is top priority.
I have jQuery in use and available.
[edit:] Here are my functions so far:
Date.prototype.getJulianYearDate=function(){
var j=parseInt((this.getTime()-new Date('Dec 30,'+(this.getFullYear()-1)+' 23:00:00').getTime())/86400000).toString(),
i=3-j.length;
while(i-->0)j=0+j;
return j
}// source: https://www.webdeveloper.com/d/84211-javascript-and-julian-date/2
Date.prototype.getJulianDayNumber = function(Y = new Date().getYear(), M = new Date().getMonth() + 1, D = new Date().getDate()) {
var JDN = 367 * Y - (7 * (Y + 5001 + (M - 9) / 7)) / 4 + (275 * M) / 9 + D + 1729777;
return JDN;
//source of equation: https://en.wikipedia.org/wiki/Julian_day
}
Date.prototype.getJulianYearsSinceUnix = function() {
return new Date().getJulianDate() / 365.25;
}
// credit: https://stackoverflow.com/a/11760079
Date.prototype.getJulianDate = function(dateKind = new Date()) {
var julianUnix = dateKind.getTime() / 86400000 + 2440587.5;
return julianUnix;
}
If I just had the right equations, I am confident I could write the right functions, but for now I'm stumped