1
0
mirror of synced 2026-02-04 20:18:01 +08:00

v1.2.35 修复物候的错误。

This commit is contained in:
6tail
2022-10-19 18:28:49 +08:00
parent a41d2c6c2a
commit 5d18af8619
3 changed files with 18 additions and 2 deletions

View File

@@ -83,3 +83,15 @@ test('test14', () => {
const lunar = solar.getLunar();
expect(lunar.getHou()).toBe('立夏 三候');
});
test('test15', () => {
const solar = Solar.fromYmd(2022, 8, 22);
const lunar = solar.getLunar();
expect(lunar.getWuHou()).toBe('寒蝉鸣');
});
test('test16', () => {
const solar = Solar.fromYmd(2022, 8, 23);
const lunar = solar.getLunar();
expect(lunar.getWuHou()).toBe('鹰乃祭鸟');
});

View File

@@ -1682,7 +1682,11 @@
var startSolar = jieQi.getSolar();
var startCalendar = ExactDate.fromYmd(startSolar.getYear(),startSolar.getMonth(),startSolar.getDay());
var days = ExactDate.getDaysBetween(startCalendar, currentCalendar);
return LunarUtil.WU_HOU[(offset*3+Math.floor(days/5)) % LunarUtil.WU_HOU.length];
var index = Math.floor(days / 5);
if (index > 2) {
index = 2;
}
return LunarUtil.WU_HOU[(offset * 3 + index) % LunarUtil.WU_HOU.length];
},
getHou:function(){
var jieQi = this.getPrevJieQi(true);

View File

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