From a17402241ad7c74ed32132e764e6a20f7ad1afbf Mon Sep 17 00:00:00 2001
From: 6tail <6tail@6tail.cn>
Date: Thu, 9 Nov 2023 11:58:29 +0800
Subject: [PATCH] =?UTF-8?q?v1.3.9=20=E4=BF=AE=E5=A4=8D=E6=98=9F=E6=9C=9F?=
=?UTF-8?q?=E9=94=99=E8=AF=AF=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
---
README.md | 2 +-
README_EN.md | 2 +-
pom.xml | 2 +-
src/main/java/com/nlf/calendar/Solar.java | 2 +-
src/test/java/sample/BaZiTestNew.java | 2 +-
src/test/java/test/WeekTest.java | 12 ++++++++++++
6 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index a317e30..cd48a8b 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
cn.6tail
lunar
- 1.3.8
+ 1.3.9
```
diff --git a/README_EN.md b/README_EN.md
index 6af60b4..24b7128 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.8
+ 1.3.9
```
diff --git a/pom.xml b/pom.xml
index 1dd84da..8ceed54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cn.6tail
lunar
jar
- 1.3.8
+ 1.3.9
${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 36f38ba..6fd1052 100644
--- a/src/main/java/com/nlf/calendar/Solar.java
+++ b/src/main/java/com/nlf/calendar/Solar.java
@@ -358,7 +358,7 @@ public boolean isLeapYear() {
* @return 0123456
*/
public int getWeek() {
- return ((int)getJulianDay() + 7000002) % 7;
+ return ((int)(getJulianDay() + 0.5) + 7000001) % 7;
}
/**
diff --git a/src/test/java/sample/BaZiTestNew.java b/src/test/java/sample/BaZiTestNew.java
index e1a292d..51c381f 100644
--- a/src/test/java/sample/BaZiTestNew.java
+++ b/src/test/java/sample/BaZiTestNew.java
@@ -77,7 +77,7 @@ public void testBazi2Solar6() {
public void test7() {
Solar solar = new Solar(2020, 5, 26, 23, 43, 0);
Lunar lunar = solar.getLunar();
- //庚子, 辛巳, 庚午, 丙子]
+ // [庚子, 辛巳, 庚午, 丙子]
System.out.println(lunar.getEightChar());
}
diff --git a/src/test/java/test/WeekTest.java b/src/test/java/test/WeekTest.java
index d89773d..f639cb9 100644
--- a/src/test/java/test/WeekTest.java
+++ b/src/test/java/test/WeekTest.java
@@ -97,4 +97,16 @@ public void test9(){
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());
+ }
+
}