// ios/smart_text_flutter/Sources/smart_text_flutter/NSDataDetectorExtension.swift:88-90
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
A fixed format string combined with the user's locale produces wrong output under non-Gregorian calendars. A user whose device is set to the Buddhist or Japanese calendar gets a year like 2569 in the rawValue.
This is a well-known iOS pitfall: fixed-format DateFormatter must pin its locale.
Fix: set locale = Locale(identifier: "en_US_POSIX"), or use ISO8601DateFormatter, which is what the format string is imitating.
Found during the v0.4.0 codebase audit.
A fixed format string combined with the user's locale produces wrong output under non-Gregorian calendars. A user whose device is set to the Buddhist or Japanese calendar gets a year like 2569 in the
rawValue.This is a well-known iOS pitfall: fixed-format
DateFormattermust pin its locale.Fix: set
locale = Locale(identifier: "en_US_POSIX"), or useISO8601DateFormatter, which is what the format string is imitating.Found during the v0.4.0 codebase audit.