buguibu / ios-notes-issues-lessons

Notes, issues and lessons about my iOS development experience
2 stars 0 forks source link

Time parsing fails on 12hours format device when using current locale and 24 hours content #10

Open buguibu opened 5 years ago

buguibu commented 5 years ago

Given a 24 hours server response string if I try to parse it using the device locale I should check that use a proper hour formatter as

'H' format is for 24 format 'h' format is for 12 format

But I can use a single 'H' format for parse the server reponse but I should set a common locale for the formatter and not use the device locale that will expect a 12hours string.

Links: https://nsdateformatter.com/ https://stackoverflow.com/a/11062308/2199030 https://stackoverflow.com/a/39824563/2199030