Module

Temporal.Diff

Package
purescript-temporal
Repository
philippedev101/purescript-temporal

Convenience diff functions that return a single number.

These are thin wrappers over the until functions, configured to return a single-unit duration in the requested unit. The sign of the result indicates direction (negative if the first argument is after the second).

#diffDays Source

diffDays :: PlainDate -> PlainDate -> Int

Days between two dates. Positive when b is after a.

diffDays (plainDate 2024 1 1) (plainDate 2024 1 15)  -- 14

#diffWeeks Source

diffWeeks :: PlainDate -> PlainDate -> Int

ISO weeks between two dates. Positive when b is after a.

#diffMonths Source

diffMonths :: PlainDate -> PlainDate -> Int

Months between two dates. Positive when b is after a.

#diffYears Source

diffYears :: PlainDate -> PlainDate -> Int

Years between two dates. Positive when b is after a.

#diffHours Source

diffHours :: PlainDateTime -> PlainDateTime -> Number

Hours between two datetimes. Positive when b is after a.

#diffMinutes Source

diffMinutes :: PlainDateTime -> PlainDateTime -> Number

Minutes between two datetimes. Positive when b is after a.

#diffSeconds Source

diffSeconds :: PlainDateTime -> PlainDateTime -> Number

Seconds between two datetimes. Positive when b is after a.

#diffMilliseconds Source

diffMilliseconds :: Instant -> Instant -> Number

Milliseconds between two instants. Positive when b is after a.