Looly 5 年之前
父节点
当前提交
6674dcbde7

+ 1 - 1
hutool-core/src/main/java/cn/hutool/core/date/Month.java

@@ -165,7 +165,7 @@ public enum Month {
 
 	/**
 	 * 获得指定月的最后一天
-	 * @param month 月份
+	 * @param month 月份,从0开始
 	 * @param isLeapYear 是否为闰年,闰年只对二月有影响
 	 * @return 最后一天,可能为28,29,30,31
 	 * @since 5.4.7

+ 10 - 11
hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java

@@ -7,17 +7,16 @@ import java.util.List;
 /**
  * 每月第几天匹配<br>
  * 考虑每月的天数不同,且存在闰年情况,日匹配单独使用
- * 
- * @author Looly
  *
+ * @author Looly
  */
 public class DayOfMonthValueMatcher extends BoolArrayValueMatcher {
 
-	private static final int[] LAST_DAYS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+	private static final int[] LAST_DAYS = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
 	/**
 	 * 构造
-	 * 
+	 *
 	 * @param intValueList 匹配的日值
 	 */
 	public DayOfMonthValueMatcher(List<Integer> intValueList) {
@@ -26,9 +25,9 @@ public class DayOfMonthValueMatcher extends BoolArrayValueMatcher {
 
 	/**
 	 * 给定的日期是否匹配当前匹配器
-	 * 
-	 * @param value 被检查的值,此处为日
-	 * @param month 实际的月份
+	 *
+	 * @param value      被检查的值,此处为日
+	 * @param month      实际的月份,从1开始
 	 * @param isLeapYear 是否闰年
 	 * @return 是否匹配
 	 */
@@ -44,13 +43,13 @@ public class DayOfMonthValueMatcher extends BoolArrayValueMatcher {
 	 * 1、闰年2月匹配是否为29
 	 * 2、其它月份是否匹配最后一天的日期(可能为30或者31)
 	 * </pre>
-	 * 
-	 * @param value 被检查的值
-	 * @param month 月份
+	 *
+	 * @param value      被检查的值
+	 * @param month      月份,从1开始
 	 * @param isLeapYear 是否闰年
 	 * @return 是否为本月最后一天
 	 */
 	private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
-		return value == Month.getLastDay(month, isLeapYear);
+		return value == Month.getLastDay(month - 1, isLeapYear);
 	}
 }