diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d495134..999fdb060 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.22(2023-08-04) +# 5.8.22(2023-08-07) ### 🐣新特性 * 【core 】 NumberUtil.nullToZero增加重载(issue#I7PPD2@Gitee) @@ -12,6 +12,7 @@ * 【core 】 修复NumberUtil.toBigDecimal转换科学计数法问题(issue#3241@Github) * 【core 】 修复PathUtil.moveContent当target不存在时会报错问题(issue#3238@Github) * 【db 】 修复SqlUtil.formatSql 格式化的sql换行异常(pr#3247@Github) +* 【core 】 修复DateUtil.parse 给定一个时间解析错误问题(issue#I7QI6R@Gitee) ------------------------------------------------------------------------------------------------------------- # 5.8.21(2023-07-29) diff --git a/hutool-core/src/main/java/cn/hutool/core/date/DatePattern.java b/hutool-core/src/main/java/cn/hutool/core/date/DatePattern.java index 0a67c8f58..a499c9e7d 100644 --- a/hutool-core/src/main/java/cn/hutool/core/date/DatePattern.java +++ b/hutool-core/src/main/java/cn/hutool/core/date/DatePattern.java @@ -27,7 +27,7 @@ public class DatePattern { * * @since 5.3.6 */ - public static final Pattern REGEX_NORM = Pattern.compile("\\d{4}-\\d{1,2}-\\d{1,2}(\\s\\d{1,2}:\\d{1,2}(:\\d{1,2})?)?(.\\d{1,6})?"); + public static final Pattern REGEX_NORM = Pattern.compile("\\d{4}-\\d{1,2}-\\d{1,2}(\\s\\d{1,2}:\\d{1,2}(:\\d{1,2})?(.\\d{1,6})?)?"); //-------------------------------------------------------------------------------------------------------------------------------- Normal /** diff --git a/hutool-core/src/test/java/cn/hutool/core/date/IssueI7QI6RTest.java b/hutool-core/src/test/java/cn/hutool/core/date/IssueI7QI6RTest.java new file mode 100755 index 000000000..d2e47b69c --- /dev/null +++ b/hutool-core/src/test/java/cn/hutool/core/date/IssueI7QI6RTest.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 looly(loolly@aliyun.com) + * Hutool is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package cn.hutool.core.date; + +import org.junit.Test; + +public class IssueI7QI6RTest { + @Test(expected = DateException.class) + public void parseTest() { + DateUtil.parse("2023-08-04 1"); + } + + @Test(expected = DateException.class) + public void parseTest2() { + DateUtil.parse("2023-08-04-1"); + } +}