<A>(f: (date: Date) => A): (self: DateTime) => A
<A>(self: DateTime, f: (date: Date) => A): AApplies a function to a JavaScript Date representing the DateTime and
returns the function's result.
Details
The callback receives the time-zone-adjusted wall-clock date for
DateTime.Zoned values. Use DateTime.withDateUtc when the callback should
receive the UTC instant.
Example (Applying time zone adjusted Dates)
import { DateTime } from "effect"
// get the time zone adjusted date in milliseconds
DateTime.makeZonedUnsafe(0, { timeZone: "Europe/London" }).pipe(
DateTime.withDate((date) => date.getTime())
)export const const withDate: {
<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 and
returns the function's result.
Details
The callback receives the time-zone-adjusted wall-clock date for
DateTime.Zoned values. Use DateTime.withDateUtc when the callback should
receive the UTC instant.
Example (Applying time zone adjusted Dates)
import { DateTime } from "effect"
// get the time zone adjusted date in milliseconds
DateTime.makeZonedUnsafe(0, { timeZone: "Europe/London" }).pipe(
DateTime.withDate((date) => date.getTime())
)
withDate: {
<function (type parameter) A in <A>(f: (date: Date) => A): (self: DateTime) => AA>(f: (date: Date) => Af: (date: Datedate: Date) => function (type parameter) A in <A>(f: (date: Date) => A): (self: DateTime) => AA): (self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime) => function (type parameter) A in <A>(f: (date: Date) => A): (self: DateTime) => AA
<function (type parameter) A in <A>(self: DateTime, f: (date: Date) => A): AA>(self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime, f: (date: Date) => Af: (date: Datedate: Date) => function (type parameter) A in <A>(self: DateTime, f: (date: Date) => A): AA): function (type parameter) A in <A>(self: DateTime, f: (date: Date) => A): AA
} = import InternalInternal.const withDate: {
<A>(f: (date: Date) => A): (
self: DateTime.DateTime
) => A
<A>(
self: DateTime.DateTime,
f: (date: Date) => A
): A
}
withDate