Convert between ISO-8601 durations strings and Duration
values.
{ years : Basics.Float
, months : Basics.Float
, days : Basics.Float
, hours : Basics.Float
, minutes : Basics.Float
, seconds : Basics.Float
}
fromString : String -> Maybe Duration
Convert from an ISO-8601 duration string to a Duration
value.
In case a week duration is given only the days
property will be populated with the number of weeks * 7.
toString : Duration -> String
Convert a Duration
value to an ISO-8601 duration string.
Week durations are not supported, even values with days
only will still be serialized as PnD
.
decoder : Json.Decode.Decoder Duration
Decode an ISO-8601 duration string to a Duration
value using fromString
.
encode : Duration -> Json.Encode.Value
Encode a Duration
value as an ISO-8601 duration string using toString
.