Static Methods
The NepaliDate class provides several static methods for validation, name lookups, calendar generation, and fiscal year operations.
Import
from nepali_date_library import NepaliDateDate Range Utilities
NepaliDate.minimum()
Returns the earliest date supported by the library.
@staticmethod
def minimum() -> datetimeReturns: Python datetime object representing the minimum supported date (April 13, 1919)
NepaliDate.maximum()
Returns the latest date supported by the library.
@staticmethod
def maximum() -> datetimeReturns: Python datetime object representing the maximum supported date (~2044)
Validation
NepaliDate.is_valid()
Checks if the specified Nepali date components are valid.
@staticmethod
def is_valid(year: int, month: int, day: int) -> boolParameters:
year- Nepali year (1976-2100)month- Nepali month (1-12 or 0-11, Python uses internal 0-indexed bounds checking unless transformed)day- Day of month (1-32)
Returns: True if the date is valid
Example:
# Valid dates (assuming internally 0-11 for month)
print(NepaliDate.is_valid(2082, 9, 15)) # TrueName Utilities
NepaliDate.get_month_name()
Returns the name of a Nepali month.
@staticmethod
def get_month_name(month: int, short: bool = False, nepali: bool = False) -> strParameters:
month- Month index (0-11)short- Return short form (default:False)nepali- Return Nepali name (default:False)
Returns: Month name string
Example:
# English names
print(NepaliDate.get_month_name(0)) # 'Baisakh'
print(NepaliDate.get_month_name(0, True)) # 'Bai'
# Nepali names
print(NepaliDate.get_month_name(0, False, True)) # 'बैशाख'
print(NepaliDate.get_month_name(0, True, True)) # 'बै'NepaliDate.get_day_name()
Returns the name of a day of the week.
@staticmethod
def get_day_name(day: int, short: bool = False, nepali: bool = False) -> strParameters:
day- Day of week indexshort- Return short form (default:False)nepali- Return Nepali name (default:False)
Returns: Day name string
Calendar Generation
NepaliDate.get_calendar_days()
Generates calendar data for a given month, including trailing days from adjacent months. Perfect for building datepicker or calendar UI components.
@staticmethod
def get_calendar_days(year: int, month: int) -> dictParameters:
year- Nepali yearmonth- Nepali month (0-11)
Returns: Dictionary containing:
prev_remaining_days- Number of days from previous month to showprev_month- Previous month info with day arraycurrent_month- Current month info with day arraynext_month- Next month info with day arrayremaining_days- Number of days from next month to show
Quarter Methods
NepaliDate.get_quarter()
Returns the start and end dates for a specific quarter.
@staticmethod
def get_quarter(quarter: int, year: int) -> dictParameters:
quarter- Quarter number (1-4)year- Nepali year
Returns: Dictionary with start and end NepaliDate instances
NepaliDate.get_quarters()
Returns all quarters for a year.
@staticmethod
def get_quarters(year: int) -> dictReturns: Dictionary mapping "Q1", "Q2", "Q3", "Q4" to their respective dates.
Fiscal Year Methods
Nepal's Fiscal Year
Nepal's fiscal year starts on Shrawan 1st (mid-July). Fiscal Year 2081/82 runs from Shrawan 1, 2081 to Asar end, 2082.
NepaliDate.current_fiscal_year()
Returns the current fiscal year.
@staticmethod
def current_fiscal_year() -> intNepaliDate.get_fiscal_quarter()
Returns the start and end dates for a specific fiscal year quarter.
@staticmethod
def get_fiscal_quarter(quarter: int, fiscal_year: int = None) -> dictParameters:
quarter- Fiscal quarter number (1-4)fiscal_year- Fiscal year (optional, defaults to current fiscal year)
NepaliDate.get_fiscal_quarters()
Returns all quarters for a fiscal year.
@staticmethod
def get_fiscal_quarters(fiscal_year: int = None) -> dictReturns: Dictionary with all four fiscal quarters mapping "Q1" through "Q4".