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

bsad-datepicker

v1.0.9

Published

A dual-mode BS/AD date picker for React applications — built for Nepal.

Readme

bsad-datepicker

A dual-mode BS/AD date picker for React — built for Nepal. Supports Bikram Sambat (BS) and Anno Domini (AD) calendar modes, Nepali numerals, and smart viewport-aware positioning.


Installation

npm install bsad-datepicker

Peer dependencies: React ≥ 18 (React 18 and 19 both supported)


Quick Start

Wrap your form (or app) with CalendarProvider so multiple pickers on the same page don't conflict:

import { CalendarProvider, DatePickerField } from 'bsad-datepicker';
export default function MyForm() {
  const [dob, setDob] = useState('');
  return (
    <CalendarProvider>
      <DatePickerField
        label="Date of Birth"
        mode="bs"
        value={dob}
        color="#4f46e5"
        onDateSelect={(dates) => {
          // dates.bs / dates.ad → { year, month, day }
          // dates.bsFormatted / dates.adFormatted → "YYYY-MM-DD" strings, ready to use
          setDob(dates.bsFormatted);
        }}
        required
      />
    </CalendarProvider>
  );
}

Dark Mode

Pass darkMode to switch the picker's theme. It's false by default, so existing usage is unaffected.

<DatePickerField
  label="Date of Birth"
  mode="bs"
  value={dob}
  color="#4f46e5"
  darkMode={true}
  onDateSelect={(dates) => {
    /* ... */
  }}
/>

darkMode is fully controlled — the component does not read prefers-color-scheme automatically. If your app has its own theme state (e.g. a Zustand store or context), pass that value straight through:

<DatePickerField darkMode={isDarkMode} ... />

Components

<DatePickerField />

| Prop | Type | Default | Description | | -------------- | ----------------- | -------- | --------------------------------------------------------------- | | mode | 'ad' \| 'bs' | 'ad' | Calendar mode | | value | string | '' | Current value as YYYY-MM-DD | | onDateSelect | (dates) => void | — | Called with { ad, bs, adFormatted, bsFormatted } on selection | | label | string | — | Field label | | required | boolean | false | Shows red asterisk | | error | string | — | Error message shown below input | | readOnly | boolean | false | Disables interaction | | color | string | '#111' | Accent color (hex / CSS color) | | darkMode | boolean | false | Renders the dark theme when true |

<BSADCalendar />

Use this directly if you want the raw calendar without the input wrapper. | Prop | Type | Default | Description | | -------------- | ---------------------- | -------- | ------------------------------------------------------------ | | mode | 'ad' \| 'bs' | 'ad' | Calendar mode | | color | string | '#111' | Accent color | | initialDate | { year, month, day } | null | Pre-selected date | | onDateSelect | (dates) => void | — | Called with { ad, bs, adFormatted, bsFormatted } | | darkMode | boolean | false | Renders the dark theme when true |


The onDateSelect payload

Every selection calls back with both raw date objects and pre-formatted strings, so you don't need to format dates yourself:

{
  ad: { year: 2025, month: 6, day: 8 },
  bs: { year: 2082, month: 2, day: 25 },
  adFormatted: "2025-06-08",
  bsFormatted: "2082-02-25"
}

Utilities

import { adToBs, bsToAd, formatDate } from 'bsad-datepicker';
const bs = adToBs(2025, 6, 8);
// → { year: 2082, month: 2, day: 25 }
const ad = bsToAd(2082, 2, 25);
// → { year: 2025, month: 6, day: 8, dow: 0 }
formatDate(bs);
// → "2082-02-25"

Multiple pickers on one page

CalendarProvider ensures only one calendar is open at a time. Put it once — at your form root or app root.

<CalendarProvider>
<DatePickerField label="Start Date" mode="ad" ... />
<DatePickerField label="End Date"   mode="ad" ... />
<DatePickerField label="BS Date"    mode="bs" ... />
</CalendarProvider>

License

MIT