@sambruca/fiscal-year
v0.0.3
Published
## Installation
Downloads
4
Maintainers
Readme
Fiscal Year
Installation
NPM
npm install @sambruca/fiscal-year
YARN
yarn add @sambruca/fiscal-year
Usage
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.