1
0
mirror of synced 2025-11-06 05:00:34 +08:00

v1.2.25 修复春节和立春之间月干错误的问题。

This commit is contained in:
6tail
2022-10-12 21:08:06 +08:00
parent 1aefcdcf0c
commit a16767e2c7
6 changed files with 34 additions and 5 deletions

View File

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

View File

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

11
pom.xml
View File

@@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<packaging>jar</packaging>
<version>1.2.24</version>
<version>1.2.25</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>
@@ -48,6 +48,7 @@
<sourceEncoding>UTF-8</sourceEncoding>
<source-version>1.5</source-version>
<target-version>1.5</target-version>
<creator>6tail</creator>
<maven-compiler-plugin-version>3.3</maven-compiler-plugin-version>
<maven-surefire-plugin-version>2.5</maven-surefire-plugin-version>
<maven-javadoc-plugin-version>2.9</maven-javadoc-plugin-version>
@@ -60,7 +61,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -154,6 +155,12 @@
<descriptors>
<descriptor>${basedir}/src/assembly/assembly.xml</descriptor>
</descriptors>
<archive>
<manifestEntries>
<Created-By>${creator}</Created-By>
<Built-By>${creator}</Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>

View File

@@ -183,6 +183,9 @@ public class Lunar {
this.second = second;
Solar noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1);
this.solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second);
if (noon.getYear() != lunarYear) {
y = LunarYear.fromYear(noon.getYear());
}
compute(y);
}

View File

@@ -276,4 +276,23 @@ public class BaZiTest {
Assert.assertEquals("1990-04-15", lunar.getEightChar().getYun(1).getStartSolar().toYmd());
}
@Test
public void test10(){
Lunar lunar = Solar.fromYmdHms(1988, 2, 15, 23, 30, 0).getLunar();
EightChar eightChar = lunar.getEightChar();
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
Assert.assertEquals("日柱", "庚子", eightChar.getDay());
Assert.assertEquals("时柱", "戊子", eightChar.getTime());
}
@Test
public void test11(){
Lunar lunar = Lunar.fromYmdHms(1987, 12, 28, 23, 30, 0);
EightChar eightChar = lunar.getEightChar();
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
Assert.assertEquals("日柱", "庚子", eightChar.getDay());
Assert.assertEquals("时柱", "戊子", eightChar.getTime());
}
}

View File

@@ -183,7 +183,7 @@ public class JieQiTest {
@Test
public void test8() {
Lunar lunar = Lunar.fromYmd(2050, 12, 1);
Assert.assertEquals("2050-12-07 06:41:00", lunar.getJieQiTable().get("大雪").toYmdHms());
Assert.assertEquals("2050-12-07 06:41:00", lunar.getJieQiTable().get("DA_XUE").toYmdHms());
}
@Test