Package: effect
Module: DateTime
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"
Signature
declare const setParts: { (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A; <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A; }
Since v3.6.0