# PlainDateTime

`import { PlainDateTime } from "destack:time";`

Temporal plain date-time.

```ds title="PlainDateTime"
export class PlainDateTime {
    static from(item: PlainDateTime | PlainDateTimeLike | string, options?: AssignmentOptions | undefined): PlainDateTime;
    static compare(one: PlainDateTime | PlainDateTimeLike | string, two: PlainDateTime | PlainDateTimeLike | string): -1 | 0 | 1;
    constructor(isoYear: float64, isoMonth: float64, isoDay: float64, hour?: float64 | undefined, minute?: float64 | undefined, second?: float64 | undefined, millisecond?: float64 | undefined, microsecond?: float64 | undefined, nanosecond?: float64 | undefined, calendar?: string | undefined);
    get era(): MaybeOwned<string> | undefined;
    get eraYear(): float64 | undefined;
    get year(): float64;
    get month(): float64;
    get monthCode(): Cow<"frame", string>;
    get day(): float64;
    get hour(): float64;
    get minute(): float64;
    get second(): float64;
    get millisecond(): float64;
    get microsecond(): float64;
    get nanosecond(): float64;
    get calendarId(): Cow<"frame", string>;
    get dayOfWeek(): float64;
    get dayOfYear(): float64;
    get weekOfYear(): float64 | undefined;
    get yearOfWeek(): float64 | undefined;
    get daysInWeek(): float64;
    get daysInYear(): float64;
    get daysInMonth(): float64;
    get monthsInYear(): float64;
    get inLeapYear(): boolean;
    equals(other: PlainDateTime | PlainDateTimeLike | string): boolean;
    with(dateTimeLike: { era?: string; eraYear?: float64; year?: float64; month?: float64; monthCode?: string; day?: float64; hour?: float64; minute?: float64; second?: float64; millisecond?: float64; microsecond?: float64; nanosecond?: float64; calendar?: CalendarLike }, options?: AssignmentOptions | undefined): PlainDateTime;
    withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): PlainDateTime;
    withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): PlainDateTime;
    add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainDateTime;
    subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainDateTime;
    until(other: PlainDateTime | PlainDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;
    since(other: PlainDateTime | PlainDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration;
    round(roundTo: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | { smallestUnit: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">; roundingIncrement?: float64; roundingMode?: RoundingMode }): PlainDateTime;
    toZonedDateTime(timeZone: string | ZonedDateTime, options?: ToInstantOptions | undefined): ZonedDateTime;
    toPlainDate(): PlainDate;
    toPlainTime(): PlainTime;
    toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>;
    toJSON(): Cow<"frame", string>;
    toString(options?: CalendarTypeToStringOptions | undefined): Cow<"frame", string>;
    valueOf(): never;
}
```

[language/library/src/time/plain-date-time.ds:50:310](https://github.com/destack-sh/destack/blob/main/language/library/src/time/plain-date-time.ds#L50-L310)

## Members

### `static from(item: PlainDateTime | PlainDateTimeLike | string, options?: AssignmentOptions | undefined): PlainDateTime`

Create a plain date-time.

### `static compare(one: PlainDateTime | PlainDateTimeLike | string, two: PlainDateTime | PlainDateTimeLike | string): -1 | 0 | 1`

Compare two plain date-times.

### `constructor(isoYear: float64, isoMonth: float64, isoDay: float64, hour?: float64 | undefined, minute?: float64 | undefined, second?: float64 | undefined, millisecond?: float64 | undefined, microsecond?: float64 | undefined, nanosecond?: float64 | undefined, calendar?: string | undefined)`

Create a plain date-time.

### `get era(): MaybeOwned<string> | undefined`

Calendar era.

### `get eraYear(): float64 | undefined`

Calendar era year.

### `get year(): float64`

Calendar year.

### `get month(): float64`

Calendar month.

### `get monthCode(): Cow<"frame", string>`

Calendar month code.

### `get day(): float64`

Calendar day.

### `get hour(): float64`

Hour.

### `get minute(): float64`

Minute.

### `get second(): float64`

Second.

### `get millisecond(): float64`

Millisecond.

### `get microsecond(): float64`

Microsecond.

### `get nanosecond(): float64`

Nanosecond.

### `get calendarId(): Cow<"frame", string>`

Calendar identifier.

### `get dayOfWeek(): float64`

Day of week.

### `get dayOfYear(): float64`

Day of year.

### `get weekOfYear(): float64 | undefined`

Week of year.

### `get yearOfWeek(): float64 | undefined`

Week-based year.

### `get daysInWeek(): float64`

Days in this week.

### `get daysInYear(): float64`

Days in this year.

### `get daysInMonth(): float64`

Days in this month.

### `get monthsInYear(): float64`

Months in this year.

### `get inLeapYear(): boolean`

Whether this year is a leap year.

### `equals(other: PlainDateTime | PlainDateTimeLike | string): boolean`

Return true when this date-time equals `other`.

### `with(dateTimeLike: { era?: string; eraYear?: float64; year?: float64; month?: float64; monthCode?: string; day?: float64; hour?: float64; minute?: float64; second?: float64; millisecond?: float64; microsecond?: float64; nanosecond?: float64; calendar?: CalendarLike }, options?: AssignmentOptions | undefined): PlainDateTime`

Return this date-time with updated fields.

### `withPlainTime(time?: PlainTime | PlainTimeLike | string | undefined): PlainDateTime`

Return this date-time with another time.

### `withCalendar(calendar: string | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay): PlainDateTime`

Return this date-time in another calendar.

### `add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainDateTime`

Add a duration.

### `subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainDateTime`

Subtract a duration.

### `until(other: PlainDateTime | PlainDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration`

Return the duration until `other`.

### `since(other: PlainDateTime | PlainDateTimeLike | string, options?: DifferenceOptions<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | undefined): Duration`

Return the duration since `other`.

### `round(roundTo: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"> | { smallestUnit: SmallestUnit<"day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">; roundingIncrement?: float64; roundingMode?: RoundingMode }): PlainDateTime`

Round this date-time.

### `toZonedDateTime(timeZone: string | ZonedDateTime, options?: ToInstantOptions | undefined): ZonedDateTime`

Convert this date-time into a zoned date-time.

### `toPlainDate(): PlainDate`

Return the date part.

### `toPlainTime(): PlainTime`

Return the time part.

### `toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>`

Return a locale-aware string.

### `toJSON(): Cow<"frame", string>`

Return a JSON string.

### `toString(options?: CalendarTypeToStringOptions | undefined): Cow<"frame", string>`

Return an ISO string.

### `valueOf(): never`

Reject numeric coercion.
