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()); + } + }