1
0
mirror of synced 2025-12-24 14:27:59 +08:00

v1.3.14 修复八字转阳历存在遗漏的问题。

This commit is contained in:
6tail
2024-03-17 14:00:34 +08:00
parent 0a4d172ef6
commit 701cec10a0
6 changed files with 22 additions and 8 deletions

View File

@@ -8,3 +8,6 @@
1. 修复节气当天获取下一节气仍为当前节气的问题。 1. 修复节气当天获取下一节气仍为当前节气的问题。
2. 修复每日宜忌存在重复项的问题。 2. 修复每日宜忌存在重复项的问题。
3. 修复八字转阳历存在遗漏的问题。 3. 修复八字转阳历存在遗漏的问题。
## [1.3.14] - 2024-03-17
1. 修复八字转阳历存在遗漏的问题。

View File

@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
<dependency> <dependency>
<groupId>cn.6tail</groupId> <groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId> <artifactId>lunar</artifactId>
<version>1.3.13</version> <version>1.3.14</version>
</dependency> </dependency>
``` ```

View File

@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
<dependency> <dependency>
<groupId>cn.6tail</groupId> <groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId> <artifactId>lunar</artifactId>
<version>1.3.13</version> <version>1.3.14</version>
</dependency> </dependency>
``` ```

View File

@@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId> <groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId> <artifactId>lunar</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.3.13</version> <version>1.3.14</version>
<name>${project.groupId}:${project.artifactId}</name> <name>${project.groupId}:${project.artifactId}</name>
<url>https://github.com/6tail/lunar-java</url> <url>https://github.com/6tail/lunar-java</url>
<description>a calendar library for Solar and Chinese Lunar</description> <description>a calendar library for Solar and Chinese Lunar</description>

View File

@@ -335,9 +335,7 @@ public class Solar {
Solar solarTime = jieQiList.get(4 + m); Solar solarTime = jieQiList.get(4 + m);
if (solarTime.getYear() >= baseYear) { if (solarTime.getYear() >= baseYear) {
// 日干支和节令干支的偏移值 // 日干支和节令干支的偏移值
Lunar lunar = solarTime.getLunar(); int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(solarTime.getLunar().getDayInGanZhiExact2());
String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(dgz);
if (d < 0) { if (d < 0) {
d += 60; d += 60;
} }
@@ -355,8 +353,8 @@ public class Solar {
} }
// 验证一下 // 验证一下
Solar solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), hour, mi, s); Solar solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), hour, mi, s);
lunar = solar.getLunar(); Lunar lunar = solar.getLunar();
dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact(); String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) { if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) {
l.add(solar); l.add(solar);
} }

View File

@@ -530,4 +530,17 @@ public class BaZiTest {
Assert.assertEquals(expected, actual); Assert.assertEquals(expected, actual);
} }
@Test
public void test31() {
List<Solar> l = Solar.fromBaZi("丁卯","丁未","甲申","乙丑", 1, 1900);
List<String> actual = new ArrayList<String>();
for (Solar solar : l) {
actual.add(solar.toYmdHms());
}
List<String> expected = new ArrayList<String>();
expected.add("1987-08-03 02:00:00");
Assert.assertEquals(expected, actual);
}
} }