Skip to content

Commit 44682f7

Browse files
author
Itai Ferber
committed
Ensure all Dates can always round-trip by default
1 parent f7cd0a6 commit 44682f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/SDK/Foundation/Codable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
extension Date : Codable {
1818
public init(from decoder: Decoder) throws {
1919
let timestamp = try decoder.singleValueContainer().decode(Double.self)
20-
self.init(timeIntervalSince1970: timestamp)
20+
self.init(timeIntervalSinceReferenceDate: timestamp)
2121
}
2222

2323
public func encode(to encoder: Encoder) throws {
2424
var container = encoder.singleValueContainer()
25-
try container.encode(self.timeIntervalSince1970)
25+
try container.encode(self.timeIntervalSinceReferenceDate)
2626
}
2727
}
2828

0 commit comments

Comments
 (0)