From 1e7f33e04840652a2bb5d6184da3e1519886594a Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Sat, 8 Jan 2022 16:42:06 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.25=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E8=8A=82=E6=B0=94=E5=AF=B9=E8=B1=A1=E7=9A=84?= =?UTF-8?q?=E9=98=B3=E5=8E=86=E6=97=A0=E6=97=B6=E5=88=86=E7=A7=92=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lunar.js | 77 +++++++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/lunar.js b/lunar.js index 8d295f4..b90b334 100644 --- a/lunar.js +++ b/lunar.js @@ -983,59 +983,51 @@ }, _convertJieQi:function(name){ var jq = name; - if('DONG_ZHI'===jq){ + if('DONG_ZHI' === jq){ jq = '冬至'; - }else if('DA_HAN'===jq){ + }else if('DA_HAN' === jq){ jq = '大寒'; - }else if('XIAO_HAN'===jq){ + }else if('XIAO_HAN' === jq){ jq = '小寒'; - }else if('LI_CHUN'===jq){ + }else if('LI_CHUN' === jq){ jq = '立春'; - }else if('DA_XUE'===jq){ + }else if('DA_XUE' === jq){ jq = '大雪'; - }else if('YU_SHUI'===jq){ + }else if('YU_SHUI' === jq){ jq = '雨水'; - }else if('JING_ZHE'===jq){ + }else if('JING_ZHE' === jq){ jq = '惊蛰'; } return jq; }, getJie:function(){ - var d; - var jie=''; - for(var i=0,j=Lunar.JIE_QI_IN_USE.length;i0 ? this._buildJieQi(name,this._p.solar) : null; + for(var key in this._p.jieQi){ + var d = this._p.jieQi[key]; + if(d.getYear() === this._p.solar.getYear() && d.getMonth() === this._p.solar.getMonth() && d.getDay() === this._p.solar.getDay()){ + return this._buildJieQi(this._convertJieQi(key), d); + } + } + return null; }, getCurrentJie:function(){ - var name = this.getJie(); - return name.length>0 ? this._buildJieQi(name,this._p.solar) : null; + for(var i=0, j=Lunar.JIE_QI_IN_USE.length; i0 ? this._buildJieQi(name,this._p.solar) : null; + for(var i=1, j=Lunar.JIE_QI_IN_USE.length; i