Skip to content

Commit 8b54dd0

Browse files
committed
Default to incorrect behaviour in previous releases, decoding date from double
1 parent 4c6ad91 commit 8b54dd0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/BSON/Codable/Decoding/BSONDecoderSettings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public struct BSONDecoderSettings {
158158
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
159159
public var decodeObjectIdFromString: Bool = false
160160

161-
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
161+
/// If `true`, allows decoding Date from a Double (TimeInterval)
162162
public var decodeDateFromTimestamp: Bool = true
163163

164164
/// A strategy that is applied when encountering a request to decode a `Float`

Tests/BSONTests/BSONEncoderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class BSONEncoderTests: XCTestCase {
9797
}
9898

9999
let container = try BSONDecoder().decode(DateContainer.self, from: document)
100-
XCTAssertEqual(date, container.date)
100+
XCTAssertEqual(date.timeIntervalSince1970, container.date.timeIntervalSince1970)
101101
}
102102

103103
@available(OSX 10.12, *)

0 commit comments

Comments
 (0)