Nepali DateNepali DateBikram Sambat Date Engine
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 true if the instance's year, month, and day are valid within the Bikram Sambat calendar data (1976 BS to 2100 BS); otherwise returns false.

Examples

Validating Instance Dates

import { NepaliDate } from "nepali-date-library";

const date = new NepaliDate("2081-01-15");
console.log(date.isValid()); // true

Checking Post-Mutation Validity

import { NepaliDate } from "nepali-date-library";

const date = new NepaliDate("2081-01-01");
console.log(date.isValid()); // true

Advertisement

On this page