From 3db4b10dc5142db0f3acb5ebd5c92ddf9a2f6f65 Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Thu, 28 May 2020 22:57:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E8=BE=B0=E5=86=B2?= =?UTF-8?q?=E7=85=9E=E3=80=81=E6=97=B6=E8=BE=B0=E5=AE=9C=E5=BF=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lunar.js | 97 ++++++++++++++++++++++++++++++++++++++++++++++++---- package.json | 3 +- 2 files changed, 93 insertions(+), 7 deletions(-) diff --git a/lunar.js b/lunar.js index 0f03bf0..e4c92b7 100644 --- a/lunar.js +++ b/lunar.js @@ -704,15 +704,33 @@ return LunarUtil.POSITION_DESC[this.getPositionCai()]; }, getChong:function(){ - return LunarUtil.CHONG[this.getDayZhi()]; + return this.getDayChong(); }, getChongGan:function(){ - return LunarUtil.CHONG_GAN[this.getDayGan()]; + return this.getDayChongGan(); }, getChongGanTie:function(){ - return LunarUtil.CHONG_GAN_TIE[this.getDayGan()]; + return this.getDayChongGanTie(); }, getChongShengXiao:function(){ + return this.getDayChongShengXiao(); + }, + getChongDesc:function(){ + return this.getDayChongDesc(); + }, + getSha:function(){ + return this.getDaySha(); + }, + getDayChong:function(){ + return LunarUtil.CHONG[this.getDayZhi()]; + }, + getDayChongGan:function(){ + return LunarUtil.CHONG_GAN[this.getDayGan()]; + }, + getDayChongGanTie:function(){ + return LunarUtil.CHONG_GAN_TIE[this.getDayGan()]; + }, + getDayChongShengXiao:function(){ var chong = this.getChong(); for(var i=0,j=LunarUtil.ZHI.length;i-1) { + var left = this.TIME_YI_JI.substr(index + 5); + if (left.indexOf('=')>-1) { + left = left.substr(0, left.indexOf('=') - 4); + } + var ys = left.substr(0, left.indexOf(',')); + for (var i = 0, j = ys.length; i < j; i += 2) { + var m = ys.substr(i, 2); + l.push(this.YI_JI[parseInt(m, 16)]); + } + } + return l; + }, + getTimeJi:function(dayGanZhi,timeGanZhi){ + var l = []; + var day = this.hex(this.getJiaZiIndex(dayGanZhi)); + var time = this.hex(this.getJiaZiIndex(timeGanZhi)); + var index = this.TIME_YI_JI.indexOf(day+time+'='); + if(index>-1) { + var left = this.TIME_YI_JI.substr(index + 5); + if (left.indexOf('=')>-1) { + left = left.substr(0, left.indexOf('=') - 4); + } + var js = left.substr(left.indexOf(',')+1); + for (var i = 0, j = js.length; i < j; i += 2) { + var m = js.substr(i, 2); + l.push(this.YI_JI[parseInt(m, 16)]); + } + } + return l; } }; })(); diff --git a/package.json b/package.json index 88cebb4..3410d47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lunar-javascript", - "version": "1.0.4", + "version": "1.0.5", "description": "lunar is a calendar library for Solar and Chinese Lunar.", "main": "index.js", "scripts": { @@ -23,6 +23,7 @@ "节日", "彭祖百忌", "每日宜忌", + "时辰宜忌", "吉神宜趋", "凶煞宜忌", "喜神",