oaalto/time-values/2.0.0

Time.Values

Extract time values from numbers.

type alias TimeValues =
{ milliseconds : Int
, seconds : Int
, minutes : Int
, hours : Int
, days : Int
, weeks : Int
}

Container for the compound elements.

fromMilliseconds : Int -> TimeValues

Extracts the compound elements from the given milliseconds.

fromSeconds : Int -> TimeValues

Extracts the compound elements from the given seconds.

fromMinutes : Int -> TimeValues

Extracts the compound elements from the given minutes.

import Time.Values as TimeValues exposing (TimeValues)

values = TimeValues.fromSeconds 60

minutes = values.minutes

The functions fromMilliseconds, fromSeconds and fromMinutes split the given value into its compound elements, namely: ms, secs, mins, hours, days, weeks.