Nepali DateNepali DateBikram Sambat Date Engine
Static Methods

NepaliDate.is_valid()

Static validation function to verify whether a given year, month, and day combination forms a valid Bikram Sambat date.

The static is_valid method verifies whether a specified Bikram Sambat year, month index, and day number represent a real calendar date. It consults verified historical data tables to confirm that the year falls within the supported range of 1976 through 2100 BS and that the day number does not exceed the actual number of days in that specific month.


Import

from nepali_date_library import NepaliDate

Signature

@staticmethod
def is_valid(year: int, month: int, date: int) -> bool:

Parameters

ParameterTypeRequiredDescription
yearintYesFour digit Bikram Sambat year between 1976 and 2100.
monthintYesZero based month index from 0 (Baisakh) to 11 (Chaitra).
dateintYesDay number of the month from 1 to 32.

Return Value

  • Type: bool
  • Description: Returns True if the date is astronomically and historically valid, otherwise False.

Examples

from nepali_date_library import NepaliDate

# Valid date (Baisakh 1, 2081 BS)
print(NepaliDate.is_valid(2081, 0, 1))   # True

# Invalid day (Baisakh 32 does not exist in 2080 BS)
print(NepaliDate.is_valid(2080, 0, 32))  # False

# Out of range year
print(NepaliDate.is_valid(1950, 0, 1))   # False

Advertisement

On this page