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

bs-ad-calendar-react

v1.2.0

Published

A modern React calendar component supporting both Bikram Sambat (BS) and Gregorian (AD) calendars

Readme

BS-AD Calendar

A modern React calendar component for seamless conversion between Bikram Sambat (BS) and Gregorian (AD) calendars.

npm version License: MIT

Live Demo

View Demo

Key Feature

Select any date → Get both BS and AD dates automatically

Input: Click Poush 15, 2081 (BS)
Output: { bs: "2081-09-15", ad: "2024-12-31", formatted: {...} }

Features

  • Automatic dual calendar conversion
  • Single date and range selection
  • Customizable themes and colors
  • Nepali localization
  • Keyboard navigation
  • Responsive design
  • TypeScript support
  • Accessible (ARIA labels)

Installation

npm install bs-ad-calendar-react

Examples

Basic Calendar

import { Calendar } from 'bs-ad-calendar-react'

export default function App() {
  return (
    <Calendar
      calendarType="BS"
      onDateSelect={(date) => console.log(date)}
    />
  )
}

Output:

{
  bs: "2081-09-15",
  ad: "2024-12-31",
  formatted: {
    bs: "Poush 15, 2081",
    ad: "December 31, 2024"
  }
}

Range Selection

<Calendar
  calendarType="BS"
  mode="range"
  showRangePresets
  onRangeSelect={(range) => console.log(range)}
/>

Output:

{
  start: { year: 2081, month: 8, day: 1 },
  end: { year: 2081, month: 8, day: 30 }
}

Range Presets with Filtering

import { Calendar, PRESET_KEYS } from 'bs-ad-calendar-react'

<Calendar
  calendarType="BS"
  mode="range"
  showRangePresets
  rangePresetsPosition="left"
  presetKeys={[
    PRESET_KEYS.LAST_7_DAYS,
    PRESET_KEYS.LAST_30_DAYS,
    PRESET_KEYS.THIS_MONTH,
    PRESET_KEYS.LAST_MONTH
  ]}
  onRangeSelect={(range) => console.log(range)}
/>

Custom Preset Labels

import { Calendar, PRESET_KEYS } from 'bs-ad-calendar-react'

<Calendar
  calendarType="AD"
  mode="range"
  showRangePresets
  presetKeys={[
    PRESET_KEYS.LAST_7_DAYS,
    PRESET_KEYS.LAST_30_DAYS,
    PRESET_KEYS.THIS_MONTH
  ]}
  presetLabels={{
    [PRESET_KEYS.LAST_7_DAYS]: 'Past Week',
    [PRESET_KEYS.LAST_30_DAYS]: 'Past Month',
    [PRESET_KEYS.THIS_MONTH]: 'Current Month'
  }}
  onRangeSelect={(range) => console.log(range)}
/>

DatePicker Input

import { DatePicker } from 'bs-ad-calendar-react'

export default function App() {
  return (
    <DatePicker
      calendarType="AD"
      placeholder="Select a date"
      onDateSelect={(date) => console.log(date)}
    />
  )
}

Nepali Localization

<Calendar
  calendarType="BS"
  showNepaliMonths
  showNepaliDays
  showNepaliNumbers
  onDateSelect={(date) => console.log(date)}
/>

Custom Colors

<Calendar
  calendarType="BS"
  colors={{
    primary: '#10b981',
    selected: '#059669',
    today: '#d1fae5'
  }}
  onDateSelect={(date) => console.log(date)}
/>

Dark Theme

<Calendar
  calendarType="BS"
  theme="dark"
  onDateSelect={(date) => console.log(date)}
/>

Date Constraints

<Calendar
  calendarType="AD"
  minDate="2024-01-01"
  maxDate="2024-12-31"
  onDateSelect={(date) => console.log(date)}
/>

Disabled State

<Calendar
  calendarType="BS"
  disabled
  onDateSelect={(date) => console.log(date)}
/>

API Reference

Calendar Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | calendarType | 'BS' \| 'AD' | 'AD' | Calendar type | | mode | 'single' \| 'range' | 'single' | Selection mode | | onDateSelect | (date: DateOutput) => void | - | Date callback | | onRangeSelect | (range: DateRange) => void | - | Range callback | | showToday | boolean | true | Highlight today | | disabled | boolean | false | Disable interaction | | minDate | string | - | Min selectable date | | maxDate | string | - | Max selectable date | | theme | 'light' \| 'dark' | 'light' | Theme | | colors | ColorConfig | - | Custom colors | | showNepaliMonths | boolean | false | Nepali months | | showNepaliDays | boolean | false | Nepali days | | showNepaliNumbers | boolean | false | Nepali numbers | | showRangePresets | boolean | false | Show presets | | rangePresetsPosition | 'top' \| 'right' \| 'bottom' \| 'left' | 'top' | Preset position | | presetKeys | string[] | - | Filter presets | | presetLabels | Record<string, string> | - | Rename presets | | predefinedRanges | PredefinedRange[] | - | Custom presets |

DatePicker Props

Extends Calendar props plus:

| Prop | Type | Default | Description | |------|------|---------|-------------| | placeholder | string | 'Select date' | Input placeholder | | inputClassName | string | - | Input CSS class | | popupClassName | string | - | Popup CSS class |

Output Format

{
  bs: "2081-09-15",
  ad: "2024-12-31",
  formatted: {
    bs: "Poush 15, 2081",
    ad: "December 31, 2024"
  }
}

Keyboard Navigation

  • Arrow Left/Right - Navigate months
  • Arrow Up/Down - Navigate years
  • PageUp/PageDown - Navigate months
  • Shift + PageUp/PageDown - Navigate years

Browser Support

Chrome, Firefox, Safari, Edge (latest versions)

TypeScript

import type { DateOutput, DateRange, CalendarProps } from 'bs-ad-calendar-react'
import { PRESET_KEYS } from 'bs-ad-calendar-react'

Available Preset Keys

PRESET_KEYS.TODAY           // Today
PRESET_KEYS.YESTERDAY       // Yesterday
PRESET_KEYS.THIS_WEEK       // This Week
PRESET_KEYS.LAST_7_DAYS     // Last 7 Days
PRESET_KEYS.LAST_30_DAYS    // Last 30 Days
PRESET_KEYS.THIS_MONTH      // This Month
PRESET_KEYS.LAST_MONTH      // Last Month
PRESET_KEYS.LAST_3_MONTHS   // Last 3 Months
PRESET_KEYS.LAST_6_MONTHS   // Last 6 Months
PRESET_KEYS.LAST_9_MONTHS   // Last 9 Months
PRESET_KEYS.LAST_180_DAYS   // Last 180 Days
PRESET_KEYS.LAST_YEAR       // Last Year (12 months)

License

MIT © Bibek Amatya

Links