Gizra / elm-compat-019 / Date018

In Elm 0.19, the Date module was moved to a separate package elm-time, with a significantly modified API. This implements parts of the old API.

It is not practical to re-implement Elm 0.18's fromString. Elm 0.18 simply supplied the input to the Javascript runtime to perform the conversion. To implement that reliably in Elm 0.19, we would need a pure Elm function that mimicked the behaviour of the Javascript runtime. This would be possible, but does not seem practical.

It does not seem possible to re-implement the Elm 0.18 signatures for year, month, day, dayOfWeek, hour, minute, second, or millisecond. The difficulty is that they all have an implicit dependency on some time zone.

Thus, for these functions, there is no real substitute for re-writing your code. `


type alias Date =
Time.Posix

Representation of a date.

now : Task x Date

Get the Date at the moment when this task is run.

toTime : Date -> Time018.Time

Convert a Date to a time in milliseconds.

A time is the number of milliseconds since the Unix epoch.

fromTime : Time018.Time -> Date

Convert a time in milliseconds into a Date.

A time is the number of milliseconds since the Unix epoch.


type alias Month =
Time.Month

Represents the month of the year.


type alias Day =
Time.Weekday

Represents the days of the week.