NSDateFormatter parses some dates wrong - off by several seconds
Originator: | wadetregaskis | ||
Number: | rdar://18406578 | Date Originated: | 21-Sep-2014 11:20 AM |
Status: | Open | Resolved: | |
Product: | OS X | Product Version: | 10.9.5 |
Classification: | Serious Bug | Reproducible: | Always |
Using [[[NSDateFormatter alloc] init] dateFromString:...], I get the following: "2014:09:15 06:22:36" -> 2014-09-15 13:22:36 +0000 "2014:09:15 06:22:38" -> 2014-09-15 13:22:40 +0000 Using [NSDate dateWithNaturalLanguageString:...], I get: "2014:09:15 06:22:36" -> 2014-09-21 06:22:36 -0700 "2014:09:15 06:22:38" -> 2014-09-21 06:22:38 -0700 Using NSDateFormatter I can get results for different dates where the resulting NSDates are isEqual: to each other, erroneously. e.g.: "2014:09:15 06:22:42" & "2014:09:15 06:22:44" -> 2014-09-15 13:22:44 +0000 The NSDate versions, which show the exact same date as the input string, are not isEqual:, as expected. Configuration: Compiling using `clang` from the Xcode 6.1 [beta] toolchain (Apple LLVM version 6.0 (clang-600.0.54)). Using the flags: -mmacosx-version-min=10.8 -fobjc-arc -pedantic -Wno-gnu -framework Foundation First noticed on 10.9.5, but reproducible through to 10.10.1 (so far).
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!