From 701cec10a0af52a99d9df8e27d04b298bb5bcf3e Mon Sep 17 00:00:00 2001
From: 6tail <6tail@6tail.cn>
Date: Sun, 17 Mar 2024 14:00:34 +0800
Subject: [PATCH] =?UTF-8?q?v1.3.14=20=E4=BF=AE=E5=A4=8D=E5=85=AB=E5=AD=97?=
=?UTF-8?q?=E8=BD=AC=E9=98=B3=E5=8E=86=E5=AD=98=E5=9C=A8=E9=81=97=E6=BC=8F?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CHANGELOG.md | 3 +++
README.md | 2 +-
README_EN.md | 2 +-
pom.xml | 2 +-
src/main/java/com/nlf/calendar/Solar.java | 8 +++-----
src/test/java/test/BaZiTest.java | 13 +++++++++++++
6 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 689083c..61cee7a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,3 +8,6 @@
1. 修复节气当天获取下一节气仍为当前节气的问题。
2. 修复每日宜忌存在重复项的问题。
3. 修复八字转阳历存在遗漏的问题。
+
+## [1.3.14] - 2024-03-17
+1. 修复八字转阳历存在遗漏的问题。
diff --git a/README.md b/README.md
index 870937d..02dcdba 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
cn.6tail
lunar
- 1.3.13
+ 1.3.14
```
diff --git a/README_EN.md b/README_EN.md
index 27d43ce..3ef9508 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
cn.6tail
lunar
- 1.3.13
+ 1.3.14
```
diff --git a/pom.xml b/pom.xml
index 18d6cdd..cfadafd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cn.6tail
lunar
jar
- 1.3.13
+ 1.3.14
${project.groupId}:${project.artifactId}
https://github.com/6tail/lunar-java
a calendar library for Solar and Chinese Lunar
diff --git a/src/main/java/com/nlf/calendar/Solar.java b/src/main/java/com/nlf/calendar/Solar.java
index 999eee6..eb3a96e 100644
--- a/src/main/java/com/nlf/calendar/Solar.java
+++ b/src/main/java/com/nlf/calendar/Solar.java
@@ -335,9 +335,7 @@ public static List fromBaZi(String yearGanZhi, String monthGanZhi, String
Solar solarTime = jieQiList.get(4 + m);
if (solarTime.getYear() >= baseYear) {
// 日干支和节令干支的偏移值
- Lunar lunar = solarTime.getLunar();
- String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
- int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(dgz);
+ int d = LunarUtil.getJiaZiIndex(dayGanZhi) - LunarUtil.getJiaZiIndex(solarTime.getLunar().getDayInGanZhiExact2());
if (d < 0) {
d += 60;
}
@@ -355,8 +353,8 @@ public static List fromBaZi(String yearGanZhi, String monthGanZhi, String
}
// 验证一下
Solar solar = Solar.fromYmdHms(solarTime.getYear(), solarTime.getMonth(), solarTime.getDay(), hour, mi, s);
- lunar = solar.getLunar();
- dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
+ Lunar lunar = solar.getLunar();
+ String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) {
l.add(solar);
}
diff --git a/src/test/java/test/BaZiTest.java b/src/test/java/test/BaZiTest.java
index 17b6d59..52a6001 100644
--- a/src/test/java/test/BaZiTest.java
+++ b/src/test/java/test/BaZiTest.java
@@ -530,4 +530,17 @@ public void test30() {
Assert.assertEquals(expected, actual);
}
+ @Test
+ public void test31() {
+ List l = Solar.fromBaZi("丁卯","丁未","甲申","乙丑", 1, 1900);
+ List actual = new ArrayList();
+ for (Solar solar : l) {
+ actual.add(solar.toYmdHms());
+ }
+
+ List expected = new ArrayList();
+ expected.add("1987-08-03 02:00:00");
+ Assert.assertEquals(expected, actual);
+ }
+
}