Methods
date.isValid()
Validate whether the current NepaliDate instance represents a legitimate calendar date within supported bounds.
The isValid instance method checks whether the current NepaliDate instance contains valid calendar values and falls within the supported range of 1976 through 2100 BS. It verifies that year, month, and day coordinates correspond to an authentic historical date.
Import
import { NepaliDate } from "nepali-date-library";Signature
isValid(): boolean;Parameters
This method does not take any parameters.
Return Value
- Type:
boolean - Returns
trueif the instance's year, month, and day are valid within the Bikram Sambat calendar data (1976 BS to 2100 BS); otherwise returnsfalse.
Examples
Validating Instance Dates
import { NepaliDate } from "nepali-date-library";
const date = new NepaliDate("2081-01-15");
console.log(date.isValid()); // trueChecking Post-Mutation Validity
import { NepaliDate } from "nepali-date-library";
const date = new NepaliDate("2081-01-01");
console.log(date.isValid()); // trueRelated
NepaliDate.isValid(): Static validation helper taking numeric year, month, and day.date.daysInMonth(): Total days in the month.
Advertisement
date.isSame()
Check whether two dates match across a specified granularity such as year, month, or day.
date.isLeapYear()
Determine whether the current Bikram Sambat calendar year has three hundred sixty six or more days.