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

Encodes elm dates as UtcIso strings. #4

Merged
merged 2 commits into from
Mar 26, 2018
Merged

Encodes elm dates as UtcIso strings. #4

merged 2 commits into from
Mar 26, 2018

Conversation

alex-wellbelove
Copy link
Contributor

This is parseable in Haskell with aeson, for instance. https://github.com/TriviumRealEstate/excelsior/pull/480.

@ChickenProp
Copy link

ChickenProp commented Mar 22, 2018

Note that this will make it impossible to send a full datetime without another PR to this repo. We also won't be able to send this upstream. And I'm not sure, but it looks like sending a date to Elm would still require it to be a datetime.

These may well be good tradeoffs to make right now, but they're worth noting.

(The solution I'm thinking of is having two separate ElmPrimitive cases, one for datetimes and one for date-onlys. Both would serialize to Date, but the encoding and decoding functions for them would be different. But that would take considerably longer than this.)


http://package.elm-lang.org/packages/justinmimbs/elm-date-extra/latest/Date-Extra#toUtcIsoString says the function you're using formats dates with a timestamp? Currently we're using Exts.Date.toRFC3339 for this.

@alex-wellbelove
Copy link
Contributor Author

What do you mean by

Note that this will make it impossible to send a full datetime without another PR to this repo.
?

Agree re the separate serializations, but for now it's enough to do utctDay on the haskell side etc.

@ChickenProp
Copy link

I misunderstood the point of this PR - I thought it was making it so that an Elm Date could be serialized to a haskell Day, but in fact it's just turning an Elm Date into a Haskell UTCTime, which the library really ought to provide out of the box. All of my concerns were misplaced.

@alex-wellbelove
Copy link
Contributor Author

@mebassett mebassett merged commit 1f2fc29 into master Mar 26, 2018
@trippingtarballs trippingtarballs deleted the date-support branch March 26, 2018 14:14
@trippingtarballs
Copy link

martinmullins pushed a commit that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants