{/* Leading days from previous month */}
{grid.prevMonth.days.map((d) => (
{d}
))}
{/* Active month days */}
{grid.currentMonth.days.map((d) => (
{d}
))}
{/* Trailing days from next month */}
{grid.nextMonth.days.map((d) => (
{d}
))}
);
}
```
---
## Related
* [`date.daysInMonth()`](/docs/nodejs/methods/days-in-month): Total number of days in the month.
* [`date.getWeeksInMonth()`](/docs/nodejs/methods/get-weeks-in-month): Number of week rows needed.
* [`NepaliDate.isValid()`](/docs/nodejs/static/is-valid): Date validation.
---
## Page: NepaliDate.getDayName() (NodeJS) (/docs/nodejs/static/get-day-name)
Description: [NodeJS] Static utility to retrieve the localized English or Nepali name for any day of the week index. Official API reference and code examples for NodeJS / TypeScript.
The `getDayName` static method converts a numeric weekday index from 0 for Sunday through 6 for Saturday into its localized name. It supports both English and Nepali Devanagari script output, allowing flexible localization across international and local application interfaces.
---
## Import
```typescript
import { NepaliDate } from "nepali-date-library";
```
---
## Signature
```typescript
static getDayName(day: number, short?: boolean, nepali?: boolean): string;
```
---
## Parameters
| Parameter | Type | Required | Default | Description |
| :--- | :--- | :---: | :---: | :--- |
| `day` | `number` | Yes | - | Day of week index (`0-6`, where `0` is Sunday and `6` is Saturday). |
| `short` | `boolean` | No | `false` | When `true`, returns the abbreviated 3-letter or short weekday name. |
| `nepali` | `boolean` | No | `false` | When `true`, returns the weekday name in Devanagari script. |
---
## Return Value
* **Type**: `string`
* Localized day of week name string.
---
## Exceptions
Throws an `Error` if `day` is less than `0` or greater than `6`:
```typescript
"Invalid day index, must be between 0-6"
```
---
## Output Reference Matrix
| Day Index | Default (`short: false, nepali: false`) | Short English (`short: true, nepali: false`) | Nepali Full (`short: false, nepali: true`) | Nepali Short (`short: true, nepali: true`) |
| :---: | :--- | :--- | :--- | :--- |
| `0` | `"Sunday"` | `"Sun"` | `"आइतबार"` | `"आइत"` |
| `1` | `"Monday"` | `"Mon"` | `"सोमबार"` | `"सोम"` |
| `2` | `"Tuesday"` | `"Tue"` | `"मंगलबार"` | `"मंगल"` |
| `3` | `"Wednesday"` | `"Wed"` | `"बुधबार"` | `"बुध"` |
| `4` | `"Thursday"` | `"Thu"` | `"बिहिबार"` | `"बिहि"` |
| `5` | `"Friday"` | `"Fri"` | `"शुक्रबार"` | `"शुक्र"` |
| `6` | `"Saturday"` | `"Sat"` | `"शनिबार"` | `"शनि"` |
---
## Examples
### Generating Weekday Labels for UI
```typescript
import { NepaliDate } from "nepali-date-library";
// Default English
console.log(NepaliDate.getDayName(0)); // "Sunday"
// English Short
console.log(NepaliDate.getDayName(0, true)); // "Sun"
// Nepali Devanagari Full
console.log(NepaliDate.getDayName(0, false, true)); // "आइतबार"
// Nepali Devanagari Short
console.log(NepaliDate.getDayName(0, true, true)); // "आइत"
```
---
## Related
* [`NepaliDate.getMonthName()`](/docs/nodejs/static/get-month-name): Localized month names.
* [`WEEK_EN`](/docs/nodejs/constants/week-en): English week array constant.
* [`WEEK_NP`](/docs/nodejs/constants/week-np): Nepali week array constant.
---
## Page: NepaliDate.getMonthName() (NodeJS) (/docs/nodejs/static/get-month-name)
Description: [NodeJS] Static utility to retrieve the localized English or Nepali month name for any month index. Official API reference and code examples for NodeJS / TypeScript.
The `getMonthName` static method returns the localized name of a Bikram Sambat month given its zero based index from 0 for Baisakh to 11 for Chaitra. It supports full names as well as short abbreviations in both English and Devanagari script.
---
## Import
```typescript
import { NepaliDate } from "nepali-date-library";
```
---
## Signature
```typescript
static getMonthName(month: number, short?: boolean, nepali?: boolean): string;
```
---
## Parameters
| Parameter | Type | Required | Default | Description |
| :--- | :--- | :---: | :---: | :--- |
| `month` | `number` | Yes | - | Zero-indexed month number (`0-11`, where `0` is Baisakh). |
| `short` | `boolean` | No | `false` | When `true`, returns the 3-letter abbreviated name. |
| `nepali` | `boolean` | No | `false` | When `true`, returns the name in Devanagari script. |
---
## Return Value
* **Type**: `string`
* Localized month name string.
---
## Exceptions
Throws an `Error` if `month` is less than `0` or greater than `11`:
```typescript
"Invalid month index, must be between 0-11"
```
---
## Output Reference Matrix
| Month Index | Default (`short: false, nepali: false`) | Short English (`short: true, nepali: false`) | Nepali Full (`short: false, nepali: true`) | Nepali Short (`short: true, nepali: true`) |
| :---: | :--- | :--- | :--- | :--- |
| `0` | `"Baisakh"` | `"Bai"` | `"बैशाख"` | `"बै"` |
| `1` | `"Jestha"` | `"Jes"` | `"जेठ"` | `"जे"` |
| `2` | `"Asar"` | `"Asa"` | `"असार"` | `"अ"` |
| `3` | `"Shrawan"` | `"Shr"` | `"श्रावण"` | `"श्रा"` |
| `4` | `"Bhadra"` | `"Bhd"` | `"भाद्र"` | `"भा"` |
| `5` | `"Aswin"` | `"Asw"` | `"आश्विन"` | `"आ"` |
| `6` | `"Kartik"` | `"Kar"` | `"कार्तिक"` | `"का"` |
| `7` | `"Mangsir"` | `"Man"` | `"मंसिर"` | `"मं"` |
| `8` | `"Poush"` | `"Pou"` | `"पौष"` | `"पौ"` |
| `9` | `"Magh"` | `"Mag"` | `"माघ"` | `"मा"` |
| `10` | `"Falgun"` | `"Fal"` | `"फाल्गुण"` | `"फा"` |
| `11` | `"Chaitra"` | `"Cha"` | `"चैत्र"` | `"चै"` |
---
## Examples
### Generating Localized Month Labels
```typescript
import { NepaliDate } from "nepali-date-library";
// Default English Full
console.log(NepaliDate.getMonthName(0)); // "Baisakh"
// English Short
console.log(NepaliDate.getMonthName(0, true)); // "Bai"
// Nepali Devanagari Full
console.log(NepaliDate.getMonthName(0, false, true)); // "बैशाख"
// Nepali Devanagari Short
console.log(NepaliDate.getMonthName(0, true, true)); // "बै"
```
---
## Related
* [`NepaliDate.getDayName()`](/docs/nodejs/static/get-day-name): Localized weekday names.
* [`MONTH_EN`](/docs/nodejs/constants/month-en): Array constant for English months.
* [`MONTH_NP`](/docs/nodejs/constants/month-np): Array constant for Nepali months.
---
## Page: NepaliDate.isValid() (NodeJS) (/docs/nodejs/static/is-valid)
Description: [NodeJS] Static validation function to verify whether a given year, month, and day combination forms a valid Bikram Sambat date. Official API reference and code examples for NodeJS / TypeScript.
The static `isValid` method verifies whether a specified Bikram Sambat year, month index, and day number represent a real calendar date. It consults verified historical data tables to confirm that the year falls within the supported range of 1976 through 2100 BS and that the day number does not exceed the actual number of days in that specific month.
---
## Import
```typescript
import { NepaliDate } from "nepali-date-library";
```
---
## Signature
```typescript
static isValid(year: number, month: number, day: number): boolean;
```
---
## Parameters
| Parameter | Type | Required | Description |
| :--- | :--- | :---: | :--- |
| `year` | `number` | Yes | Bikram Sambat year (e.g. `2081`). Supported range: `1976` to `2100`. |
| `month` | `number` | Yes | Zero-indexed month (`0-11`, where `0` is Baisakh and `11` is Chaitra). |
| `day` | `number` | Yes | Day of the month (`1-32`). |
---
## Return Value
* **Type**: `boolean`
* Returns `true` if the year is within supported range, month is between `0` and `11`, and day does not exceed the exact number of days in that month; otherwise returns `false`.
---
## Examples
### Pre-validating User Input
```typescript
import { NepaliDate } from "nepali-date-library";
// 2081 Baisakh 31 is valid (Baisakh has 31 days)
console.log(NepaliDate.isValid(2081, 0, 31)); // true
// 2081 Baisakh 32 does not exist
console.log(NepaliDate.isValid(2081, 0, 32)); // false
// Month index must be 0-11
console.log(NepaliDate.isValid(2081, 12, 1)); // false
```
### Form Input Validation Guard
```typescript
import { NepaliDate } from "nepali-date-library";
function createNepaliEvent(y: number, m: number, d: number) {
if (!NepaliDate.isValid(y, m, d)) {
throw new Error(`Invalid Bikram Sambat date: ${y}-${m + 1}-${d}`);
}
return new NepaliDate(y, m, d);
}
```
---
## Related
* [`date.isValid()`](/docs/nodejs/methods/is-valid): Instance method equivalent.
* [`date.daysInMonth()`](/docs/nodejs/methods/days-in-month): Query total days in a month.
---
## Page: NepaliDate.maximum() (NodeJS) (/docs/nodejs/static/maximum)
Description: [NodeJS] Static method returning the maximum supported date boundary for the NepaliDate calendar engine. Official API reference and code examples for NodeJS / TypeScript.
The `maximum` static method returns a native JavaScript Date object representing the latest Gregorian date supported by the library calendar engine. This corresponds to the final day of Chaitra in year 2100 BS and serves as an upper bound for date validation and calendar limits.
---
## Import
```typescript
import { NepaliDate } from "nepali-date-library";
```
---
## Signature
```typescript
static maximum(): Date;
```
---
## Parameters
This method does not take any parameters.
---
## Return Value
* **Type**: `Date`
* Returns a standard JavaScript `Date` instance representing the absolute upper limit of the calendar mapping dataset.
---
## Examples
### Checking Upper Calendar Limit
```typescript
import { NepaliDate } from "nepali-date-library";
const maxDate = NepaliDate.maximum();
console.log(maxDate.toISOString());
// Converting maximum back to NepaliDate
const nepaliMax = new NepaliDate(maxDate);
console.log(nepaliMax.format("YYYY-MM-DD")); // "2100-12-30" (or 31)
```
---
## Related
* [`NepaliDate.minimum()`](/docs/nodejs/static/minimum): Earliest date supported.
* [`NEPALI_DATE_MAP`](/docs/nodejs/constants/nepali-date-map): Calendar map dataset.
---
## Page: NepaliDate.minimum() (NodeJS) (/docs/nodejs/static/minimum)
Description: [NodeJS] Static method returning the minimum supported date boundary for the NepaliDate calendar engine. Official API reference and code examples for NodeJS / TypeScript.
The `minimum` static method returns a native JavaScript Date object representing the earliest Gregorian date supported by the library calendar engine. This corresponds to the first day of Baisakh in year 1976 BS and provides a reliable lower boundary for date pickers and form input validation.
---
## Import
```typescript
import { NepaliDate } from "nepali-date-library";
```
---
## Signature
```typescript
static minimum(): Date;
```
---
## Parameters
This method does not take any parameters.
---
## Return Value
* **Type**: `Date`
* Returns a standard JavaScript `Date` instance representing the minimum boundary (`1919-04-13T00:00:00.000Z`).
---
## Examples
### Checking Lower Calendar Limit
```typescript
import { NepaliDate } from "nepali-date-library";
const minDate = NepaliDate.minimum();
console.log(minDate.toISOString()); // "1919-04-13T00:00:00.000Z"
// Converting minimum back to NepaliDate
const nepaliMin = new NepaliDate(minDate);
console.log(nepaliMin.format("YYYY-MM-DD")); // "1976-01-01"
```
---
## Related
* [`NepaliDate.maximum()`](/docs/nodejs/static/maximum): Latest date supported.
* [`NEPALI_DATE_MAP`](/docs/nodejs/constants/nepali-date-map): Calendar map dataset.
---
## Page: What is Nepali Date? (Origination & Calendar) (/docs/origination)
Description: Deep dive into the origins, history, astronomical foundation, calendar mechanics, and timeline of Bikram Sambat (विक्रम संवत्).
The **Nepali Date** is based on the **Bikram Sambat** (Devanagari: **विक्रम संवत्**, abbreviated as **BS** or **B.S.**), the official national civil calendar of **Nepal**.
Used across all organs of the Nepalese state—from parliamentary legislation and Supreme Court decrees to banking operations, taxation, school academic sessions, and day-to-day citizen records—Bikram Sambat is a sophisticated **solar sidereal calendar** with roots extending over two millennia.
---
## Historical Genesis of Bikram Sambat
### The Founding in 57 BCE
Bikram Sambat originated in **57 BCE (Before Common Era)** in the ancient city of **Ujjain** (in modern Madhya Pradesh, India). According to widespread historical tradition, the era was instituted by **King Vikramaditya of Ujjain** to commemorate his decisive military victory over the invading Saka (Indo-Scythian) forces, liberating the region and relieving the financial debt of his citizens.
Because the era was inaugurated in 57 BCE, Bikram Sambat is approximately **56.7 years ahead** of the Western Gregorian calendar (Common Era / AD).
### Evolution of the Era's Inscriptional Name
Epigraphic and numismatic records show that the name of this calendar era evolved across three distinct phases:
1. **Krita Era (कृत संवत्)**: Earliest stone inscriptions from the 3rd to 5th centuries CE referred to this system as *Krita*, possibly honoring a foundational event or sovereign leader.
2. **Malava Era (मालव संवत्)**: Between the 5th and 9th centuries CE, the era was called *Malava Gana Sambat* (the era of the Malava republic), corresponding to the migration and governance of the Malava tribe.
3. **Vikrama Samvat (विक्रम संवत्)**: By the 9th and 10th centuries CE, starting prominently around the Dholpur stone inscription (dated 842 CE / 898 BS), the era became permanently identified with King Vikramaditya.
---
## The Calendar Eras of Nepal
Nepal has one of the world's richest epigraphic and calendar traditions, having utilized several prominent eras throughout its documented history:
### 1. Saka Sambat (शक संवत् - 78 CE)
Introduced in ancient Nepal during the Licchavi period, the Saka Sambat was the primary calendar of early royal inscriptions. The oldest dated stone epigraph in Nepal—the pillar inscription of **King Manadeva I at the Changu Narayan Temple**—is dated **386 Saka Sambat (464 CE / 521 BS)**.
### 2. Manadeva Sambat / Amshuverma Era (576 CE)
During the late Licchavi period under rulers such as King Amshuverma and King Jisnugupta, a shortened regional calendar system known as the Manadeva Sambat was employed across the Kathmandu Valley for public administration and religious foundations.
### 3. Nepal Sambat (नेपाल संवत् - 879 CE / 936 BS)
Founded by **Shankhadhar Sakhwa** on Kartik Shukla Pratipada in 879 CE after he cleared the debts of all citizens in the Kathmandu Valley during the reign of King Raghavadeva. Nepal Sambat served as the principal civic, lunar, and commercial calendar of the Malla Dynasty (1200–1768 CE) and remains revered today as a national heritage calendar of Nepal.
### 4. Bikram Sambat in Ancient and Medieval Nepal
While Nepal Sambat predominated in the Kathmandu Valley's domestic trade, Bikram Sambat maintained continuous usage across western and northern Nepal:
- In the **Khasa Malla Empire** of the Karnali basin (centered in the Sinja Valley, Jumla), Bikram Sambat was the undisputed official calendar. The **Dullu Stone Pillar of King Prithvi Malla** (located in Dailekh) is engraved in Bikram Sambat **1414 BS (1357 CE)** using the ancient Khas language.
- King Jayasthiti Malla (reigned 1382–1395 CE) and King Pratap Malla of Kathmandu utilized Bikram Sambat alongside Nepal Sambat in stone treaties, temple edicts, and Sanskrit panegyrics.
### 5. Unification and Official Adoption in Nepal (1768–1901 CE)
When **King Prithvi Narayan Shah of Gorkha** unified Nepal and established Kathmandu as the capital in **1825 BS (1768 CE)**, he adopted Bikram Sambat as the standard calendar for royal seals (*Lal Mohar*), military directives, treaties, and administrative governance.
In **1958 BS (1901 CE)**, during the premiership of Rana Prime Minister **Chandra Shumsher Jung Bahadur Rana**, Bikram Sambat was formally promulgated by imperial decree as the **sole official civil and administrative calendar of the Kingdom of Nepal**, standardizing astronomical solar calculations across all government offices.
---
## Chronological Timeline of Events
Explore the two-thousand-year progression of Bikram Sambat from its ancient foundation to its constitutional mandate in modern Nepal: