Useful Static Methods

Static Methods

You can use the static methods of NepaliDatePicker to perform some useful operations.

Convert AD to BS

You can convert AD date to BS date using the static method NepaliDatePicker.convertToNepaliDate(). The method accepts three parameters: year, month and day. The method returns an object with year, month and day properties.

const nepaliDate = NepaliDatePicker.convertToNepaliDate(1996, 4, 22);
console.log(nepaliDate); // { year: 2053, month: 1, day: 10 }

Find Leap Year

You can find if a year is leap year or not using the static method NepaliDatePicker.isLeapYear(). The method accepts one parameter: year. The method returns true if the year is leap year, otherwise false.

const isLeapYear = NepaliDatePicker.isLeapYear(2053);
console.log(isLeapYear); // true

If you want any other static/helper methods to be added, please Open An Issue.