findLastDateOfTheMonth method

DateTime findLastDateOfTheMonth(
  1. DateTime dateTime
)

Find the last date of the month which contains the provided date.

Implementation

DateTime findLastDateOfTheMonth(DateTime dateTime) {
  DateTime lastDayOfMonth = DateTime.utc(dateTime.year, dateTime.month + 1, 1)
      .subtract(Duration(hours: 1));
  print('lastDayOfMonth - $lastDayOfMonth');
  return lastDayOfMonth;
}