bluedogtraining/bdt-elm/10.0.0

NOTE: this package is not compatible with Elm 0.19.1

Date.Bdt

Date Helpers

Print Dates

toString : Date -> String

Returns a string as dd/mm/yyyy

maybeDateToString : Maybe Date -> String

Returns a string as dd/mm/yyyy, defaulted to ––/––/––––

maybeDateToTimeString : Maybe Date -> String

Returns a string as ss:mm:hh, defaulted to 00:00:00

maybeDateToDateTimeString : Maybe Date -> String

Returns a string as ss:mm:hh dd/mm/yyyy, defaulted to 00:00:00 ––/––/––––

monthToString : Month -> String

Returns a padded Int representation of the month

Jan -> "01"
Feb -> "02"
Mar -> "03"
Apr -> "04"
May -> "05"
Jun -> "06"
Jul -> "07"
Aug -> "08"
Sep -> "09"
Oct -> "10"
Nov -> "11"
Dec -> "12"

Sort Dates

order : Date -> Date -> Order

Orders 2 dates. This comes in handy with List.sortWith:

List.sortWith Date.order [date1, date2, date3]

Encode Dates

encode : Date -> Value

Encode a Date

encodeMaybe : Maybe Date -> Value

Encode a Maybe Date