mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
增加比较两个LocalDateTime是否为同一天
This commit is contained in:
parent
7dd7a35edf
commit
9676a663c3
@ -17,6 +17,7 @@
|
||||
* 【core 】 ForestMap添加getNodeValue方法(pr#699@Gitee)
|
||||
* 【http 】 优化HttpUtil.isHttp判断,避免NPE(pr#698@Gitee)
|
||||
* 【core 】 修复Dict#containsKey方法没区分大小写问题(pr#697@Gitee)
|
||||
* 【core 】 增加比较两个LocalDateTime是否为同一天(pr#693@Gitee)
|
||||
*
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复CollUtil里面关于可变参数传null造成的crash问题(pr#2428@Github)
|
||||
|
@ -581,6 +581,18 @@ public class LocalDateTimeUtil {
|
||||
* @since 5.8.5
|
||||
*/
|
||||
public static boolean isSameDay(final LocalDateTime date1, final LocalDateTime date2) {
|
||||
return date1 != null && date2 != null && date1.toLocalDate().isEqual(date2.toLocalDate());
|
||||
return date1 != null && date2 != null && isSameDay(date1.toLocalDate(), date2.toLocalDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较两个日期是否为同一天
|
||||
*
|
||||
* @param date1 日期1
|
||||
* @param date2 日期2
|
||||
* @return 是否为同一天
|
||||
* @since 5.8.5
|
||||
*/
|
||||
public static boolean isSameDay(final LocalDate date1, final LocalDate date2) {
|
||||
return date1 != null && date2 != null && date1.isEqual(date2);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user