Hyperlinkv0.8.0-beta.28

DateTime

DateTime.withDateUtcconsteffect/DateTime.ts:2208
<A>(f: (date: Date) => A): (self: DateTime) => A
<A>(self: DateTime, f: (date: Date) => A): A

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())
)
mapping
export const withDateUtc: {
  <A>(f: (date: Date) => A): (self: DateTime) => A
  <A>(self: DateTime, f: (date: Date) => A): A
} = Internal.withDateUtc