fiscalYear method

  1. @useResult
int fiscalYear({
  1. int startMonth = 1,
})

Fiscal year when year starts in startMonth (1–12). E.g. startMonth 4 → FY runs Apr–Mar.

Implementation

@useResult
int fiscalYear({int startMonth = 1}) {
  if (startMonth < 1 || startMonth > DateConstants.maxMonth) return year;
  if (month >= startMonth) return year;
  return year - 1;
}