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

@nepalpatro/bsad-converter

v1.1.0

Published

BS ⇄ AD — Bikram Sambat ↔ Gregorian date converter + Nepali calendar. Zero dependencies, offline, bilingual, isomorphic.

Readme

bsad-converter

Bikram Sambat (BS) ↔ Gregorian (AD) date conversion and the Nepali calendar (पात्रो). Zero dependencies · offline · bilingual (English + Nepali) · works in the browser and Node · TypeScript types included.

The calendar data is the verified medic/bikram-sambat month-length table — a widely-used, verified source. Epoch: 1 Baishakh 1970 BS = 13 April 1913 AD. Range: 1970–2090 BS (≈ 1913–2034 AD).

Install

npm install @nepalpatro/bsad-converter

Usage

import { adToBs, bsToAd, today, monthCalendar, toNepaliDigits } from "@nepalpatro/bsad-converter";

// English → Nepali
const bs = adToBs("2026-06-25");          // or adToBs(new Date())
bs.formattedEn;   // "Ashadh 11, 2083 BS"
bs.formattedNe;   // "असार ११, २०८३ बि.सं."
bs.weekdayNe;     // "बिहीबार"
bs.events;        // [] (or [{ en, ne }] on a national day)

// Nepali → English
bsToAd(2083, 1, 1);                        // "2026-04-14"  (Nepali New Year)

// Today, in Nepal time (Asia/Kathmandu)
today().formattedNe;                       // "असार ११, २०८३ बि.सं."

// A month as a calendar grid
const m = monthCalendar(2083, 1);          // Baishakh 2083
m.days;                                     // 31
m.firstWeekday.index;                       // 2  (Tuesday; 0 = Sunday)
m.dayList[0];                               // { day:1, dayNe:"१", ad:"2026-04-14", weekday:2, …, events:[…] }

toNepaliDigits(2083);                       // "२०८३"

CommonJS works too:

const { adToBs } = require("@nepalpatro/bsad-converter");

API

| Export | Signature | Returns | |---|---|---| | adToBs | (input: Date \| string) => BsDate | BS date (bilingual, weekday, events) | | bsToAd | (year, month, day) => string | Gregorian "YYYY-MM-DD" | | bsToAdDate | (year, month, day) => Date | Gregorian Date (UTC midnight) | | today | () => BsDate | today in Nepal (Asia/Kathmandu) | | monthCalendar | (year, month) => CalMonth | one BS month grid | | yearCalendar | (year) => CalMonth[] | all 12 BS months | | toNepaliDigits | (value: string \| number) => string | Devanagari numerals | | consts | MIN_BS_YEAR, MAX_BS_YEAR, AD_MIN, AD_MAX, BS_MONTHS | range + raw table |

BsDate = { year, month, day, monthEn, monthNe, iso, formattedEn, formattedNe, weekdayEn, weekdayNe, events }. CalDay = { day, dayNe, ad, weekday /* 0=Sun..6=Sat */, weekdayEn, weekdayNe, events }. CalEvent = { en, ne }.

Out-of-range or invalid input throws DateConversionError:

import { adToBs, DateConversionError } from "@nepalpatro/bsad-converter";
try { adToBs("2099-01-01"); } catch (e) { /* e instanceof DateConversionError */ }

Events

events covers fixed national days only (New Year, Republic / Constitution / Democracy / Martyrs' Day, Prithvi Jayanti, Maghe Sankranti, + fixed AD days: Labour Day, Women's Day, Christmas). Movable lunar festivals (Dashain, Tihar, Holi, Buddha Jayanti …) are intentionally not included — they shift yearly and require the official Nepal Panchanga.

Date picker

Build a Nepali (BS) date selector on top of monthCalendar(). See examples/date-picker.html for a complete, runnable widget — BS calendar grid, today + Saturday holidays highlighted, an AD input that jumps to the month, and the selected date shown in both BS and AD.

import { monthCalendar, toNepaliDigits } from "@nepalpatro/bsad-converter";

const cal = monthCalendar(2083, 3);     // असार 2083
cal.firstWeekday.index;                  // leading blank cells before day 1 (0 = Sunday)
cal.dayList.forEach(d => {
  // d.dayNe = "१२", d.ad = "2026-06-26", d.weekday (6 = Saturday), d.events
  // → render one cell per day; on click, surface d.ad + the BS date
});

Notes

  • Timezone: today() uses Asia/Kathmandu (UTC+5:45, no DST).
  • Sovereign: pure local computation; contacts no network and needs no API key.
  • A live HTTP API and a citizen calendar page exist at https://nepal.gov.np/calendar.

License

MIT licensed