plusMonths method
Adds the specified number of months.
This operation is calendar-aware and handles month-end cases properly.
Example:
final jan31 = ZonedDateTime.parse('2023-01-31T12:00:00Z');
final feb = jan31.plusMonths(1); // 2023-02-28T12:00:00Z (not Feb 31)
final mar31 = ZonedDateTime.parse('2023-03-31T12:00:00Z');
final apr = mar31.plusMonths(1); // 2023-04-30T12:00:00Z (not Apr 31)
Implementation
ZonedDateTime plusMonths(int months) {
final newLocalDateTime = _localDateTime.plusMonths(months);
return ZonedDateTime.of(newLocalDateTime, _zone);
}