Comparing only dates of DateTimes in Dart : <p>I need to store and compare dates (without times) in my app, without caring about time zones.<br>
I can see three solutions to this:</p>

<ol>
<li><p><code>(date1.year == date2.year &amp;&amp; date1.month == date2.month &amp;&amp; date1.day == date2.day)</code><br>
This is what I'm doing now, but it's horrible verbose.</p></li>
<li><p><code>date1.format("YYYYMMDD") == date2.format("YYYYMMDD")</code><br>
This is still rather verbose (though not as bad), but just seems inefficient to me...</p></li>
<li><p>Create a new Date class myself, perhaps storing the date as a "YYYYMMDD" string, or number of days since Jan 1 1980. But this means re-implementing a whole bunch of complex logic like different month lengths, adding/subtracting and leap years.</p></li>
</ol>

<p>Creating a new class also avoids an edge case I'm worried about, where adding <code>Duration(days: 1)</code> ends up with the same date due to daylight saving changes. But there are probably edge cases with this method I'm not thinking of...</p>

<p>Which is the best of these solutions, or is there an even better solution I haven't thought of?</p>
