You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am parsing dates in my app using this library and I've just noticed an issue when my device is in 12-Hour Time mode.
The API I am working with can return dates in two different formats:
Format A: 2021-12-06T00:00:00 Format B: 2020-06-10T06:00:00.785+02:00
Parsing Format B always works whether device is in 12-Hour or 24-Hour mode.
Parsing Format A however, will fail if the device is in 12-Hour mode. It does work in 24-Hour mode.
I am currently using a temporary workaround, by providing my own formatter and Region when using the toDate() extension. Like this:
"2020-06-10T06:00:00".toDate() // Fails in 12-Hour Time mode "2020-06-10T06:00:00".toDate("yyyy-MM-dd'T'hh:mm:ss", region: Region.UTC) // Works both in 12-Hour and 24-Hour mode
The text was updated successfully, but these errors were encountered:
Hello, I am parsing dates in my app using this library and I've just noticed an issue when my device is in 12-Hour Time mode.
The API I am working with can return dates in two different formats:
Format A: 2021-12-06T00:00:00
Format B: 2020-06-10T06:00:00.785+02:00
Parsing
Format B
always works whether device is in 12-Hour or 24-Hour mode.Parsing
Format A
however, will fail if the device is in 12-Hour mode. It does work in 24-Hour mode.I am currently using a temporary workaround, by providing my own formatter and Region when using the
toDate()
extension. Like this:"2020-06-10T06:00:00".toDate() // Fails in 12-Hour Time mode
"2020-06-10T06:00:00".toDate("yyyy-MM-dd'T'hh:mm:ss", region: Region.UTC) // Works both in 12-Hour and 24-Hour mode
The text was updated successfully, but these errors were encountered: