Is a date in same week, month, year of another date in swift : <p>What is the best way to know if a date is in the same week (or year or month) as another, preferably with an extension, and <strong>solely using Swift</strong>?</p>

<p>As an example, in Objective-C I have</p>

<pre><code>- (BOOL)isSameWeekAs:(NSDate *)date {
    NSDateComponents *otherDay = [[NSCalendar currentCalendar] components:NSCalendarUnitEra | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self];
    NSDateComponents *today = [[NSCalendar currentCalendar] components:NSCalendarUnitEra | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:date];
    return ([today weekOfYear]   == [otherDay weekOfYear] &amp;&amp;
            [today year]         == [otherDay year] &amp;&amp;
            [today era]          == [otherDay era]);
}
</code></pre>

<p>Please don't propose solutions bridging <code>Date</code> to <code>NSDate</code></p>
