Skip to content

Commit

Permalink
v1.2.7 修复儒略日转阳历秒数为60的错误。
Browse files Browse the repository at this point in the history
  • Loading branch information
6tail committed Oct 20, 2021
1 parent fc0a629 commit a783dbd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 49 deletions.
26 changes: 2 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,13 @@ lunar是一款无第三方依赖的公历(阳历)和农历(阴历、老黄历)
[English](https://github.com/6tail/lunar-java/blob/master/README_EN.md)

### 正式版本
### Maven

```xml
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.6</version>
</dependency>
```

### 快照版本

```xml
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
```

```xml
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.7</version>
</dependency>
```

Expand Down
26 changes: 2 additions & 24 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.6</version>
</dependency>
```

### Snapshot

```xml
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
```

```xml
<dependency>
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.7</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>cn.6tail</groupId>
<artifactId>lunar</artifactId>
<packaging>jar</packaging>
<version>1.2.6</version>
<version>1.2.7</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>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/nlf/calendar/Solar.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ public Solar(double julianDay) {
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;
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/test/JieQiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,17 @@ public void test() {
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());
}

}

0 comments on commit a783dbd

Please sign in to comment.