v1.7.3 修复个别日太岁方位的错误;修复八字身宫计算错误的问题。
This commit is contained in:
@@ -32,3 +32,7 @@
|
||||
## [1.7.2] - 2025-03-05
|
||||
1. 修复每日宜忌错误。
|
||||
2. 更新2018之后的△T参数。
|
||||
|
||||
## [1.7.3] - 2025-04-07
|
||||
1. 修复个别日太岁方位的错误。
|
||||
2. 修复八字身宫计算错误的问题。
|
||||
|
||||
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.3</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>
|
||||
|
||||
@@ -527,15 +527,12 @@ public class EightChar {
|
||||
public String getShenGong() {
|
||||
int monthZhiIndex = LunarUtil.find(getMonthZhi(), MONTH_ZHI, 0);
|
||||
int timeZhiIndex = LunarUtil.find(getTimeZhi(), LunarUtil.ZHI, 0);
|
||||
int offset = monthZhiIndex + timeZhiIndex;
|
||||
while (offset > 12) {
|
||||
offset -= 12;
|
||||
}
|
||||
int ganIndex = (lunar.getYearGanIndexExact() + 1) * 2 + (offset % 12);
|
||||
int offset = (monthZhiIndex + timeZhiIndex - 1) % 12;
|
||||
int ganIndex = (lunar.getYearGanIndexExact() + 1) * 2 + offset;
|
||||
while (ganIndex > 10) {
|
||||
ganIndex -= 10;
|
||||
}
|
||||
return LunarUtil.GAN[ganIndex] + MONTH_ZHI[offset];
|
||||
return LunarUtil.GAN[ganIndex + 1] + MONTH_ZHI[offset + 1];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1347,11 +1347,11 @@ public class Lunar {
|
||||
|
||||
protected String getDayPositionTaiSui(String dayInGanZhi, int yearZhiIndex) {
|
||||
String p;
|
||||
if ("甲子,乙丑,丙寅,丁卯,戊辰,已巳".contains(dayInGanZhi)) {
|
||||
if ("甲子,乙丑,丙寅,丁卯,戊辰,己巳".contains(dayInGanZhi)) {
|
||||
p = "震";
|
||||
} else if ("丙子,丁丑,戊寅,已卯,庚辰,辛巳".contains(dayInGanZhi)) {
|
||||
} else if ("丙子,丁丑,戊寅,己卯,庚辰,辛巳".contains(dayInGanZhi)) {
|
||||
p = "离";
|
||||
} else if ("戊子,已丑,庚寅,辛卯,壬辰,癸巳".contains(dayInGanZhi)) {
|
||||
} else if ("戊子,己丑,庚寅,辛卯,壬辰,癸巳".contains(dayInGanZhi)) {
|
||||
p = "中";
|
||||
} else if ("庚子,辛丑,壬寅,癸卯,甲辰,乙巳".contains(dayInGanZhi)) {
|
||||
p = "兑";
|
||||
|
||||
@@ -235,7 +235,7 @@ public class BaZiTest {
|
||||
@Test
|
||||
public void testShenGong1() {
|
||||
Lunar lunar = new Solar(1994, 12, 6, 2, 0, 0).getLunar();
|
||||
Assert.assertEquals("身宫", "乙丑", lunar.getEightChar().getShenGong());
|
||||
Assert.assertEquals("身宫", "丁丑", lunar.getEightChar().getShenGong());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -413,7 +413,7 @@ public class BaZiTest {
|
||||
Solar solar = new Solar(1986, 5, 29, 13, 37, 0);
|
||||
Lunar lunar = solar.getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("己丑", eightChar.getShenGong());
|
||||
Assert.assertEquals("辛丑", eightChar.getShenGong());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -543,4 +543,10 @@ public class BaZiTest {
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test32() {
|
||||
Lunar lunar = Solar.fromYmdHms(1980, 6, 15, 12, 30, 30).getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("身宫", "己丑", eightChar.getShenGong());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user