npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nepali-date-lite

v1.0.0

Published

Bikram Sambat (Nepali calendar) date conversion and formatting. Zero dependencies, ESM, TypeScript types included.

Readme

nepali-date-lite

Bikram Sambat (Nepali calendar) date conversion and formatting. Zero dependencies, ESM, TypeScript types included.

npm install nepali-date-lite

Published as nepali-date-lite on npm. The name bikram-sambat was already taken by an actively maintained package — this one differs by having zero dependencies and TypeScript types, which that one does not.

Why

Every application built for Nepal eventually needs BS dates — invoices, VAT filings, hospital records, government forms. The conversion is not arithmetic: month lengths vary between 29 and 32 days with no formula, so it requires a lookup table per year. This packages that table with a small, tested API.

Built while shipping a hospital ERP that files VAT returns in Nepal, where getting this wrong meant a document nobody could legally submit.

Usage

import { toBS, toAD, format, today } from 'nepali-date-lite';

toBS('2024-04-13');
// { year: 2081, month: 1, day: 1, weekday: 6 }

toAD(2081, 1, 1);
// 2024-04-13T00:00:00.000Z

format(today(), 'D MMMM YYYY');
// '1 Baishakh 2081'

format(today(), 'D MMMM YYYY', { nepali: true });
// '१ बैशाख २०८१'

API

| Function | Returns | | --- | --- | | toBS(date) | { year, month, day, weekday } from a Date or 'YYYY-MM-DD' string | | toAD(year, month, day) | A Date at UTC midnight | | today() | Today as a BS date | | format(bs, pattern?, { nepali }) | Formatted string | | addDays(bs, n) | A new BS date | | diffDays(a, b) | Whole days between two BS dates | | daysInMonth(year, month) | 29–32 | | daysInYear(year) | 365 or 366 | | isValid(year, month, day) | boolean — never throws | | toNepaliDigits(value) | '2081' → '२०८१' |

Format tokens

YYYY YY MM M DD D MMMM MMM dddd

With { nepali: true }, month and weekday names render in Devanagari and digits convert automatically.

Also exported

MONTHS_EN MONTHS_NP WEEKDAYS_EN WEEKDAYS_NP MIN_BS_YEAR MAX_BS_YEAR SUPPORTED_RANGE

Supported range

BS 2000-01-01 → 2090-12-30, which is AD 1943-04-14 → 2034-04-13.

Anything outside that throws a RangeError rather than returning a wrong answer, because a silently incorrect date is worse than a failed one.

Correctness

The calendar table is validated three ways, and the test suite runs all of it:

  • Every one of the 91 years sums to exactly 365 or 366 days.
  • Conversions match published anchors across eight decades — BS 2000, 2050, 2070, 2079, 2080, 2081 and 2082 new year.
  • 3,276 round-trips — the first, middle and last day of every month in every supported year converts to AD and back to exactly the same BS date.
npm test

If you find a date this gets wrong, please open an issue with the date and a source — it will be fixed quickly.

Licence

MIT © Sujay Aryal