(other: DateTime): (self: DateTime) => Duration.Duration
(self: DateTime, other: DateTime): Duration.DurationComputes the difference between two DateTime values, returning a
Duration representing the amount of time between them.
Details
If other is after self, the result will be a positive Duration. If
other is before self, the result will be a negative Duration. If they
are equal, the result will be a Duration of zero.
Example (Measuring distance between DateTime values)
import { DateTime, Effect } from "effect"
Effect.gen(function*() {
const now = yield* DateTime.now
const other = DateTime.add(now, { minutes: 1 })
// returns Duration.minutes(1)
DateTime.distance(now, other)
})export const const distance: {
(other: DateTime): (
self: DateTime
) => Duration.Duration
(
self: DateTime,
other: DateTime
): Duration.Duration
}
Computes the difference between two DateTime values, returning a
Duration representing the amount of time between them.
Details
If other is after self, the result will be a positive Duration. If
other is before self, the result will be a negative Duration. If they
are equal, the result will be a Duration of zero.
Example (Measuring distance between DateTime values)
import { DateTime, Effect } from "effect"
Effect.gen(function*() {
const now = yield* DateTime.now
const other = DateTime.add(now, { minutes: 1 })
// returns Duration.minutes(1)
DateTime.distance(now, other)
})
distance: {
(other: DateTimeother: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime): (self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime) => import DurationDuration.Duration
(self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime, other: DateTimeother: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime): import DurationDuration.Duration
} = import InternalInternal.const distance: {
(other: DateTime.DateTime): (
self: DateTime.DateTime
) => Duration.Duration
(
self: DateTime.DateTime,
other: DateTime.DateTime
): Duration.Duration
}
distance