rluiten/elm-date-extra/9.2.1

NOTE: this package is not compatible with Elm 0.19.1

Date.Extra.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.

  • Represents a fixed (and calendar-independent) length of time.

Name of type concept copied from NodaTime.

add : Period -> Int -> Date -> Date

Add Period count to date.

diff : Date -> Date -> DeltaRecord

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 DeltaRecord

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.

DELTARECORD values are multiplied addend on application.

type alias DeltaRecord =
{ week : Int
, day : Int
, hour : Int
, minute : Int
, second : Int
, millisecond : Int
}

A multi granularity period delta.

zeroDelta : DeltaRecord

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

toTicks : Period -> Int

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

Copyright (c) 2016-2017 Robin Luiten