-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Improved Date Decoding #9
Conversation
|
let iso8601 = { () -> ISO8601DateFormatter in | ||
let fmt = ISO8601DateFormatter() | ||
fmt.formatOptions = [.withInternetDateTime] | ||
return fmt | ||
}() | ||
|
||
let iso8601WithFractionalSeconds = { () -> ISO8601DateFormatter in | ||
let fmt = ISO8601DateFormatter() | ||
fmt.formatOptions = [.withInternetDateTime, .withFractionalSeconds] | ||
return fmt | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annoyingly if you specify with fractional seconds, you must use fractional seconds, and the discord api is inconsistent with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah thats the annoying part. Another problematic thing is the nonce value in Message
. It can either be an int or a string according to the dev docs, so I have no idea how to add that property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this PR seems quite well done, would be great if you could resolve the issues with #6
I see that you're using a custom decoding strategy to decode the Dates. Could you also see if you can set the |
It might be better to do the snake case to camel case conversion in a separate PR? That's going to be a lot of churn. |
Good point. I'll wait for this PR to be merged, then work on that. I don't want to deal with tons of merge conflicts xD |
decode timestamps as Date objects