Skip to content

Commit 09b7a58

Browse files
authored
(158139242) Prevent encodingDateFormatted() from using the current internationalization preferences (#1467)
1 parent 9acb166 commit 09b7a58

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Tests/FoundationEssentialsTests/JSONEncoderTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,6 +2896,11 @@ extension JSONEncoderTests {
28962896
let formatter = DateFormatter()
28972897
formatter.dateStyle = .full
28982898
formatter.timeStyle = .full
2899+
var cal = Calendar(identifier: .gregorian)
2900+
cal.timeZone = .gmt
2901+
formatter.calendar = cal
2902+
formatter.locale = Locale(identifier: "en_US")
2903+
formatter.timeZone = .gmt
28992904

29002905
let timestamp = Date(timeIntervalSince1970: 1000)
29012906
let expectedJSON = "\"\(formatter.string(from: timestamp))\"".data(using: .utf8)!

0 commit comments

Comments
 (0)