Nepali DateNepali DateBikram Sambat Date Engine
Class

Instance Properties

Reference for public instance properties available on every NepaliDate object including year, month, day, and underlying timestamp.

Every NepaliDate instance provides direct read access to its core calendar coordinates through public properties. These include the four digit Bikram Sambat year, the month number indexed from 0 to 11, the day of the month from 1 to 32, and the underlying UTC timestamp stored as a native JavaScript Date object. These properties reflect the current state of the date instance after any modifications or arithmetic operations.


Property Reference

PropertyTypeDescriptionRange
yearnumberThe Bikram Sambat year.1976 – 2100
monthnumberThe 0-indexed Bikram Sambat month.0 (Baisakh) – 11 (Chaitra)
daynumberThe day of the month.1 – 32
timestampDateThe corresponding native JavaScript Date object in UTC.Equivalent Gregorian timestamp

Examples

Reading Properties Directly

import { NepaliDate } from "nepali-date-library";

const date = new NepaliDate("2081-07-15");

console.log(date.year);      // 2081
console.log(date.month);     // 6 (0-indexed: 6 corresponds to Kartik)
console.log(date.day);       // 15
console.log(date.timestamp); // 2024-10-31T00:00:00.000Z

Direct Property vs. Method Access

While properties are public for inspection, it is recommended to use dedicated methods for formatting and mutation:

import { NepaliDate } from "nepali-date-library";

const date = new NepaliDate("2081-07-15");

// Using methods for formatted values
console.log(date.getDate()); // 15
console.log(date.getMonth() + 1); // 7 (1-indexed display)

// Using methods to mutate coordinates safely
date.setDate(16); // Safely validates days in month and recalculates timestamp

Advertisement

On this page