Bikram Sambat
Open-source library on npm
A TypeScript library for Nepal’s Bikram Sambat calendar: converting between AD and BS dates, and parsing, formatting, shifting and comparing BS dates from 1970 to 2111 BS.
- TypeScript
- Day.js
- Jest
- tsup
- All time
- 9,188
- 2026
- 5,201
- October
- 416
Downloads on npm, counted through 18 Oct 2026.
Problem
Nepal runs on the Bikram Sambat calendar, but JavaScript’s Date only knows the Gregorian one. BS month lengths change from year to year, so a date can’t be converted with a formula alone.
Approach
A BikramSambat date object you can start from a BS string, an AD date or today, then read and set its year, month and day. Each instance carries its AD date and the BS month name alongside.
API
Formatting, start and end of a unit, adding and subtracting, and comparisons (isSame, isBefore, isAfter, isBetween), named the way Day.js names them, which the library builds on.
Range
Covers 1970 to 2111 BS. Parsing validates the date and only accepts years in that range, and the month table for any year in it is available on its own.
Shipped
Published to npm in June 2024 with ES module, CommonJS and TypeScript type builds, tested with Jest and MIT licensed. Maintained since, with fixes for comparisons and arithmetic when a BS month spans two AD months.