Hi all,

I'm parsing dates with date 
<http://package.elm-lang.org/packages/elm-community/json-extra/2.1.0/Json-Decode-Extra#date>
 
from the json-extra 
<http://package.elm-lang.org/packages/elm-community/json-extra/2.1.0> 
package. It actually uses the Date.fromString 
<http://package.elm-lang.org/packages/elm-lang/core/5.0.0/Date#fromString> 
from the core. And it is not working properly…

This is what happens in the REPL (within NodeJS I'd say), "2015-10-05" becomes 
Oct. 4, 2015 (not Oct. 5):

> import Date
> Date.fromString "2015-10-05"
Ok <Sun Oct 04 2015 21:00:00 GMT-0300 (BRT)> : Result.Result String 
Date.Date

Probably this has to do with my locale (GMT -3h). One can also check that 
in this issue <https://github.com/datasciencebr/jarbas/issues/93> or 
trusting my browser console output (it's what the compiler does for 
Date.fromString 
<https://github.com/elm-lang/core/blob/5.0.0/src/Native/Date.js#L7>):

> new Date('2015-10-05');
< Sun Oct 04 2015 21:00:00 GMT-0300 (BRT)

It looks like the bug is in the JavaScript part, not in Elm itself. So… any 
ideas on how to code a decent alternative to that?

A hot fix would be to parte year, month and day as `Int` and create a 
record for that. But this would be ugly, dirty and nasty ; )

Many thanks,

Cuducos
http://cuducos.me/


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to