- [NSCalendar isDate:equalToDate:toUnitGranularity:] returns YES for dates that are on different days

Originator:hank8903
Number:rdar://27663207 Date Originated:02-Aug-2016 12:23 PM
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:Always
 
Area:
Something not on this list

Summary:
When comparing 2020-11-01 07:00:00 +0000 and 2020-11-02 07:00:00 +0000, using - [NSCalendar isDate:equalToDate:toUnitGranularity:]  with a UnitGranularity of NSCalendarUnitDay, the method returns  YES. 

It appears that this happens for all hours > 6 on November 1, 2020. If an hour is not specified in the NSDateComponents used to generate the NSDate, comparison returns NO (as expected).

Steps to Reproduce:
1. Open sample application
2. Observe console output 

Expected Results:
- [NSCalendar isDate:equalToDate:toUnitGranularity:] returns NO

Actual Results:
- [NSCalendar isDate:equalToDate:toUnitGranularity:] returns YES

Version:
Xcode 7.3.1, iOS 9.3, iOS 10 beta 

Notes:


Configuration:
iPhone 6S 9.3 Simulator, iPhone 6S, iPhone 6

Attachments:
'Date  Test.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!