NSCalendar computes wrong date components for given date pair with daylight saving time
| Originator: | p.schmittat | ||
| Number: | rdar://15323765 | Date Originated: | 25-Oct-2013 11:59 PM |
| Status: | Closed due to insufficient information | Resolved: | |
| Product: | iOS SDK | Product Version: | 6.1.3 |
| Classification: | Other Bugs | Reproducible: | Always |
Summary: Daylight saving time seems to introduce a bug when trying to compute the date components from two given dates. The result isn't correctly wrapped resulting in 24 hours instead of +1 day. A day after the given 'to' date results in date components missing 1 hour (resulting in 1 day, 23 hours and 55 minutes). Steps to Reproduce: NSCalendar *cal = [NSCalendar currentCalendar]; NSDate *from = [NSDate dateWithTimeIntervalSince1970:1382782709.210187]; NSDate *to = [NSDate dateWithTimeIntervalSince1970:1382872676.200044]; NSDateComponents *comp = [cal components:NSMinuteCalendarUnit | NSHourCalendarUnit | NSDayCalendarUnit | NSMonthCalendarUnit fromDate:from toDate:to options:0]; Expected Results: comp.day = 1 comp.hour = 0 comp.minute = 55 Actual Results: comp.day = 0 comp.hour = 24 comp.minute = 55 Version: iOS 6.1.3 iPod Touch 4th iOS 6.1 Simulator Configuration: Wrong result can be seen in following time zone / calendar settings: Europe/Berlin (MESZ) offset 7200 (Daylight) de_DE gregorian Current time of developer machine: 2013-10-25 21:43:08 +0000
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!