Temporal.TimeDuration
- Package
- purescript-temporal
- Repository
- philippedev101/purescript-temporal
A time-only duration (hours through nanoseconds) with total Semigroup
and Monoid instances.
Unlike Duration, TimeDuration has no calendar components (years,
months, weeks, days), so addition is always total — it never fails.
This makes it suitable for use with fold, foldMap, and other
PureScript combinators.
Use TimeDuration for elapsed time, timers, time tracking, and
aggregation.
#TimeDuration Source
newtype TimeDurationA duration restricted to time components only (hours, minutes, seconds, milliseconds, microseconds, nanoseconds). No calendar components.
Addition is total: TimeDuration values can always be added without
requiring a relativeTo reference point.
Constructors
Instances
#fromDuration Source
fromDuration :: Duration -> Maybe TimeDurationTry to convert a Duration to a TimeDuration. Returns Nothing if
the duration has non-zero calendar components (years, months, weeks, days).
#toDuration Source
toDuration :: TimeDuration -> DurationConvert back to a Duration. Always succeeds.
#timeDuration Source
timeDuration :: { hours :: Number, microseconds :: Number, milliseconds :: Number, minutes :: Number, nanoseconds :: Number, seconds :: Number } -> Maybe TimeDurationConstruct from individual time fields. Returns Nothing if signs are
mixed.
#fromHours Source
fromHours :: Number -> TimeDurationCreate from hours.
#fromMinutes Source
fromMinutes :: Number -> TimeDurationCreate from minutes.
#fromSeconds Source
fromSeconds :: Number -> TimeDurationCreate from seconds.
#fromMilliseconds Source
fromMilliseconds :: Number -> TimeDurationCreate from milliseconds.
#fromMicroseconds Source
fromMicroseconds :: Number -> TimeDurationCreate from microseconds.
#fromNanoseconds Source
fromNanoseconds :: Number -> TimeDurationCreate from nanoseconds.
#getHours Source
getHours :: TimeDuration -> Number#getMinutes Source
getMinutes :: TimeDuration -> Number#getSeconds Source
getSeconds :: TimeDuration -> Number#getNanoseconds Source
getNanoseconds :: TimeDuration -> Number#negate Source
negate :: TimeDuration -> TimeDurationNegate the duration.
#abs Source
abs :: TimeDuration -> TimeDurationAbsolute value.
#zero Source
zero :: TimeDurationThe zero time duration. mempty alias.
- Modules
- Temporal.
Diff - Temporal.
Display - Temporal.
Duration - Temporal.
Duration. Extra - Temporal.
Format. Html - Temporal.
Instant - Temporal.
Instant. Extra - Temporal.
Internal. Options - Temporal.
Internal. Types - Temporal.
Internal. Unsafe - Temporal.
Interval - Temporal.
Interval. Duration - Temporal.
Interval. Set - Temporal.
Now - Temporal.
PlainDate - Temporal.
PlainDate. Boundary - Temporal.
PlainDate. Extra - Temporal.
PlainDate. Weekday - Temporal.
PlainDateTime - Temporal.
PlainDateTime. Extra - Temporal.
PlainMonthDay - Temporal.
PlainTime - Temporal.
PlainTime. Extra - Temporal.
PlainYearMonth - Temporal.
PlainYearMonth. Extra - Temporal.
Predicate - Temporal.
TimeDuration - Temporal.
ZonedDateTime - Temporal.
ZonedDateTime. Boundary - Temporal.
ZonedDateTime. Extra