Initializer
GregorianYearMonth(Integer year, Month month)
Parameters:
  • year

    The year of the date.

  • month

    Month of the year value of the date.

Attributes
leapYearSource Codeshared actual Boolean leapYear

True if the year of the date is a leap year.

monthSource Codeshared actual Month month

Month of the year value of the date.

stringSource Codeshared actual String string

Returns ISO-8601 formatted String representation of this year and month moment.

Reference: https://en.wikipedia.org/wiki/ISO_8601

yearSource Codeshared actual Integer year

The year of the date.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Enumerable<Other>
Attributes inherited from: Ordinal<Other>
Attributes inherited from: ReadableMonth
Attributes inherited from: ReadableYear
Attributes inherited from: YearMonth
Methods
compareSource Codeshared actual Comparison compare(YearMonth other)

Compares this value with the given value, returning:

  • larger, if this value is strictly larger than the given value,
  • smaller, if this value is strictly smaller than the given value, or
  • equal, if this value is equal (equals) to the given value.

For any two values x and y such that the expression x.compare(y) is well-typed, the expression may be written:

x <=> y 

Implementations must respect the constraints that:

  • x==y if and only if x<=>y == equal (consistency with equals()),
  • if x>y then y<x (symmetry), and
  • if x>y and y>z then x>z (transitivity).
minusMonthsSource Codeshared actual YearMonth minusMonths(Integer months)

Returns a copy of this instance with the specified number of months subtracted.

minusYearsSource Codeshared actual YearMonth minusYears(Integer years)

Returns a copy of this instance with the specified number of years subtracted.

neighbourSource Codeshared actual YearMonth neighbour(Integer offset)

The indirect successor or predecessor at the given offset, where:

  • x.neighbour(0) == x,
  • x.neighbour(i+1) == x.neighbour(i).successor, and
  • x.neighbour(i-1) == x.neighbour(i).predecessor.
offsetSource Codeshared actual Integer offset(YearMonth other)

Compute the offset from the given value, where:

  • x.offset(x) == 0, and
  • x.successor.offset(x) == 1 if x!=x.successor.
plusMonthsSource Codeshared actual YearMonth plusMonths(Integer months)

Returns a copy of this instance with the specified number of months added.

plusYearsSource Codeshared actual YearMonth plusYears(Integer years)

Returns a copy of this instance with the specified number of years added.

withMonthSource Codeshared actual YearMonth withMonth(Month month)

Returns a copy of this instance with the specified month of year.

withYearSource Codeshared actual YearMonth withYear(Integer year)

Returns a copy of this instance with the specified year.

Inherited Methods
Methods inherited from: Object
Methods inherited from: Comparable<Other>
Methods inherited from: Enumerable<Other>
Methods inherited from: MonthBehavior<Element>
Methods inherited from: YearBehavior<Element>
Methods inherited from: YearMonth