A reliable way to format dates with elm.
elm package install ryannhg/elm-moment
MomentJS is a great library for formatting dates!
elm-moment has the same formatting options as Moment, but uses Elm's awesome type system to provide human readable names, and catch typos for you at compile time!
No need to remember the difference between
import Date import Moment -- Create a custom formatter yourFormatter : Date -> String yourFormatter = Moment.format [ Moment.MonthNameFull , Moment.Text " " , Moment.DayOfMonthSuffix , Moment.Text ", " , Moment.YearNumber ] -- Using your formatter, format your date as a string! yourPrettyDate : String yourPrettyDate = case Date.fromString "2018-02-05T00:00:00.000Z" of Ok date -> yourFormatter date Err -> "This shouldn't happen..."
"February 5th, 2018" : String