Bikram Sambat for JavaScript
Nepali calendar conversion and date pickers for React and React Native. The calendar table is generated from the Yorion engine and checked against it for every day in the supported range.
On npm: @inicrea/bikram-sambat-core · @inicrea/bikram-sambat-react · @inicrea/bikram-sambat-react-native
Convert a date
Type into either field and the other follows; select a day in the calendar to send it here.
How the calendar behaves
Each cell carries both calendars
The Bikram Sambat day is set large with its Gregorian day in the corner, the way a printed patro does, so you can read across without converting in your head.
Weekends change over time
Nepal moved from a Saturday-only weekend to Saturday and Sunday on 2026-04-12 (BS 2082-12-29). Navigate to Chaitra 2082 and the grid changes behaviour mid-month.
Month lengths have no formula
Nepali months run 29 to 32 days, set by the almanac rather than a rule. That is why the table is generated rather than typed by hand.
This runs the real package
Everything on this page is @inicrea/bikram-sambat-core
running in your browser, not a reimplementation.
Packages
The conversion lives in one place. Install the package for your platform and it brings the core with it.
| Package | Contents | Size |
|---|---|---|
| @inicrea/bikram-sambat-core | Conversion, formatting, month grids, arithmetic, Nepali fiscal years. Runs in Node, browsers, edge runtimes and Hermes. | 4.9 kB |
| @inicrea/bikram-sambat-react | Date picker, inline calendar and converter. Keyboard-navigable grid, CSS-variable theming, ships "use client". |
5.5 kB |
| @inicrea/bikram-sambat-react-native | The same three components on React Native primitives. No WebAssembly and no native modules, so Expo Go works unmodified. | 4.6 kB |
Sizes are gzipped ESM builds. The two UI packages exclude the core they depend on, and exclude React itself.
Usage
Values move as "YYYY-MM-DD" strings. Gregorian by default,
since that is the safer thing to store.
// React
import { BikramDatePicker } from '@inicrea/bikram-sambat-react';
import '@inicrea/bikram-sambat-react/styles.css';
<BikramDatePicker value={date} onChange={setDate} />
// Node, browser, React Native, edge import { adToBs, formatBs } from '@inicrea/bikram-sambat-core'; adToBs('2026-08-20'); // { year: 2083, month: 5, day: 4 } formatBs(bs, 'YYYY MMMM DD', { locale: 'ne' }); // '२०८३ भदौ ०४'
Range and verification
Dates outside the supported range throw a BikramRangeError
rather than returning a wrong result.
| Bikram Sambat range | 1975-01-01 to 2100-12-30 |
| Gregorian range | 1918-04-13 to 2044-04-12 |
| Days verified, both directions | 46,022 |
| Calendar table | 1,512 chars |
| Runtime dependencies | 0 |
The table is regenerated and re-verified in CI, so a hand-edit or an engine change fails the build instead of shipping. Nepali month lengths have no closed form, which makes a hand-maintained table a standing correctness risk, generating it removes that whole class of bug.