Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upDocu improvement: Time unit relevance in Date module #538
Conversation
jvoigtlaender
referenced this pull request
Mar 25, 2016
Closed
Document requirement for UNIX timestamps to be correctly converted #536
pushed a commit
that referenced
this pull request
Apr 28, 2016
evancz
closed this
Apr 28, 2016
evancz
deleted the
jvoigtlaender-patch-7
branch
Apr 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jvoigtlaender commentedMar 25, 2016
The current problem is that the link http://en.wikipedia.org/wiki/Unix_time is explicitly saying that Unix time is in seconds. So users of
Date.toTimeare currently tempted to read the resulting value as "time in seconds since epoch". But actually due to the way Elm deals with time, this is wrong. Instead ofDate.toTime someDate, they would have to doTime.inSeconds (Date.toTime someDate)to interpret stuff correctly. Conversely, the documentation ofDate.fromTimecurrently suggests that one can pass a "seconds since epoch" (aka "UNIX time") value and get a meaningful result. But that's not the case,Date.fromTime 646137900will not do what's expected.The documentation additions here aim to prevent those confusions.