Fiscal Year & Quarters
date.getCurrentFiscalYearQuarter()
Method to calculate the active fiscal trimester quarter number for a NepaliDate instance.
The getCurrentFiscalYearQuarter method returns an integer from 1 to 4 representing the active fiscal trimester of the current date. Because Nepal fiscal calendar starts in Shrawan, quarter 1 covers Shrawan through Ashwin, quarter 2 spans Kartik through Poush, quarter 3 covers Magh through Chaitra, and quarter 4 spans Baisakh through Ashadh.
Import
import { NepaliDate } from "nepali-date-library";const { NepaliDate } = require("nepali-date-library");Signature
getCurrentFiscalYearQuarter(): number;Parameters
- None.
Return Value
- Type:
number - Values:
1 | 2 | 3 | 4
| Month (Bikram Sambat) | Month Index | Returned Quarter |
|---|---|---|
| Shrawan, Bhadra, Ashwin | 3, 4, 5 | 1 (Q1) |
| Kartik, Mangsir, Poush | 6, 7, 8 | 2 (Q2) |
| Magh, Falgun, Chaitra | 9, 10, 11 | 3 (Q3) |
| Baisakh, Jestha, Ashadh | 0, 1, 2 | 4 (Q4) |
Examples
Determining Quarter of a Given Date
import { NepaliDate } from "nepali-date-library";
const dashainDate = new NepaliDate("2081-07-15"); // Kartik
console.log(dashainDate.getCurrentFiscalYearQuarter()); // 2 (Q2)
const endOfYearDate = new NepaliDate("2081-03-25"); // Ashadh
console.log(endOfYearDate.getCurrentFiscalYearQuarter()); // 4 (Q4)Financial Audit Filter
import { NepaliDate } from "nepali-date-library";
interface JournalEntry {
description: string;
date: NepaliDate;
amount: number;
}
function filterByFiscalQuarter(entries: JournalEntry[], targetQuarter: number) {
return entries.filter(
(entry) => entry.date.getCurrentFiscalYearQuarter() === targetQuarter
);
}Related
date.getCurrentFiscalYearQuarterDates(): Retrieve the exact start and end dates for the active quarter.NepaliDate.getFiscalYearQuarter(): Static helper for any arbitrary quarter and year.
Advertisement
NepaliDate.getCurrentFiscalYear()
Method to retrieve the formatted fiscal year string for a given NepaliDate instance.
date.getCurrentFiscalYearQuarterDates()
Method to retrieve exact start and end boundary dates for the active fiscal quarter.