Package: effect
Module: DateTime
Create a Layer from the given time zone.
Details
This layer provides the CurrentTimeZone service with the specified time zone.
Example (Providing current time zone layers)
import { DateTime, Effect } from "effect"
const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
const layer = DateTime.layerCurrentZone(zone)
const program = Effect.gen(function*() {
const now = yield* DateTime.nowInCurrentZone
return DateTime.formatIsoZoned(now)
})
// Use the layer to provide the time zone
Effect.provide(program, layer)
Signature
declare const layerCurrentZone: (resource: NoInfer<TimeZone>) => Layer.Layer<CurrentTimeZone>
Since v3.6.0