1
0
mirror of synced 2026-04-17 22:08:42 +08:00

Compare commits

..

1 Commits

2 changed files with 50 additions and 22 deletions

View File

@@ -1952,33 +1952,61 @@
} }
return 0; return 0;
}, },
getZhiShui:function(){ _getZaoByGan:function(index, name){
var offset = 4 - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex(); var offset = index - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayGanIndex();
if (offset < 0) {
offset += 12;
}
return LunarUtil.NUMBER[offset+1] + '龙治水';
},
getFenBing:function(){
var offset = 2 - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayGanIndex();
if (offset < 0) { if (offset < 0) {
offset += 10; offset += 10;
} }
return LunarUtil.NUMBER[offset+1] + '人分饼'; return name.replace('几', LunarUtil.NUMBER[offset+1]);
},
_getZaoByZhi:function(index, name){
var offset = index - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex();
if (offset < 0) {
offset += 12;
}
return name.replace('几', LunarUtil.NUMBER[offset+1]);
},
getTouLiang:function(){
return this._getZaoByZhi(0, '几鼠偷粮');
},
getCaoZi:function(){
return this._getZaoByZhi(0, '草子几分');
}, },
getGengTian:function(){ getGengTian:function(){
var offset = 1 - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex(); return this._getZaoByZhi(1, '几牛耕田');
if (offset < 0) { },
offset += 12; getHuaShou:function(){
} return this._getZaoByZhi(3, '花收几分');
return LunarUtil.NUMBER[offset+1] + '牛耕田'; },
getZhiShui:function(){
return this._getZaoByZhi(4, '几龙治水');
},
getTuoGu:function(){
return this._getZaoByZhi(6, '几马驮谷');
},
getQiangMi:function(){
return this._getZaoByZhi(9, '几鸡抢米');
},
getKanCan:function(){
return this._getZaoByZhi(9, '几姑看蚕');
},
getGongZhu:function(){
return this._getZaoByZhi(11, '几屠共猪');
},
getJiaTian:function(){
return this._getZaoByGan(0, '甲田几分');
},
getFenBing:function(){
return this._getZaoByGan(2, '几人分饼');
}, },
getDeJin:function(){ getDeJin:function(){
var offset = 7 - Solar.fromJulianDay(this.getMonth(1).getFirstJulianDay()).getLunar().getDayGanIndex(); return this._getZaoByGan(7, '几日得金');
if (offset < 0) { },
offset += 10; getRenBing:function(){
} return this._getZaoByGan(2, this._getZaoByZhi(2, '几人几丙'));
return LunarUtil.NUMBER[offset+1] + '日得金'; },
getRenChu:function(){
return this._getZaoByGan(3, this._getZaoByZhi(2, '几人几锄'));
}, },
getYuan:function(){ getYuan:function(){
return _YUAN[Math.floor((this._p.year+2696)/60)%3]+'元'; return _YUAN[Math.floor((this._p.year+2696)/60)%3]+'元';
@@ -3343,7 +3371,7 @@
getLunar: function(){return this._p.lunar;}, getLunar: function(){return this._p.lunar;},
getStartSolar: function(){ getStartSolar: function(){
var birth = this._p.lunar.getSolar(); var birth = this._p.lunar.getSolar();
var c = birth.getCalendar(); var c = ExactDate.fromYmdHms(birth.getYear(), birth.getMonth(), birth.getDay(), birth.getHour(), birth.getMinute(), birth.getSecond());
c.setFullYear(birth.getYear() + this._p.startYear); c.setFullYear(birth.getYear() + this._p.startYear);
c.setMonth(birth.getMonth()-1+this._p.startMonth); c.setMonth(birth.getMonth()-1+this._p.startMonth);
c.setDate(birth.getDay() + this._p.startDay); c.setDate(birth.getDay() + this._p.startDay);

View File

@@ -1,6 +1,6 @@
{ {
"name": "lunar-javascript", "name": "lunar-javascript",
"version": "1.2.18", "version": "1.2.19",
"description": "lunar is a calendar library for Solar and Chinese Lunar.", "description": "lunar is a calendar library for Solar and Chinese Lunar.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {