Package: effect
Module: DateTime
Sets UTC parts on a DateTime.
Details
The parts are always interpreted as UTC, ignoring any time zone information.
Example (Updating UTC DateTime parts)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
const updated = DateTime.setPartsUtc(dt, {
year: 2025,
hour: 18
})
console.log(DateTime.formatIso(updated)) // "2025-01-01T18:00:00.000Z"
Signature
declare const setPartsUtc: { (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A; <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A; }
Since v3.6.0