Durations

Durations

Duration type class

Data.Time.Duration exports many duration data types, and they all implement the Duration type class.

This allows us to easily convert between duration types and calculate differences between dates.

class Duration a where
  fromDuration :: a -> Milliseconds
  toDuration :: Milliseconds -> a

Days

Days is exported from purescript-datetime, and represents a duration measured in days, where a day is assumed to be exactly 24 hours.

newtype Days = Days Number

Hours

Hours is exported from purescript-datetime, and represents a duration measured in hours.

newtype Hours = Hours Number

Minutes

Minutes is exported from purescript-datetime, and represents a duration measured in minutes.

newtype Minutes = Minutes Number

Seconds

Seconds is exported from purescript-datetime, and represents a duration measured in seconds.

newtype Seconds = Seconds Number

Milliseconds

Milliseconds is exported from purescript-datetime, and represents a duration measured in milliseconds.

newtype Milliseconds = Milliseconds Number