diff --git a/README.md b/README.md
index b0ea924..2415e01 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
cn.6tail
lunar
- 1.3.5
+ 1.3.6
```
diff --git a/README_EN.md b/README_EN.md
index 6325f2a..33233b0 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.5
+ 1.3.6
```
diff --git a/pom.xml b/pom.xml
index d146396..65724b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cn.6tail
lunar
jar
- 1.3.5
+ 1.3.6
${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 7e6874f..0851760 100644
--- a/src/main/java/com/nlf/calendar/Solar.java
+++ b/src/main/java/com/nlf/calendar/Solar.java
@@ -714,19 +714,17 @@ public Solar nextYear(int years) {
int y = year + years;
int m = month;
int d = day;
- // 2月处理
- if (2 == m) {
+ if (1582 == y && 10 == m) {
+ if (d > 4 && d < 15) {
+ d += 10;
+ }
+ } else if (2 == m) {
if (d > 28) {
if (!SolarUtil.isLeapYear(y)) {
d = 28;
}
}
}
- if (1582 == y && 10 == m) {
- if (d > 4 && d < 15) {
- d += 10;
- }
- }
return fromYmdHms(y, m, d, hour, minute, second);
}
@@ -740,18 +738,15 @@ public Solar nextMonth(int months) {
int y = month.getYear();
int m = month.getMonth();
int d = day;
- // 2月处理
- if (2 == m) {
- if (d > 28) {
- if (!SolarUtil.isLeapYear(y)) {
- d = 28;
- }
- }
- }
if (1582 == y && 10 == m) {
if (d > 4 && d < 15) {
d += 10;
}
+ } else {
+ int maxDay = SolarUtil.getDaysOfMonth(y, m);
+ if (d > maxDay) {
+ d = maxDay;
+ }
}
return fromYmdHms(y, m, d, hour, minute, second);
}
diff --git a/src/main/java/com/nlf/calendar/util/LunarUtil.java b/src/main/java/com/nlf/calendar/util/LunarUtil.java
index 9524070..1f612ae 100644
--- a/src/main/java/com/nlf/calendar/util/LunarUtil.java
+++ b/src/main/java/com/nlf/calendar/util/LunarUtil.java
@@ -159,7 +159,7 @@ public class LunarUtil{
put("6-6",Collections.nCopies(1,"天贶节"));
put("6-24",Collections.nCopies(1,"观莲节"));
put("6-25",Collections.nCopies(1,"五谷母节"));
- put("7-14",Collections.nCopies(1,"中元节"));
+ put("7-15",Collections.nCopies(1,"中元节"));
put("7-22",Collections.nCopies(1,"财神节"));
put("7-29",Collections.nCopies(1,"地藏节"));
put("8-1",Collections.nCopies(1,"天灸日"));
diff --git a/src/test/java/test/SolarTest.java b/src/test/java/test/SolarTest.java
index 3d125cc..bfa421c 100644
--- a/src/test/java/test/SolarTest.java
+++ b/src/test/java/test/SolarTest.java
@@ -171,4 +171,28 @@ public void test26(){
Assert.assertEquals("1582-09-29", solar.next(-6).toYmd());
}
+ @Test
+ public void test27(){
+ Solar solar = Solar.fromYmd(2023, 8, 31);
+ Assert.assertEquals("2023-09-30", solar.nextMonth(1).toYmd());
+ }
+
+ @Test
+ public void test28(){
+ Solar solar = Solar.fromYmd(2023, 8, 31);
+ Assert.assertEquals("2023-10-31", solar.nextMonth(2).toYmd());
+ }
+
+ @Test
+ public void test29(){
+ Solar solar = Solar.fromYmd(2023, 8, 31);
+ Assert.assertEquals("2025-08-31", solar.nextYear(2).toYmd());
+ }
+
+ @Test
+ public void test30(){
+ Solar solar = Solar.fromYmd(2023, 8, 31);
+ Assert.assertEquals("2024-02-29", solar.nextMonth(6).toYmd());
+ }
+
}