Hyperlinkv0.8.0-beta.28

DateTime

DateTime.withCurrentZoneLocalconsteffect/DateTime.ts:1957
<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<
  A,
  E,
  Exclude<R, CurrentTimeZone>
>

Provides the CurrentTimeZone to an effect, using the system's local time zone.

Example (Providing the local time zone)

import { DateTime, Effect } from "effect"

Effect.gen(function*() {
  // will use the system's local time zone
  const now = yield* DateTime.nowInCurrentZone
}).pipe(DateTime.withCurrentZoneLocal)
current time zone
export const withCurrentZoneLocal = <A, E, R>(
  effect: Effect.Effect<A, E, R>
): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>> =>
  Effect.provideServiceEffect(effect, CurrentTimeZone, Effect.sync(zoneMakeLocal))