lastDayOfMonth static method
Returns the last day of the specified month.
The month parameter represents the month number, where January is 1 and December is 12.
The optional year parameter represents the year. If not provided, the current year is used.
Returns an integer representing the last day of the specified month.
Implementation
static int lastDayOfMonth(int month, [int? year]) => DateTime(year ?? thisYear, month + 1, 0).day;