Hyperlinkv0.8.0-beta.28

DateTime

DateTime.isPastconsteffect/DateTime.ts:1497
(self: DateTime): Effect.Effect<boolean>

Checks effectfully if a DateTime is in the past compared to the current time.

Details

This is an effectful operation that uses the current time from the Clock service.

Example (Checking past DateTime values effectfully)

import { DateTime, Effect } from "effect"

const program = Effect.gen(function*() {
  const pastDate = DateTime.subtract(yield* DateTime.now, { hours: 1 })
  const isPast = yield* DateTime.isPast(pastDate)
  console.log(isPast) // true
})
comparisons
export const isPast: (self: DateTime) => Effect.Effect<boolean> = Internal.isPast