effect-io-ai

Package: effect
Module: DateTime

DateTime.withCurrentZoneNamed

Provides the CurrentTimeZone to an effect using an IANA time zone identifier.

Details

If the time zone is invalid, it will fail with an IllegalArgumentError.

Example (Providing a named time zone)

import { DateTime, Effect } from "effect"

Effect.gen(function*() {
  // will use the "Europe/London" time zone
  const now = yield* DateTime.nowInCurrentZone
}).pipe(DateTime.withCurrentZoneNamed("Europe/London"))

Signature

declare const withCurrentZoneNamed: { (zone: string): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | IllegalArgumentError, Exclude<R, CurrentTimeZone>>; <A, E, R>(effect: Effect.Effect<A, E, R>, zone: string): Effect.Effect<A, E | IllegalArgumentError, Exclude<R, CurrentTimeZone>>; }

Source

Since v3.6.0