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