Nepali DateNepali DateBikram Sambat Date Engine

Installation & Setup

Installation and setup guide for the nepali date library in Node.js and TypeScript applications using standard package managers.

The nepali date library is distributed as a lightweight npm package compatible with modern JavaScript runtimes including Node.js, Bun, and Deno. It provides native TypeScript type definitions out of the box with zero runtime dependencies, making setup fast across all standard package managers.


Package Installation

pnpm add nepali-date-library

Import Syntax

The package supports both ECMAScript Modules (ESM) and CommonJS (CJS) natively.

ECMAScript Modules (TypeScript / Modern JS)

import { NepaliDate, ADtoBS, BStoAD } from "nepali-date-library";

// or default import
import NepaliDate from "nepali-date-library";

CommonJS

const { NepaliDate, ADtoBS, BStoAD } = require("nepali-date-library");

// or default require
const NepaliDate = require("nepali-date-library");

TypeScript Configuration

nepali-date-library is written in TypeScript and ships with bundled type definitions (.d.ts). No additional @types/ packages are required.

Recommended tsconfig.json compiler options:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "esModuleInterop": true
  }
}

Zero Dependencies

The package has 0 runtime external dependencies. It contains all astronomical calendar mappings, formatting tokens, and date arithmetic routines internally, guaranteeing small bundle size and zero transitive vulnerability risks.

Advertisement

On this page