# PlainYearMonth

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

Temporal plain year-month.

```ds title="PlainYearMonth"
export class PlainYearMonth {
    static from(item: PlainYearMonth | PlainYearMonthLike | string, options?: AssignmentOptions | undefined): PlainYearMonth;
    static compare(one: PlainYearMonth | PlainYearMonthLike | string, two: PlainYearMonth | PlainYearMonthLike | string): -1 | 0 | 1;
    constructor(isoYear: float64, isoMonth: float64, calendar?: string | undefined, referenceISODay?: float64 | undefined);
    get era(): MaybeOwned<string> | undefined;
    get eraYear(): float64 | undefined;
    get year(): float64;
    get month(): float64;
    get monthCode(): Cow<"frame", string>;
    get calendarId(): Cow<"frame", string>;
    get daysInMonth(): float64;
    get daysInYear(): float64;
    get monthsInYear(): float64;
    get inLeapYear(): boolean;
    equals(other: PlainYearMonth | PlainYearMonthLike | string): boolean;
    with(yearMonthLike: { era?: string; eraYear?: float64; year?: float64; month?: float64; monthCode?: string; calendar?: CalendarLike }, options?: AssignmentOptions | undefined): PlainYearMonth;
    add(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainYearMonth;
    subtract(durationLike: Duration | DurationLike | string, options?: ArithmeticOptions | undefined): PlainYearMonth;
    until(other: PlainYearMonth | PlainYearMonthLike | string, options?: DifferenceOptions<"year" | "month"> | undefined): Duration;
    since(other: PlainYearMonth | PlainYearMonthLike | string, options?: DifferenceOptions<"year" | "month"> | undefined): Duration;
    toPlainDate(day: { day: float64 }): PlainDate;
    toLocaleString(locales?: LocalesArgument | undefined, options?: DateTimeFormatOptions | undefined): Cow<"frame", string>;
    toJSON(): Cow<"frame", string>;
    toString(options?: ShowCalendarOption | undefined): Cow<"frame", string>;
    valueOf(): never;
}
```

[language/library/src/time/plain-year-month.ds:32:170](https://github.com/destack-sh/destack/blob/main/language/library/src/time/plain-year-month.ds#L32-L170)

## Members

### `static from(item: PlainYearMonth | PlainYearMonthLike | string, options?: AssignmentOptions | undefined): PlainYearMonth`

Create a plain year-month.

### `static compare(one: PlainYearMonth | PlainYearMonthLike | string, two: PlainYearMonth | PlainYearMonthLike | string): -1 | 0 | 1`

Compare two plain year-months.

### `constructor(isoYear: float64, isoMonth: float64, calendar?: string | undefined, referenceISODay?: float64 | undefined)`

Create a plain year-month.

### `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 calendarId(): Cow<"frame", string>`

Calendar identifier.

### `get daysInMonth(): float64`

Days in this month.

### `get daysInYear(): float64`

Days in this year.

### `get monthsInYear(): float64`

Months in this year.

### `get inLeapYear(): boolean`

Whether this year is a leap year.

### `equals(other: PlainYearMonth | PlainYearMonthLike | string): boolean`

Return true when this year-month equals `other`.

### `with(yearMonthLike: { era?: string; eraYear?: float64; year?: float64; month?: float64; monthCode?: string; calendar?: CalendarLike }, options?: AssignmentOptions | undefined): PlainYearMonth`

Return this year-month with updated fields.

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

Add a duration.

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

Subtract a duration.

### `until(other: PlainYearMonth | PlainYearMonthLike | string, options?: DifferenceOptions<"year" | "month"> | undefined): Duration`

Return the duration until `other`.

### `since(other: PlainYearMonth | PlainYearMonthLike | string, options?: DifferenceOptions<"year" | "month"> | undefined): Duration`

Return the duration since `other`.

### `toPlainDate(day: { day: float64 }): PlainDate`

Convert this year-month into a plain date.

### `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?: ShowCalendarOption | undefined): Cow<"frame", string>`

Return an ISO string.

### `valueOf(): never`

Reject numeric coercion.
