You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Date referenceDate is 2001.01.01 00:00 UTC. However if you create a DateFormatter without a year, the effective referenceDate is 2000.01.01 00:00 UTC.
Given that the Date object allows for timeIntervals from both 1970 and 2001 it would more consistent if the DateFormatter used one of the expected epochs instead of using it's own.
Environment
Found on OSX in Xcode 10.13.6
Additional Detail from JIRA
md5: c91faf5e17cca5c5a5642e12413ef7b9
Issue Description:
The Date referenceDate is 2001.01.01 00:00 UTC. However if you create a DateFormatter without a year, the effective referenceDate is 2000.01.01 00:00 UTC.
Given that the Date object allows for timeIntervals from both 1970 and 2001 it would more consistent if the DateFormatter used one of the expected epochs instead of using it's own.
To replicate;
import Foundation
{{ }}let d = DateFormatter()
d.dateFormat = "mm:ss"
d.timeZone = TimeZone(abbreviation: "UTC")
{{ }}let date = d.date(from: "10:00")
let timeInterval = date?.timeIntervalSinceReferenceDate
{{ }}let zero = Date(timeIntervalSinceReferenceDate: 0)
print ("(zero)")
The text was updated successfully, but these errors were encountered: