1
0
mirror of synced 2025-12-10 07:31:46 +08:00

v1.2.26 修复物候的错误。

This commit is contained in:
6tail
2022-11-01 21:17:54 +08:00
parent ee0b227f75
commit 51afe36b4b
3 changed files with 21 additions and 2 deletions

View File

@@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<packaging>jar</packaging>
<version>1.2.25</version>
<version>1.2.26</version>
<name>${project.groupId}:${project.artifactId}</name>
<url>https://github.com/6tail/lunar-java</url>
<description>a calendar library for Solar and Chinese Lunar</description>
@@ -105,6 +105,7 @@
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<source>${source-version}</source>
</configuration>
</execution>
</executions>

View File

@@ -2990,7 +2990,11 @@ public class Lunar {
}
Solar startSolar = jieQi.getSolar();
int days = ExactDate.getDaysBetween(startSolar.getYear(), startSolar.getMonth(), startSolar.getDay(), solar.getYear(), solar.getMonth(), solar.getDay());
return LunarUtil.WU_HOU[(offset * 3 + days / 5) % LunarUtil.WU_HOU.length];
int index = days / 5;
if (index > 2) {
index = 2;
}
return LunarUtil.WU_HOU[(offset * 3 + index) % LunarUtil.WU_HOU.length];
}
/**

View File

@@ -103,4 +103,18 @@ public class WuHouTest {
Assert.assertEquals(solar.toString(),"小寒 初候",lunar.getHou());
}
@Test
public void test15(){
Solar solar = new Solar(2022,8,22);
Lunar lunar = solar.getLunar();
Assert.assertEquals(solar.toString(),"寒蝉鸣",lunar.getWuHou());
}
@Test
public void test16(){
Solar solar = new Solar(2022,8,23);
Lunar lunar = solar.getLunar();
Assert.assertEquals(solar.toString(),"鹰乃祭鸟",lunar.getWuHou());
}
}