Skip to content

Repository files navigation

🇳🇵 bsday.js

Ultra-fast, zero-dependency Day.js-compatible dual calendar (Bikram Sambat ↔ Gregorian) SDK and astronomical Panchang engine.

Website npm (core) npm (dataset) bundle size TypeScript license tests

🌐 Official Website & Playground: https://bsdayjs.vercel.app
📖 Full Documentation & API Reference: https://bsdayjs.vercel.app/docs
📅 Calendar Explorer: https://bsdayjs.vercel.app/calendar


📦 Packages

Package Description
@bsday.js/core Ultra-fast (~12KB gzipped), zero-dependency dual calendar SDK with Day.js syntax parity.
@bsday.js/dataset 111-Year (1990–2100 BS / 40,543 days) astronomical Panchang & Nepali festival dataset.
@bsday.js/react Headless React hooks (useNepaliCalendarGrid, useNepaliDatePicker, useNepaliRangePicker).
@bsday.js/vue Headless Vue 3 Composition API composables with v-model binding support.
@bsday.js/angular Headless Angular Signals, services, and Reactive Form ControlValueAccessor Directives.
@bsday.js/svelte Headless Svelte 4/5 reactive stores & runes calendar and datepicker primitives.

⚡ Quick Usage

npm install @bsday.js/core
import bsday from '@bsday.js/core';

// Create explicit BS Date
const date = bsday.bs(2081, 5, 15);

// Format date in English & Devanagari (नेपाली)
console.log(date.format('YYYY/MM/DD')); // "2081/05/15"
console.log(date.locale('ne').format('YYYY MMMM DD, dddd')); // "२०८१ भाद्र १५, शनिबार"

// Convert to Gregorian AD Date
const adDate = date.toAD(); // JavaScript Date: 2024-08-31

// Nepali Fiscal Year Engine (आर्थिक वर्ष)
console.log(date.fiscalYear('extended')); // "FY 2081/82"

💡 For complete API reference, React / Next.js recipes, and guides, visit the official documentation.


🛠️ Local Development & Setup

This repository is a monorepo managed with pnpm workspaces.

Prerequisites

  • Node.js: >= 20.0.0
  • pnpm: >= 10.0.0

1. Clone & Install Dependencies

git clone https://github.com/shurajcodx/bsday.js.git
cd bsday.js

# Install dependencies across all packages
pnpm install

2. Available Commands

You can run commands directly using pnpm or via the provided Makefile:

Task pnpm Command Make Shortcut Description
Run All Checks pnpm run typecheck && pnpm run lint && pnpm run test make check Runs full formatting, linting, typechecking, tests, and builds.
Build Packages pnpm run build make build Builds @bsday.js/core and @bsday.js/dataset using tsup.
Run Tests pnpm run test make test Runs unit and accuracy test suites via vitest.
Type Check pnpm run typecheck make typecheck Type-checks all TypeScript packages with --noEmit.
Lint Code pnpm run lint make lint Runs ESLint across all workspace packages.
Format Code pnpm run format make format Formats all files using Prettier.
Check Formatting pnpm run format:check make format-check Verifies code style compliance without modifying files.
Run Benchmarks pnpm run benchmark make benchmark Runs operations-per-second performance suite.
Release & Merge make release Merges development into master, tags v<version>, and pushes to origin.

📁 Repository Structure

bsday.js/
├── packages/
│   ├── core/                  # @bsday.js/core (~12KB gzipped dual calendar engine)
│   │   ├── src/               # BSDay class, converters, fiscal year, KYC age, calendar grid
│   │   └── tests/             # Unit tests
│   └── dataset/               # @bsday.js/dataset (111-Year Panchang & festival data)
│       ├── src/               # Raw JSON data (1990-2100), Panchang engine, translation
│       ├── ephe/              # Swiss Ephemeris astronomical tables
│       ├── scripts/           # Data generation, validation, and aggregation scripts
│       └── tests/             # Panchang accuracy & structure tests
├── docs/                      # Developer documentation & framework integration recipes
├── scripts/                   # Distribution verification & performance benchmark scripts
├── Makefile                   # Development & release automation shortcuts
└── .github/                   # CI/CD workflows and issue templates

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Please review our Contributing Guide and Code of Conduct before submitting a PR.


📄 License

Distributed under the MIT License. See LICENSE for more information.

About

Modern TypeScript/JavaScript SDK for Bikram Sambat (BS) ↔ Gregorian (AD), with date manipulation, Nepali fiscal years, localization, calendars, and Panchang data.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages