app-starlock/lib/main/lockDetail/doorLockLog/date_time_extensions.dart

11 lines
382 B
Dart
Raw Permalink Normal View History

extension DateTimeExtensions on DateTime {
/// 返回一个新的 DateTime只保留年月日时间部分设为 00:00:00.000
DateTime get withoutTime {
return DateTime(year, month, day);
}
/// 判断两个日期是否是同一天(忽略时间)
bool isSameDate(DateTime other) {
return year == other.year && month == other.month && day == other.day;
}
}