Hyperlinkv0.8.0-beta.28

DateTime

DateTime.setZoneCurrentconsteffect/DateTime.ts:1913
(self: DateTime): Effect.Effect<Zoned, never, CurrentTimeZone>

Sets the time zone of a DateTime to the current time zone, which is determined by the CurrentTimeZone service.

Example (Setting the current time zone)

import { DateTime, Effect } from "effect"

Effect.gen(function*() {
  const now = yield* DateTime.now

  // set the time zone to "Europe/London"
  const zoned = yield* DateTime.setZoneCurrent(now)
}).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
current time zone
export const setZoneCurrent = (self: DateTime): Effect.Effect<Zoned, never, CurrentTimeZone> =>
  Effect.map(CurrentTimeZone, (zone) => setZone(self, zone))
Referenced by 1 symbols