(self: DateTime): DateTime.PartsWithWeekdayGets the time-zone-adjusted parts of a DateTime as an object.
Details
The parts will be time zone adjusted if the DateTime is zoned.
Example (Reading DateTime parts)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")
const parts = DateTime.toParts(dt)
console.log(parts)
// {
// year: 2024,
// month: 1,
// day: 1,
// hours: 12,
// minutes: 30,
// seconds: 45,
// millis: 123,
// weekDay: 1 // Monday
// }export const const toParts: (
self: DateTime
) => DateTime.PartsWithWeekday
Gets the time-zone-adjusted parts of a DateTime as an object.
Details
The parts will be time zone adjusted if the DateTime is zoned.
Example (Reading DateTime parts)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")
const parts = DateTime.toParts(dt)
console.log(parts)
// {
// year: 2024,
// month: 1,
// day: 1,
// hours: 12,
// minutes: 30,
// seconds: 45,
// millis: 123,
// weekDay: 1 // Monday
// }
toParts: (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) => 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 = import InternalInternal.const toParts: (
self: DateTime.DateTime
) => DateTime.DateTime.PartsWithWeekday
toParts