(self: DateTime): booleanChecks synchronously if a DateTime is in the past compared to the current time.
When to use
Use when checking whether a DateTime is in the past with a synchronous
live-clock read and Clock-based testability is not needed.
Details
This is a synchronous version that uses Date.now() directly.
Example (Checking past DateTime values unsafely)
import { DateTime } from "effect"
const now = DateTime.nowUnsafe()
const pastDate = DateTime.subtract(now, { hours: 1 })
console.log(DateTime.isPastUnsafe(pastDate)) // true
console.log(DateTime.isPastUnsafe(now)) // falseexport const const isPastUnsafe: (
self: DateTime
) => boolean
Checks synchronously if a DateTime is in the past compared to the current time.
When to use
Use when checking whether a DateTime is in the past with a synchronous
live-clock read and Clock-based testability is not needed.
Details
This is a synchronous version that uses Date.now() directly.
Example (Checking past DateTime values unsafely)
import { DateTime } from "effect"
const now = DateTime.nowUnsafe()
const pastDate = DateTime.subtract(now, { hours: 1 })
console.log(DateTime.isPastUnsafe(pastDate)) // true
console.log(DateTime.isPastUnsafe(now)) // false
isPastUnsafe: (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) => boolean = import InternalInternal.const isPastUnsafe: (
self: DateTime.DateTime
) => boolean
isPastUnsafe