bluedogtraining / bdt-elm / Time.Bdt

Time Helpers

Print Posix

toDateString : Time.Zone -> Time.Posix -> String

Returns a string as dd/mm/yyyy

toTimeString : Time.Zone -> Time.Posix -> String

Returns a string as hh:mm:ss

toDateTimeString : Time.Zone -> Time.Posix -> String

Returns a string as dd/mm/yyyy hh:mm:ss

maybeToDateString : Time.Zone -> Maybe Time.Posix -> String

Returns a string as dd/mm/yyyy. Defaults to --/--/----

maybeToTimeString : Time.Zone -> Maybe Time.Posix -> String

Returns a string as hh:mm:ss. Defaults to 00:00:00

maybeToDateTimeString : Time.Zone -> Maybe Time.Posix -> String

Returns a string as hh:mm:ss dd/mm/yyyy. Defaults to --/--/---- 00:00:00

Helpers

monthNumber : Time.Month -> Basics.Int

Returns the Int representation of a month

monthString : Time.Month -> String

Returns the String representation of a month

monthFromNumber : Basics.Int -> Time.Month

Returns the Month based on it's number

addMonths : Time.Zone -> Basics.Int -> Time.Posix -> Time.Posix

Add months to a posix

clamp : Time.Posix -> Time.Posix -> Time.Posix -> Time.Posix

Clamp a posix

maybeClamp : Maybe Time.Posix -> Maybe Time.Posix -> Time.Posix -> Time.Posix

Clamp between maybe posix

Setters

setDay : Time.Zone -> Basics.Int -> Time.Posix -> Time.Posix

Set the day of the month for posix

Sort Times

order : Time.Posix -> Time.Posix -> Basics.Order

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

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

Encode/Decode Times

encode : Time.Posix -> Json.Encode.Value

Encode a Posix

encodeMaybe : Maybe Time.Posix -> Json.Encode.Value

Encode a Maybe Posix

decoder : Json.Decode.Decoder Time.Posix

Decode a Posix