Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including nanakshahi with all npm packages installed. Try it out:

const n = require( './index' ) const date = new Date() console.log( n.getNanakshahiDate( date ) ) console.log( n.getDateFromNanakshahi( 550, 10, 23 ) ) console.log( n.getHolidaysForDay( date ) ) console.log( n.getHolidaysForMonth( 1 ) ) console.log( n.getTithi( date ) ) console.log( n.findBikramiDate( date ) ) console.log( n.findDateFromTithi( 1723, 10, 7 ) ) console.log( n.findMovableHoliday( 'gurunanak' ) )

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

nanakshahi v5.1.1

A JavaScript Library to get Nanakshahi Dates and Gurpurabs


A JavaScript Library to get Nanakshahi Dates and Gurpurabs

npm Travis (.org) GitHub license GitHub issues GitHub pull requests jsdelivr



Install the library via NPM:

npm install nanakshahi

The library can be imported into Node as below:

const n = require('nanakshahi')

const date = new Date()

n.getNanakshahiDate( date )
n.getDateFromNanakshahi( 550, 10, 23 )
n.getHolidaysForDay( date )
n.getHolidaysForMonth( 1 )
n.getTithi( date )
n.findBikramiDate( date )
n.findDateFromTithi( 1723, 10, 7 )
n.findMovableHoliday( 'gurunanak' )

Additionally, the package is available for web use via unpkg CDN.

<script src=""></script>

Or via jsDelivr

<script src=""></script>

Want a demo?
Try on RunKit


While the library does run on most modern browsers, it does not work on IE11.

The library requires Math.trunc, Math.sign, and Array.prototype.includes. These can be added with the Polyfill below:

<script crossorigin="anonymous" src=""></script>


getDateFromNanakshahi(year, month, date) ⇒ Object

Converts Nanakshahi Date into the Gregorian Calendar

Returns: Object - Gregorian Date

yearnumberNanakshahi Year
monthnumberNanakshahi Month, 1-12
datenumberNanakshahi Day


getDateFromNanakshahi( 550, 10, 23 )

getHolidaysForDay([gregorianDate]) ⇒ Array

Returns all Gurpurabs and Holidays for a Date

Returns: Array - Holidays for the day with Date and name in English and Punjabi

[gregorianDate]ObjectJavaScript Date() Object


getHolidaysForDay( new Date() )

getHolidaysForMonth(month, [year]) ⇒ Object

Returns all Gurpurabs and Holidays for a Nanakshahi Month

Returns: Object - Holidays for the month with Date and name in English and Punjabi

monthnumberNanakshahi Month, 1-12
[year]numberNanakshahi Year, Default is Current year


getHolidaysForMonth( 1 )

getNanakshahiDate(gregorianDate) ⇒ Object

Converts given Gregorian Date to the corresponding date in the Nanakshahi Calendar

Returns: Object - Nanakshahi Date in English and Punjabi

gregorianDateObjectJavaScript Date() Object


getNanakshahiDate( new Date() )

getTithi([gregorianDate]) ⇒ Object

Get Tithi and other Moon/Lunar Info

Returns: Object - Tithi and Moon Info

[gregorianDate]ObjectJavaScript Date() Object, defaults to current Date.


getTithi( new Date() )

findBikramiDate(date, [isJulian]) ⇒ Object

Returns given date to the corresponding date in the Bikrami Calendar

Returns: Object - Bikrami (Includes Lunar and Solar Date)

dateObjectJavaScript Date() Object
[isJulian]booleanfalseSet to true if entered date is in Julian Calendar


findBikramiDate( new Date() )

findDateFromTithi(year, month, date, [paksh], [leapMonth], [leapDay]) ⇒ Object

Converts Bikrami Lunar Date into the Gregorian Calendar (Accuracy of plus or minus 1 day)

Returns: Object - Gregorian Date

yearnumberBikrami Year
monthnumberBikrami Month
datenumberBikrami Tithi
[paksh]booleanfalseLunar Paksh. Default is Sudi, true for Vadi.
[leapMonth]booleanfalseSet to true if the month is Adhika Month (Mal Maas)
[leapDay]booleanfalseSet to true if the lunar day spans more than 1 solar day


findDateFromTithi( 1723, 10, 7 )

findMovableHoliday(holiday, [year]) ⇒ Object

Returns Gregorian Date of Movable Holiday Movable Holidays List: - gurunanak Parkash Guru Nanak Dev Ji - bandishhorr Bandi Shhorr Divas / Diwali - holla Holla Mahalla - kabeer Birthday Bhagat Kabeer Ji - ravidaas Birthday Bhagat Ravidaas Ji - naamdev Birthday Bhagat Naamdev Ji

Returns: Object - Holiday Date with Name in English and Punjabi

holidaystringHoliday which date will be calculated.
[year]numberGregorian year, default is current year.


findMovableHoliday( 'gurunanak' )


I want to thank:

  • Guru Sahib, who inspires us into Sikhi.

  • Pal Singh Purewal, who explained various concepts in the Bikrami and Nanakshahi Calendars to me and answered my various technical and historical questions.

  • E. M. Reingold and N. Dershowitz for their Calendrical Calculations book and Calendrica program code, which serves as the base for this library.

  • My father, Jasjit Singh, whose curiosity in the Nanakshahi and Bikrami calendar systems inspired me find answers to his technical questions.


We're happy to accept suggestions and pull requests!

To get started, clone this repo and run npm install inside this directory.

This repository follows the Airbnb's Javascript Style Guide, with a few minor modifications. Notably, spaces should be included inside parentheses and brackets (weird, right!). An ESLint file is provided, and your code will automatically be checked on-commit for style. It is recommended to install an ESLint plugin for your editor (VS Code's ESLint plugin works out of the box), so you can receive linter suggestions as you type.

When writing commit messages, please follow the seven rules. Markdown and HTML JSDoc documentation is generated automatically, on commit, however if you'd like to preview any changes to documentation, npm run build-docs will update should not be edited, instead apply modifications to README.hbs.

The general workflow for contributing:

  • Fork/create a new branch.
  • Write or update existing tests with expected results
  • Implement functions/changes
  • Add JSDoc function documentation and examples.
  • Create a pull request with the changes.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free