From f7ed59e0c73dbd3cf314671d2843476caefd407c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sun, 26 Jul 2026 01:24:13 +0200 Subject: [PATCH] Defined the POSIX locale for the fixed-format date formatters at the DateFormatter+Properties extension in the library target. --- .../Internal/Extensions/DateFormatter+Properties.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/AmiiboService/Internal/Extensions/DateFormatter+Properties.swift b/Sources/AmiiboService/Internal/Extensions/DateFormatter+Properties.swift index 26fcafc..a39a5bf 100644 --- a/Sources/AmiiboService/Internal/Extensions/DateFormatter+Properties.swift +++ b/Sources/AmiiboService/Internal/Extensions/DateFormatter+Properties.swift @@ -24,6 +24,8 @@ extension DateFormatter { static let isoDate: DateFormatter = { let formatter = DateFormatter() + // A fixed-format date requires the POSIX locale, as the user's locale or 12/24-hour setting could otherwise alter the parsing. + formatter.locale = .init(identifier: "en_US_POSIX") formatter.dateFormat = "yyyy-MM-dd" formatter.timeZone = .init(secondsFromGMT: 0) @@ -37,6 +39,8 @@ extension DateFormatter { static let isoTimestamp: DateFormatter = { let formatter = DateFormatter() + // A fixed-format date requires the POSIX locale, as the user's locale or 12/24-hour setting could otherwise alter the parsing. + formatter.locale = .init(identifier: "en_US_POSIX") formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS" formatter.timeZone = .init(secondsFromGMT: 0)