Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date parsing fails with American timezones if locale isn't American #2

Open
jonlidgard opened this issue Apr 12, 2022 · 0 comments
Open

Comments

@jonlidgard
Copy link

jonlidgard commented Apr 12, 2022

See: https://developer.apple.com/library/archive/qa/qa1480/_index.html
My fix: (I'm UK based & parsing Barclays Bank ofx files which use the date format 20191217000000[-5:EST]

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.timeZone = TimeZone(secondsFromGMT: 0) // not sure if this is required - need to test

let maybeDate = formats.reduce(nil as Date?) { result, format in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant