Nepali Date API


The Nepali Date API offers functions for converting between Nepali Bikram Sambat and Gregorian dates, along with date formatting, parsing, and manipulation. It simplifies working with the Nepali calendar, providing accurate tools for date conversion and handling.

import { NepaliDate } from '@zener/nepali-datepicker-react';

export default function App() {
  const date = new NepaliDate();
  const year = date.getFullYear();

  return '...'
}

References


Methods

The following methods are available:

Method
Return Type
Description
getFullYear()
string | number
Gets the year, using local time.
getMonth()
string | number
Gets the month of a Date object.
getMonthName()
string
Gets the name of the month of a Date object.
getDate()
string | number
Gets the day-of-the-month.
getDay()
string | number
Gets the day of the week.
getDayName()
string
Gets the short name of day of the week.
getDayNameFull()
string
Gets the full name of day of the week.
now()
NepaliDate
Returns the current nepali date.
parseDate(date:string)
{year : number, date : number, day : number}
Returns the parsed date object from string of format YYYY-MM-DD.
toAD()
Object
Returns the year, month and date in AD
toADasDate()
DateObject
Returns the date object for Gregorian Calendar.
toJson()
Nepali date in JSON format.
Returns the date object for Nepali date as JSON.
toString()
Nepali date in string format.
Returns the date object for Nepali date as string in format YYYY-MM-DD.