From a783dbd93fe2c350cda1fd61efa01101b1e15abb Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Wed, 20 Oct 2021 20:46:42 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.7=20=E4=BF=AE=E5=A4=8D=E5=84=92=E7=95=A5?= =?UTF-8?q?=E6=97=A5=E8=BD=AC=E9=98=B3=E5=8E=86=E7=A7=92=E6=95=B0=E4=B8=BA?= =?UTF-8?q?60=E7=9A=84=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 26 ++--------------------- README_EN.md | 26 ++--------------------- pom.xml | 2 +- src/main/java/com/nlf/calendar/Solar.java | 8 +++++++ src/test/java/test/JieQiTest.java | 13 ++++++++++++ 5 files changed, 26 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 5e121a1..ef99320 100644 --- a/README.md +++ b/README.md @@ -10,35 +10,13 @@ lunar是一款无第三方依赖的公历(阳历)和农历(阴历、老黄历) [English](https://github.com/6tail/lunar-java/blob/master/README_EN.md) -### 正式版本 +### Maven ```xml cn.6tail lunar - 1.2.6 - -``` - -### 快照版本 - -```xml - - sonatype - https://oss.sonatype.org/content/groups/public/ - - true - daily - warn - - -``` - -```xml - - cn.6tail - lunar - 1.2.0-SNAPSHOT + 1.2.7 ``` diff --git a/README_EN.md b/README_EN.md index a40216e..d20c612 100644 --- a/README_EN.md +++ b/README_EN.md @@ -6,35 +6,13 @@ lunar is a calendar library for Solar and Chinese Lunar. [简体中文](https://github.com/6tail/lunar-java/blob/master/README.md) -### Release +### Maven ```xml cn.6tail lunar - 1.2.6 - -``` - -### Snapshot - -```xml - - sonatype - https://oss.sonatype.org/content/groups/public/ - - true - daily - warn - - -``` - -```xml - - cn.6tail - lunar - 1.2.0-SNAPSHOT + 1.2.7 ``` diff --git a/pom.xml b/pom.xml index b38ad66..032f4ce 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ cn.6tail lunar jar - 1.2.6 + 1.2.7 ${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 d123514..943c3be 100644 --- a/src/main/java/com/nlf/calendar/Solar.java +++ b/src/main/java/com/nlf/calendar/Solar.java @@ -156,6 +156,14 @@ public class Solar { f -= minute; f *= 60; int second = (int) Math.round(f); + if (second > 59) { + second -= 60; + minute++; + } + if (minute > 59) { + minute -= 60; + hour++; + } calendar = ExactDate.fromYmdHms(year, month, day, hour, minute, second); this.year = year; diff --git a/src/test/java/test/JieQiTest.java b/src/test/java/test/JieQiTest.java index 0db8015..b54a695 100644 --- a/src/test/java/test/JieQiTest.java +++ b/src/test/java/test/JieQiTest.java @@ -173,4 +173,17 @@ public class JieQiTest { Assert.assertEquals("冬至", lunar.getPrevQi().getName()); Assert.assertEquals("冬至", lunar.getPrevJieQi().getName()); } + + @Test + public void test7() { + Lunar lunar = Lunar.fromYmd(2012, 9, 1); + Assert.assertEquals("2012-09-07 13:29:00", lunar.getJieQiTable().get("白露").toYmdHms()); + } + + @Test + public void test8() { + Lunar lunar = Lunar.fromYmd(2050, 12, 1); + Assert.assertEquals("2050-12-07 06:41:00", lunar.getJieQiTable().get("大雪").toYmdHms()); + } + }