Methods
date.getYear()
Retrieve the four digit Bikram Sambat year number from a NepaliDate instance.
The getYear method returns the full four digit Bikram Sambat year as an integer for the current NepaliDate instance. Unlike legacy JavaScript Date getYear which returns years minus 1900, this method returns the complete calendar year such as 2081 within the supported range of 1976 through 2100 BS.
Import
import { NepaliDate } from "nepali-date-library";Signature
getYear(): number;Parameters
- None.
Return Value
- Type:
number - Range:
1976to2100 - Description: Full 4-digit Bikram Sambat year integer.
Example
import { NepaliDate } from "nepali-date-library";
const date = new NepaliDate("2081-07-15");
console.log(date.getYear()); // 2081Related
date.setYear(): Mutate the year component.date.getMonth(): Retrieve the month component.
Advertisement
Instance Properties
Reference for public instance properties available on every NepaliDate object including year, month, day, and underlying timestamp.
date.getMonth()
Retrieve the zero based Bikram Sambat month index from zero for Baisakh to eleven for Chaitra.