adius / vectual / TimeUtils.Period

Period is a fixed length of time. It is an elapsed time concept, which does not include the concept of Years Months or Daylight saving variations.

Name of type concept copied from NodaTime.

add : Period -> Basics.Int -> Time.Posix -> Time.Posix

Add Period count to date.

diff : Time.Posix -> Time.Posix -> PeriodDeltaRecord

Return a Period representing date difference. date1 - date2. If you add the result of this function to date2 with addend of 1 will return date1.


type Period
    = Millisecond
    | Second
    | Minute
    | Hour
    | Day
    | Week
    | Delta PeriodDeltaRecord

A Period.

Week is a convenience for users if they want to use it, it does just scale Day in functionality so is not strictly required.

PeriodDeltaRecord values are multiplied addend on application.


type alias PeriodDeltaRecord =
{ week : Basics.Int
, day : Basics.Int
, hour : Basics.Int
, minute : Basics.Int
, second : Basics.Int
, millisecond : Basics.Int 
}

A multi granularity period delta.

periodToString : Period -> String

zeroDelta : PeriodDeltaRecord

All zero delta. Useful as a starting point if you want to set a few fields only.

toTicks : Period -> Basics.Int

Return tick counts for periods. Useful to get total ticks in a Delta.

addTimeUnit : Basics.Int -> Basics.Int -> Time.Posix -> Time.Posix

Add time units.