isLastDayOfMonth property

bool get isLastDayOfMonth

Checks if this DateTime instance represents the last day of the month.

Example:

DateTime lastDay = DateTime(2022, 1, 31);
DateTime otherDay = DateTime(2022, 1, 8);

print(lastDay.isLastDayOfMonth);  // Output: true
print(otherDay.isLastDayOfMonth);  // Output: false

The isLastDayOfMonth extension returns true if the date is the last day of the month, and false otherwise. It compares the year, month, and day components of the DateTime instance with the date of the last day of the same month.

Implementation

bool get isLastDayOfMonth => isSameDay(lastDayOfMonth);