ordinalDate property

int get ordinalDate

The ordinal date, the number of days since December 31st the previous year.

January 1st has the ordinal date 1

December 31st has the ordinal date 365, or 366 in leap years

Implementation

int get ordinalDate {
  const offsets = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
  return offsets[month - 1] + day + (isLeapYear && month > 2 ? 1 : 0);
}