daysInMonth property

int get daysInMonth

How many days this month has.

DateTime(2024, 2).daysInMonth; // 29

Implementation

int get daysInMonth => DateTime.utc(year, month + 1, 0).day;