endOfMonth property

DateTime get endOfMonth

Get the end of the month

Example:

final date = DateTime(2023, 12, 25);
print(date.endOfMonth); // 2023-12-31 23:59:59.999

Implementation

DateTime get endOfMonth =>
    DateTime(year, month + 1, 1).subtract(const Duration(microseconds: 1));