Methods
date.set()
Set year, month, and day coordinates simultaneously on a NepaliDate instance.
The set method updates the Bikram Sambat year, zero based month index, and day values of the current NepaliDate instance in a single atomic call. It validates the combined coordinates against the calendar map and recalculates the internal timestamp.
Import
from nepali_date_library import NepaliDateSignature
def set(self, year: int, month: int, date: int) -> None:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
year | int | Yes | Bikram Sambat year integer between 1976 and 2100. |
month | int | Yes | Zero based month index from 0 (Baisakh) to 11 (Chaitra). |
date | int | Yes | Day number of the month from 1 to 32. |
Return Value
- Type:
None - Note: Mutates the current
NepaliDateinstance in place.
Example
from nepali_date_library import NepaliDate
date = NepaliDate("2080-01-01")
date.set(2081, 6, 15) # Kartik 15, 2081 BS
print(date.format("YYYY-MM-DD")) # "2081-07-15"Related
date.set_year(): Mutate year only.date.set_month(): Mutate month only.
Advertisement
date.get_english_date()
Retrieve the equivalent Gregorian date as a native JavaScript Date object.
date.set_year()
Set the Bikram Sambat year on a NepaliDate instance within the supported calendar range.