(parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(
self: A
) => A
<A extends DateTime>(
self: A,
parts: Partial<DateTime.PartsWithWeekday>
): ASets time-zone-adjusted parts on a DateTime.
Details
The date will be time zone adjusted for DateTime.Zoned.
Example (Updating DateTime parts)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
const updated = DateTime.setParts(dt, {
year: 2025,
month: 6,
day: 15
})
console.log(DateTime.formatIso(updated)) // "2025-06-15T12:00:00.000Z"export const const setParts: {
(parts: Partial<DateTime.PartsWithWeekday>): <
A extends DateTime
>(
self: A
) => A
<A extends DateTime>(
self: A,
parts: Partial<DateTime.PartsWithWeekday>
): A
}
Sets time-zone-adjusted parts on a DateTime.
Details
The date will be time zone adjusted for DateTime.Zoned.
Example (Updating DateTime parts)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
const updated = DateTime.setParts(dt, {
year: 2025,
month: 6,
day: 15
})
console.log(DateTime.formatIso(updated)) // "2025-06-15T12:00:00.000Z"
setParts: {
(parts: Partial<DateTime.PartsWithWeekday>parts: type Partial<T> = {
[P in keyof T]?: T[P] | undefined
}
Make all properties in T optional
Partial<DateTime.interface DateTime.PartsWithWeekdayCalendar and time components of a DateTime, including the weekday.
Details
month is one-based (1 for January through 12 for December), and
weekDay follows JavaScript Date#getUTCDay numbering (0 for Sunday
through 6 for Saturday).
PartsWithWeekday>): <function (type parameter) A in <A extends DateTime>(self: A): AA extends 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>(self: A extends DateTimeself: function (type parameter) A in <A extends DateTime>(self: A): AA) => function (type parameter) A in <A extends DateTime>(self: A): AA
<function (type parameter) A in <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): AA extends 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>(self: A extends DateTimeself: function (type parameter) A in <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): AA, parts: Partial<DateTime.PartsWithWeekday>parts: type Partial<T> = {
[P in keyof T]?: T[P] | undefined
}
Make all properties in T optional
Partial<DateTime.interface DateTime.PartsWithWeekdayCalendar and time components of a DateTime, including the weekday.
Details
month is one-based (1 for January through 12 for December), and
weekDay follows JavaScript Date#getUTCDay numbering (0 for Sunday
through 6 for Saturday).
PartsWithWeekday>): function (type parameter) A in <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): AA
} = import InternalInternal.const setParts: {
(
parts: Partial<DateTime.DateTime.PartsWithWeekday>
): <A extends DateTime.DateTime>(self: A) => A
<A extends DateTime.DateTime>(
self: A,
parts: Partial<DateTime.DateTime.PartsWithWeekday>
): A
}
setParts