1
0
mirror of synced 2026-02-04 12:07:59 +08:00

v1.3.9 修复星期错误的问题。

This commit is contained in:
6tail
2023-11-09 11:58:29 +08:00
parent 9e36b0739c
commit a17402241a
6 changed files with 17 additions and 5 deletions

View File

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

View File

@@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<packaging>jar</packaging>
<version>1.3.8</version>
<version>1.3.9</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>

View File

@@ -358,7 +358,7 @@ public class Solar {
* @return 0123456
*/
public int getWeek() {
return ((int)getJulianDay() + 7000002) % 7;
return ((int)(getJulianDay() + 0.5) + 7000001) % 7;
}
/**

View File

@@ -77,7 +77,7 @@ public class BaZiTestNew {
public void test7() {
Solar solar = new Solar(2020, 5, 26, 23, 43, 0);
Lunar lunar = solar.getLunar();
//庚子, 辛巳, 庚午, 丙子]
// [庚子, 辛巳, 庚午, 丙子]
System.out.println(lunar.getEightChar());
}

View File

@@ -97,4 +97,16 @@ public class WeekTest {
Assert.assertEquals(3, solar.getWeek());
}
@Test
public void test10(){
Assert.assertEquals(6, Solar.fromYmd(1961, 9, 30).getWeek());
Assert.assertEquals(6, Solar.fromYmdHms(1961, 9, 30, 23, 59, 59).getWeek());
Assert.assertEquals(6, Solar.fromYmdHms(1961, 9, 30, 20, 0, 0).getWeek());
}
@Test
public void test11(){
Assert.assertEquals(3, Solar.fromYmdHms(2021, 9, 15, 20, 0, 0).getWeek());
}
}