effect-io-ai

Package: effect
Module: DateTime

DateTime.layerCurrentZoneNamed

Create a Layer from the given IANA time zone identifier.

Details

This layer provides the CurrentTimeZone service with a named time zone. If the time zone identifier is invalid, the layer will fail.

Example (Providing named time zone layers)

import { DateTime, Effect } from "effect"

const layer = DateTime.layerCurrentZoneNamed("Europe/London")

const program = Effect.gen(function*() {
  const now = yield* DateTime.nowInCurrentZone
  return DateTime.formatIsoZoned(now)
})

Effect.provide(program, layer)

Signature

declare const layerCurrentZoneNamed: (zoneId: string) => Layer.Layer<CurrentTimeZone, IllegalArgumentError>

Source

Since v3.6.0