date.getCurrentQuarter()
Return the standard Bikram Sambat calendar quarter number from one to four for the current date.
The getCurrentQuarter method returns an integer from 1 to 4 designating the standard calendar quarter containing the current date. Calendar quarters divide the Bikram Sambat year into four sequential segments starting from 1 Baisakh, which differs from government fiscal trimesters that commence in Shrawan.
Import
import { NepaliDate } from "nepali-date-library";Signature
getCurrentQuarter(): number;Parameters
This method does not take any parameters.
Return Value
- Type:
number - The calendar quarter integer (
1,2,3, or4):1: Baisakh, Jestha, Asar (Months0-2)2: Shrawan, Bhadra, Aswin (Months3-5)3: Kartik, Mangsir, Poush (Months6-8)4: Magh, Falgun, Chaitra (Months9-11)
Note on Fiscal Quarters
Calendar quarters follow the Baisakh-to-Chaitra annual cycle. If you require Government of Nepal / IRD fiscal quarters (which begin in Shrawan), use date.getCurrentFiscalYearQuarter() instead.
Examples
Determining Current Calendar Quarter
import { NepaliDate } from "nepali-date-library";
// 2081 Baisakh 15 (month index 0)
const date1 = new NepaliDate(2081, 0, 15);
console.log(date1.getCurrentQuarter()); // 1
// 2081 Shrawan 1 (month index 3)
const date2 = new NepaliDate(2081, 3, 1);
console.log(date2.getCurrentQuarter()); // 2
// 2081 Kartik 10 (month index 6)
const date3 = new NepaliDate(2081, 6, 10);
console.log(date3.getCurrentQuarter()); // 3
// 2081 Magh 20 (month index 9)
const date4 = new NepaliDate(2081, 9, 20);
console.log(date4.getCurrentQuarter()); // 4Related
NepaliDate.getQuarter(): Get start and end dates for a specific calendar quarter.date.getCurrentFiscalYearQuarter(): Get the Nepali fiscal quarter (1-4).
date.getWeeksInMonth()
Calculate the number of calendar week rows required to render the current month in a grid.
date.format()
Format a NepaliDate instance into a custom string using token patterns for English and Nepali output.