-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Swift4] ParseError, "Date string does not match format expected by formatter." when date string has not miliseconds #9178
Comments
tholostaran
changed the title
[Swift4] ParseError, "could not decode date" when date string has not miliseconds
[Swift4] ParseError, "Date string does not match format expected by formatter." when date string has not miliseconds
Feb 15, 2019
This error is also returned for a date string that is set to null. Whilst this is a different issue, it is worth noting for anyone coming here having searched for the error message. |
Hi, I suggest this code to be compliant with most date formats AND allow multiple date formats in the same class :
Note : you have to create the DateError.invalidDate. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When CodableHelper decode a model with date, if that Date String hasn't milisecond (ex. "2019-02-14T00:00:00") the decoder throws a decode error.
Swagger-codegen version
tag -> 2.4.1 and later
Swagger declaration file content or url
Steps to reproduce
Parse this model throws decode error:
Suggest a fix/enhancement
I propouse this fix on CodableHelper.swift
Actual Code
New fix Code
The text was updated successfully, but these errors were encountered: