date.isLeapYear()
Determine whether the current Bikram Sambat calendar year has three hundred sixty six or more days.
The isLeapYear method checks whether the active Bikram Sambat year contains 366 or more days based on official solar calendar tables. Because Bikram Sambat year lengths depend on astronomical calculations rather than fixed leap year cycles, this method checks the actual cumulative day count for the year.
Import
import { NepaliDate } from "nepali-date-library";Signature
isLeapYear(): boolean;Parameters
This method does not take any parameters.
Return Value
- Type:
boolean - Returns
trueif the total days in the current Bikram Sambat year is greater than or equal to 366; otherwise returnsfalse.
Background
Unlike the Gregorian calendar which inserts a leap day every 4 years on February 29, the Bikram Sambat calendar is a sidereal solar calendar where each month's duration is determined by the exact astrological entry (Sankranti) of the Sun into each zodiac constellation. Consequently, the total number of days in a Bikram Sambat year fluctuates between 365 and 366 days based on astronomical observation data.
Examples
Checking if a Year is a Leap Year
import { NepaliDate } from "nepali-date-library";
const date2081 = new NepaliDate("2081-01-01");
console.log(date2081.isLeapYear());
const date2080 = new NepaliDate("2080-01-01");
console.log(date2080.isLeapYear());Related
date.daysInMonth(): Query days in a specific month.date.getYear(): Retrieve current year.
date.isValid()
Validate whether the current NepaliDate instance represents a legitimate calendar date within supported bounds.
date.daysInMonth()
Retrieve the total number of days in the current or specified Bikram Sambat month.