mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复ChineseDate
闰年闰月节日获取问题
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【extra 】 `Sftp``reconnectIfTimeout`方法改为捕获所有异常(issue#3989@Github)
|
||||
* 【core 】 修复`ChineseDate `闰年闰月节日获取问题(issue#ICL1BT@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.39(2025-06-20)
|
||||
|
@@ -329,7 +329,7 @@ public class ChineseDate {
|
||||
* @return 获得农历节日
|
||||
*/
|
||||
public String getFestivals() {
|
||||
return StrUtil.join(",", LunarFestival.getFestivals(this.year, this.month, day));
|
||||
return StrUtil.join(",", LunarFestival.getFestivals(this.year, this.isLeapMonth ? this.month - 1 : this.month, day));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package cn.hutool.core.date.chinese;
|
||||
|
||||
import cn.hutool.core.date.ChineseDate;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class IssueICL1BTTest {
|
||||
@Test
|
||||
void getFestivalsTest(){
|
||||
String date = "2025-07-31";
|
||||
Date productionDate = DateUtil.parseDate( date);
|
||||
ChineseDate chineseDate = new ChineseDate(productionDate);
|
||||
System.out.println(chineseDate.isLeapMonth());
|
||||
Assertions.assertTrue(chineseDate.isLeapMonth());
|
||||
String festivals = chineseDate.getFestivals();
|
||||
Assertions.assertEquals("", festivals);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user