How to find YearMonth is equal or after current month?

Rem*_*emo 2 java datetime date

I want to find the month is equal or after the current YearMonth

final YearMonth yearMonth = YearMonth.of(2020, 8);
final boolean after = yearMonth.isAfter(YearMonth.now());

Run Code Online (Sandbox Code Playgroud)

Here current month is August(8) and I tried isAfter which returns false.

I want to return true for current month also.

Is any method is there in YearMonth itself?

OH *_*ERS 7

您可以只使用该isBefore方法的否定:

final boolean equalOrAfter = !yearMonth.isBefore(YearMonth.now());
Run Code Online (Sandbox Code Playgroud)

毕竟 YearMonth 可以在另一个 YearMonth 之前、之后或等于另一个 YearMonth,所以如果 YearMonth不在另一个 YearMonth 之前,它必须等于或在它之后。