-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
PM/AM Formatting not working correctly #349
Comments
Hi, Below an example: let str = "30.11.2016, 10:00:00 PM GMT"
let date = try! str.date(format: .custom("dd.MM.yyyy',' hh:mm:ss a ZZZZ")) // 30 nov 2016, 23:00:00 CET It will return |
Unfortunately this won't solve my problem. I need to parse a given date to the right ISO8601 String which won't happen if your device is on 12 hour mode. If I create a Date with Using following code will give me the right ISO8601 String for my date:
So prints out But trying to parse this string back to a As ISO8601 is strictly defined I think this is very unexpected behaviour and should be fixed. Edit:
will work and result in the right Date. |
I think you are right, we should set en_US_POSIX manually. Thank you 👍 |
Just for reference, this is the official statement from Apple regarding NSDateFormatter and Internet Date&Time |
When changing your iPhone settings to 12 hour format and trying to get an iso date string, the string is not right.
Trying to parse an PM date the resulting output is an AM date
Is there anything I do wrong or is this a bug in SwiftDate.
My recent Settings of Date&Time are:
24-hours: off
automatic timezone: on
Timezone: Berlin
Edit:
Probably this is unexpected behaviour of NSDateFormater as you can see here
The text was updated successfully, but these errors were encountered: