mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
f2462892d8
commit
efeddc1469
@ -2,11 +2,12 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.21 (2022-01-20)
|
# 5.7.21 (2022-01-21)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【extra 】 增加jetbrick模板支持
|
* 【extra 】 增加jetbrick模板支持
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
|
* 【core 】 修复ChineseDate农历获取正月出现数组越界BUG(issue#2112@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.20 (2022-01-20)
|
# 5.7.20 (2022-01-20)
|
||||||
|
@ -92,7 +92,7 @@ public class ChineseDate {
|
|||||||
offset -= daysOfMonth;
|
offset -= daysOfMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLeapMonth = month == (leapMonth + 1);
|
this.isLeapMonth = leapMonth > 0 && (month == (leapMonth + 1));
|
||||||
if (hasLeapMonth && false == this.isLeapMonth) {
|
if (hasLeapMonth && false == this.isLeapMonth) {
|
||||||
// 当前月份前有闰月,则月份显示要-1,除非当前月份就是润月
|
// 当前月份前有闰月,则月份显示要-1,除非当前月份就是润月
|
||||||
month--;
|
month--;
|
||||||
|
@ -105,4 +105,12 @@ public class ChineseDateTest {
|
|||||||
Assert.assertEquals("戊申猴年 五月初五", c1.toString());
|
Assert.assertEquals("戊申猴年 五月初五", c1.toString());
|
||||||
Assert.assertEquals("戊申猴年 闰五月初五", c2.toString());
|
Assert.assertEquals("戊申猴年 闰五月初五", c2.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getChineseMonthTest2(){
|
||||||
|
//https://github.com/dromara/hutool/issues/2112
|
||||||
|
ChineseDate springFestival = new ChineseDate(DateUtil.parseDate("2022-02-01"));
|
||||||
|
final String chineseMonth = springFestival.getChineseMonth();
|
||||||
|
Assert.assertEquals("一月", chineseMonth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user