Skip to content
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

Date support #5

Open
icanzilb opened this issue Sep 1, 2022 · 2 comments
Open

Date support #5

icanzilb opened this issue Sep 1, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@icanzilb
Copy link
Collaborator

icanzilb commented Sep 1, 2022

Ideally the encoder/decoder should be able to write/read dates. The question is how to make those human friendly for editing? Obviously a fully-qualified date contains a lot of information which isn't quite "friendly" to edit by hand.

This seems like a good opportunity for adding a date strategy like for JSONEncoder and maybe add some predefined "human friendly" formats.

@icanzilb icanzilb added enhancement New feature or request help wanted Extra attention is needed labels Sep 1, 2022
@DivineDominion
Copy link
Contributor

Would suggest to start with ISO date formatter to at least get dates like 2022-09-07 (not Dates) right.
https://sarunw.com/posts/how-to-parse-iso8601-date-in-swift/

Date and time becomes tricky, though, because ISO timestamps are 🤮

So if users enter 2022-09-07 15:45, the parser should maybe produce a String instead of extracting a Date from 2022-09-07 ignoring the time, because that'd be pretty confusing.

@icanzilb
Copy link
Collaborator Author

icanzilb commented Sep 7, 2022

Yeah, I have similar feelings about parsing dates ... not to mention that without a timezone a string date means nothing so I'm very cautious just adding this willie-nilly. I'm so burned by parsing dates that I ponder with the idea of just not having this feature at all but I can see how this might be something useful to have ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants