0.0.3 • Published 2 years ago
@sambruca/fiscal-year v0.0.3
Fiscal Year
Installation
NPM
npm install @sambruca/fiscal-yearYARN
yarn add @sambruca/fiscal-yearUsage
import { fyUtils } from "@sambruca/fiscal-year";To fetch fiscal year of a given date:
const date = new Date()
const fyStartMonth = 3;
const fiscalYear= fyUtils.getFiscalYearOfDate(date, fyStartMonth)fyStartMonth must always be a number from 0 to 11, 0 being Jan and 11 being December.
To build a fiscal year object, with information about the year, run:
const fyStartMonth = 3;
const year = 2023;
const fiscalYear: IFiscalYear = fyUtils.buildFiscalYear(fyStartMonth, year)The shape of the resulting object can be found here.