From 8ad16be6cbd9bbe3ec7f15d38562e34ad4fb18fe Mon Sep 17 00:00:00 2001 From: Looly Date: Thu, 10 Jul 2025 11:54:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`ChineseDate=20`=E9=97=B0?= =?UTF-8?q?=E5=B9=B4=E9=97=B0=E6=9C=88=E8=8A=82=E6=97=A5=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/hutool/v7/core/date/chinese/ChineseDate.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/v7/core/date/chinese/ChineseDate.java b/hutool-core/src/main/java/cn/hutool/v7/core/date/chinese/ChineseDate.java index 8b55f9d67..26fadc5f6 100644 --- a/hutool-core/src/main/java/cn/hutool/v7/core/date/chinese/ChineseDate.java +++ b/hutool-core/src/main/java/cn/hutool/v7/core/date/chinese/ChineseDate.java @@ -345,7 +345,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)); } /** @@ -411,7 +411,7 @@ public class ChineseDate { * @since 6.0.0 */ public String toString(ChineseDateFormat format) { - if(null == format){ + if (null == format) { format = ChineseDateFormat.MIX; } @@ -420,12 +420,12 @@ public class ChineseDate { String normalizedYear = GanZhi.getGanzhiOfYear(year); String normalizedMonth = getChineseMonth(); String normalizedDay = getChineseDay(); - switch (format){ + switch (format) { case GXSS: dateTemplate = "农历{}" + getChineseZodiac() + "年{}{}"; normalizedMonth = getChineseMonthName(); break; - case XSS : + case XSS: normalizedYear = getChineseZodiac(); break; case GSG: @@ -439,7 +439,7 @@ public class ChineseDate { break; case MIX: //根据选择的格式返回不同标准化日期输出,默认为Mix - dateTemplate = "公元"+ this.year +"年农历{}年{}{}"; + dateTemplate = "公元" + this.year + "年农历{}年{}{}"; case GSS: break; default: