Defined the POSIX locale for the fixed-format date formatters at the DateFormatter+Properties extension in the library target.

This commit is contained in:
2026-07-26 01:24:13 +02:00
parent bfa839b058
commit f7ed59e0c7
@@ -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)