Comparing only dates of DateTimes in Dart
问题 I need to store and compare dates (without times) in my app, without caring about time zones. I can see three solutions to this: (date1.year == date2.year && date1.month == date2.month && date1.day == date2.day) This is what I'm doing now, but it's horrible verbose. date1.format("YYYYMMDD") == date2.format("YYYYMMDD") This is still rather verbose (though not as bad), but just seems inefficient to me... Create a new Date class myself, perhaps storing the date as a "YYYYMMDD" string, or number