effect-io-ai

Package: effect
Module: DateTime

DateTime.withDateUtc

Applies a function to a JavaScript Date representing the DateTime’s UTC instant and returns the function’s result.

Details

This ignores any associated time zone. Use DateTime.withDate when the callback should receive the time-zone-adjusted wall-clock date.

Example (Applying UTC Dates)

import { DateTime } from "effect"

// get the date in milliseconds
DateTime.makeUnsafe(0).pipe(
  DateTime.withDateUtc((date) => date.getTime())
)

Signature

declare const withDateUtc: { <A>(f: (date: Date) => A): (self: DateTime) => A; <A>(self: DateTime, f: (date: Date) => A): A; }

Source

Since v3.6.0