Nepali DateNepali DateBikram Sambat Date Engine
Static Methods

NepaliDate.getDayName()

Static utility to retrieve the localized English or Nepali name for any day of the week index.

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

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

Signature

static getDayName(day: number, short?: boolean, nepali?: boolean): string;

Parameters

ParameterTypeRequiredDefaultDescription
daynumberYes-Day of week index (0-6, where 0 is Sunday and 6 is Saturday).
shortbooleanNofalseWhen true, returns the abbreviated 3-letter or short weekday name.
nepalibooleanNofalseWhen 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:

"Invalid day index, must be between 0-6"

Output Reference Matrix

Day IndexDefault (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

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)); // "आइत"

Advertisement

On this page