fiscalYearWithConfig method
Gets the fiscal year using a configuration.
The fiscal year is identified by the calendar year in which it starts. Use FiscalYearConfig.yearOffset to shift the label (e.g., US Government uses offset 1 so FY2024 = Oct 2023 - Sep 2024).
Implementation
int fiscalYearWithConfig(FiscalYearConfig config) {
_validateFiscalYearConfig(config);
final boundaryDay = _effectiveFiscalStartDay(
year: year,
month: config.startMonth,
startDay: config.startDay,
);
if (month < config.startMonth ||
(month == config.startMonth && day < boundaryDay)) {
return year - 1 + config.yearOffset;
}
return year + config.yearOffset;
}