Calculates the quarter and fiscal year for a given date and fiscal year start month.
npm install fy-quarter
The package takes 2 parameters, Date and quarter Start
This parameter should be an ISO 8601 compliant date YYYY-MM-DD.
This parameter should corrospond to the month where the first quarter begins.
Month | FY Year Start Month |
---|---|
Jan | 1 |
Feb | 2 |
Mar | 3 |
Apr | 4 |
May | 5 |
Jun | 6 |
Jul | 7 |
Aug | 8 |
Sep | 9 |
Oct | 10 |
Nov | 11 |
Dec | 12 |
This example shows the output for 23rd June 2022 where the fiscal year starts in april.
const fyQuarter = require("fy-quarter");
fyQuarter("2022-06-23", "4");
// { quarter: 1, fiscalYear: 2023, text: 'Q1 - FY23' }