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-cal/datepicker

v1.0.2

Published

Fully customizable Nepali (Bikram Sambat) DatePicker for React. Theming, composition, and BS/AD switching out of the box.

Readme

@nepali-cal/datepicker

Fully customizable Nepali (Bikram Sambat) DatePicker system for React. Supports BS/AD calendar conversion, range selection, input mode, theming, and composable calendar primitives.

Built on top of @nepali-cal/core.


Installation

pnpm add @nepali-cal/datepicker @nepali-cal/core

Styles

You must import styles manually:

import "@nepali-cal/datepicker/styles";

Features

  • Bikram Sambat (BS) calendar support
  • Gregorian (AD) conversion support
  • Fully controlled & uncontrolled modes
  • Date range selection
  • Input-based date entry
  • Popover-based picker
  • Custom render APIs
  • Theme variables support
  • Week-start customization
  • Min/Max date constraints
  • External styling via data attributes
  • No runtime dependencies except React

Core Components

1. Calendar

Base calendar component.

import { Calendar } from "@nepali-cal/datepicker";

Props

| Prop | Type | Description | | --------------- | -------------- | ----------------------- | | selected | BSDateValue | Selected date | | onDayClick | (date) => void | Day click handler | | minDate | BSDateValue | Minimum selectable date | | maxDate | BSDateValue | Maximum selectable date | | locale | 'en' or 'ne' | Language | | showFooter | boolean | Footer visibility | | showTodayButton | boolean | Show Today button | | weekStartDay | 0-6 | Start weekday | | theme | object | CSS variables |


2. DatePicker

Popover-based single date picker.

import { DatePicker } from "@nepali-cal/datepicker";

Basic Usage

<DatePicker onChange={(date) => console.log(date)} />

Controlled Usage

<DatePicker value={value} onChange={setValue} />

Props

| Prop | Type | Description | | ------------- | ------------ | ----------------- | | value | BSDateValue | Controlled value | | defaultValue | BSDateValue | Initial value | | onChange | fn | Change handler | | placeholder | string | Input placeholder | | minDate | BSDateValue | Min date | | maxDate | BSDateValue | Max date | | locale | 'en' or 'ne' | Language | | displayFormat | string | Format pattern | | closeOnSelect | boolean | Auto close | | placement | string | Popover position | | theme | object | CSS variables | | renderTrigger | fn | Custom trigger |


3. DateRangePicker

Dual calendar range selection.

import { DateRangePicker } from "@nepali-cal/datepicker";

Usage

<DateRangePicker onChange={({ from, to }) => console.log(from, to)} />

Props

| Prop | Type | | -------------- | ------------ | | value | { from, to } | | onChange | fn | | numberOfMonths | number | | placeholder | { from, to } | | minDate | BSDateValue | | maxDate | BSDateValue |


4. NepaliInput

Text input with optional calendar.

import { NepaliInput } from "@nepali-cal/datepicker";

Usage

<NepaliInput onChange={(date) => console.log(date)} />

Calendar Grid System

CalendarGrid

Low-level day grid renderer.

<CalendarGrid
  year={2081}
  month={5}
  onDayClick={...}
/>

Supports:

  • Custom day render
  • Range highlighting
  • Disabled dates
  • Outside month rendering
  • Hover state
  • Week start control

CalendarHeader

Month/year navigation header.

<CalendarHeader
  year={2081}
  month={5}
  onPrevMonth={...}
  onNextMonth={...}
/>

Supports:

  • Custom header rendering
  • Custom nav buttons
  • Year navigation toggle

Types

BSDateValue

type BSDateValue = {
  year: number;
  month: number;
  day: number;
};

DateRangeValue

type DateRangeValue = {
  from: BSDateValue | null;
  to: BSDateValue | null;
};

Core Utilities (from @nepali-cal/core)

import {
  todayBS,
  bsToAD,
  bsMonthDays,
  buildCalendarGrid,
} from "@nepali-cal/core";

todayBS()

Returns current BS date.


bsToAD()

Converts BS → AD.


bsMonthDays(year, month)

Returns number of days in BS month.


buildCalendarGrid()

Generates calendar grid structure.


Theming

Uses CSS variables injected via theme prop.

<DatePicker
  theme={{
    "--ncal-primary": "#000",
    "--ncal-bg": "#fff",
  }}
/>

Styling System

All components expose data-ncal-* attributes:

Examples

[data-ncal-trigger] {
  padding: 8px;
}

[data-ncal-day] {
  border-radius: 6px;
}

[data-selected] {
  background: black;
  color: white;
}

Calendar Systems

Supports:

  • BS (Bikram Sambat)
  • AD (Gregorian view inside BS grid)

Toggle available in Calendar footer.


Localization

locale: "en" | "ne";
  • English labels
  • Nepali (Devanagari) numerals + month names

Range Selection Behavior

  • First click → start date
  • Second click → end date
  • Reverse selection auto-corrected
  • Hover preview supported

Input Format

YYYY-MM-DD (BS format)

Example:

2062-05-05

Accessibility

  • aria-label on trigger
  • aria-current="date" for today
  • Keyboard navigation support on buttons
  • Dialog role on popover

Exports

import {
  DatePicker,
  DateRangePicker,
  Calendar,
  NepaliInput,
  CalendarGrid,
  CalendarHeader,
} from "@nepali-cal/datepicker";

Styles:

import "@nepali-cal/datepicker/styles";