From 42ea95691cde01a5a110b02246921667f4eb7c91 Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Tue, 12 Aug 2025 09:58:47 -0700 Subject: [PATCH] (158139242) Prevent encodingDateFormatted() from using the current internationalization preferences --- Tests/FoundationEssentialsTests/JSONEncoderTests.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tests/FoundationEssentialsTests/JSONEncoderTests.swift b/Tests/FoundationEssentialsTests/JSONEncoderTests.swift index 466dcceff..696ecb117 100644 --- a/Tests/FoundationEssentialsTests/JSONEncoderTests.swift +++ b/Tests/FoundationEssentialsTests/JSONEncoderTests.swift @@ -2896,6 +2896,11 @@ extension JSONEncoderTests { let formatter = DateFormatter() formatter.dateStyle = .full formatter.timeStyle = .full + var cal = Calendar(identifier: .gregorian) + cal.timeZone = .gmt + formatter.calendar = cal + formatter.locale = Locale(identifier: "en_US") + formatter.timeZone = .gmt let timestamp = Date(timeIntervalSince1970: 1000) let expectedJSON = "\"\(formatter.string(from: timestamp))\"".data(using: .utf8)!