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

11 lines
382 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}