From 51afe36b4b5d89152a6d301ef2b1b80a436c713b Mon Sep 17 00:00:00 2001
From: 6tail <6tail@6tail.cn>
Date: Tue, 1 Nov 2022 21:17:54 +0800
Subject: [PATCH] =?UTF-8?q?v1.2.26=20=E4=BF=AE=E5=A4=8D=E7=89=A9=E5=80=99?=
=?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 3 ++-
src/main/java/com/nlf/calendar/Lunar.java | 6 +++++-
src/test/java/test/WuHouTest.java | 14 ++++++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 28f710b..856f049 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cn.6tail
lunar
jar
- 1.2.25
+ 1.2.26
${project.groupId}:${project.artifactId}
https://github.com/6tail/lunar-java
a calendar library for Solar and Chinese Lunar
@@ -105,6 +105,7 @@
-Xdoclint:none
+
diff --git a/src/main/java/com/nlf/calendar/Lunar.java b/src/main/java/com/nlf/calendar/Lunar.java
index 2c9d1c4..c8b142a 100644
--- a/src/main/java/com/nlf/calendar/Lunar.java
+++ b/src/main/java/com/nlf/calendar/Lunar.java
@@ -2990,7 +2990,11 @@ public String getWuHou() {
}
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];
}
/**
diff --git a/src/test/java/test/WuHouTest.java b/src/test/java/test/WuHouTest.java
index 4f86508..42db891 100644
--- a/src/test/java/test/WuHouTest.java
+++ b/src/test/java/test/WuHouTest.java
@@ -103,4 +103,18 @@ public void test13(){
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());
+ }
+
}