Skip to content

Commit

Permalink
Default to incorrect behaviour in previous releases, decoding date fr…
Browse files Browse the repository at this point in the history
…om double
  • Loading branch information
Joannis committed Mar 13, 2023
1 parent 4c6ad91 commit 8b54dd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/BSON/Codable/Decoding/BSONDecoderSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public struct BSONDecoderSettings {
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
public var decodeObjectIdFromString: Bool = false

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

/// A strategy that is applied when encountering a request to decode a `Float`
Expand Down
2 changes: 1 addition & 1 deletion Tests/BSONTests/BSONEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BSONEncoderTests: XCTestCase {
}

let container = try BSONDecoder().decode(DateContainer.self, from: document)
XCTAssertEqual(date, container.date)
XCTAssertEqual(date.timeIntervalSince1970, container.date.timeIntervalSince1970)
}

@available(OSX 10.12, *)
Expand Down

0 comments on commit 8b54dd0

Please sign in to comment.