isFirstDayOfMonth property

bool get isFirstDayOfMonth

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

Example:

DateTime firstDay = DateTime(2022, 1, 1);
DateTime otherDay = DateTime(2022, 1, 8);

print(firstDay.isFirstDayOfMonth);  // Output: true
print(otherDay.isFirstDayOfMonth);  // Output: false

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

Implementation

bool get isFirstDayOfMonth => isSameDay(firstDayOfMonth);