From 6d6e2ff7c62b06f041b8a770b702ac2da079c02c Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Tue, 21 Apr 2020 11:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=98=B3=E5=8E=86=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=84=92=E7=95=A5=E6=97=A5=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lunar.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lunar.js b/lunar.js index 44e052e..cf79d9d 100644 --- a/lunar.js +++ b/lunar.js @@ -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; } }; };