nepali-date-library
v1.1.13
Published
A Nepali Date Library for both typescript and javascript
Maintainers
Readme
NepaliDate Library
Overview
NepaliDate is a lightweight, high-performance library for working with Nepali (Bikram Sambat) dates in modern TypeScript and JavaScript environments. It provides seamless conversion between BS and Gregorian (AD) dates, support for fiscal years, quarters, and comprehensive formatting options.
Features
- 🚀 Zero Dependency: Pure TypeScript/JavaScript implementation with no external dependencies.
- ⚙️ Dual Environment: Fully compatible with both Node.js and Browsers.
- ⚡ High Performance: Optimized algorithms for date conversion and range verification.
- 🛡️ Extensive Coverage: Supports dates from 1976/01/01 BS to 2100/12/31 BS.
- ⏱️ Flexible Formatting: Robust formatting system (e.g.,
YYYY-MM-DD,DD MMMM YYYY). - 🌿 Fiscal Support: Built-in logic for Nepali fiscal years and quarters.
Installation
npm install nepali-date-library
# or
pnpm add nepali-date-libraryQuick Start
Basic Usage in your project:
import { NepaliDate, ADtoBS, BStoAD } from "nepali-date-library"; // Create a new Nepali Date (current time) const now = new NepaliDate(); console.log(now.format("YYYY-MM-DD")); // e.g., 2081-11-28 // Convert AD to BS const bsDate = ADtoBS("2024-03-14"); console.log(bsDate); // 13-12-11 (example)Parsing & Formatting:
const date = new NepaliDate("2080-01-01"); console.log(date.format("DD MMMM YYYY")); // 01 Baisakh 2080Automation: Use NepaliDate in your automated tasks or backend services with full type safety.
📚 Documentation
For a deep dive into all available methods, conversion logic, and advanced configurations, visit our Official Wiki.
Contributing
Contributions are welcome! Whether it's optimization, feature suggestions, or bug reports, please see our CONTRIBUTING.md for details.
