1
0
mirror of synced 2026-02-24 05:48:01 +08:00

增加阳历获取儒略日的方法

This commit is contained in:
6tail
2020-04-21 11:21:09 +08:00
parent db4c941bd9
commit 6d6e2ff7c6

View File

@@ -153,6 +153,23 @@
},
getLunar:function(){
return Lunar.fromDate(this._p.calendar);
},
getJulianDay:function(){
var y = this._p.year;
var m = this._p.month;
var n = 0;
if (m <= 2) {
m += 12;
y--;
}
if (this._p.year * 372 + this._p.month * 31 + this._p.day >= 588829) {
n = _int2(y / 100);
n = 2 - n + _int2(n / 4);
}
n += _int2(365.2500001 * (y + 4716));
n += _int2(30.6 * (m + 1)) + this._p.day;
n += ((this._p.second / 60 + this._p.minute) / 60 + this._p.hour) / 24 - 1524.5;
return n;
}
};
};