Skip to content

Constants

The library exports several constants for month names, weekday names, and the complete date mapping table.

Import

python
from nepali_date_library import (
    # Month names
    month_en,
    month_np,
    month_short_en,
    month_short_np,

    # Weekday names
    week_en,
    week_np,
    week_short_en,
    week_short_np,

    # Date map
    nepali_date_map,
)

Month Names

month_en

Full English transliterated month names.

python
month_en = [
    "Baisakh",
    "Jestha",
    "Asar",
    "Shrawan",
    "Bhadra",
    "Aswin",
    "Kartik",
    "Mangsir",
    "Poush",
    "Magh",
    "Falgun",
    "Chaitra",
]

Example:

python
print(month_en[0])  # 'Baisakh'
print(month_en[9])  # 'Magh'
print(month_en[11]) # 'Chaitra'

month_short_en

Short English month names (3 characters).

python
month_short_en = [
    "Bai",
    "Jes",
    "Asa",
    "Shr",
    "Bhd",
    "Asw",
    "Kar",
    "Man",
    "Pou",
    "Mag",
    "Fal",
    "Cha",
]

month_np

Full Nepali month names in Devanagari script.

python
month_np = [
    "बैशाख",
    "जेठ",
    "असार",
    "श्रावण",
    "भाद्र",
    "आश्विन",
    "कार्तिक",
    "मंसिर",
    "पौष",
    "माघ",
    "फाल्गुण",
    "चैत्र",
]

Example:

python
print(month_np[0]) # 'बैशाख'
print(month_np[9]) # 'माघ'

month_short_np

Short Nepali month names.

python
month_short_np = [
    "बै",
    "जे",
    "अ",
    "श्रा",
    "भा",
    "आ",
    "का",
    "मं",
    "पौ",
    "मा",
    "फा",
    "चै",
]

Month Reference Table

Indexmonth_enmonth_short_enmonth_npmonth_short_np
0BaisakhBaiबैशाखबै
1JesthaJesजेठजे
2AsarAsaअसार
3ShrawanShrश्रावणश्रा
4BhadraBhdभाद्रभा
5AswinAswआश्विन
6KartikKarकार्तिकका
7MangsirManमंसिरमं
8PoushPouपौषपौ
9MaghMagमाघमा
10FalgunFalफाल्गुणफा
11ChaitraChaचैत्रचै

Weekday Names

week_en

Full English day names.

python
week_en = [
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
]

Example:

python
from nepali_date_library import NepaliDate
day_index = NepaliDate().get_day()
print(week_en[day_index]) # e.g. 'Wednesday'

week_short_en

Short English day names (3 characters).

python
week_short_en = [
    "Sun",
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
]

week_np

Full Nepali day names in Devanagari script.

python
week_np = [
    "आइतबार",
    "सोमबार",
    "मंगलबार",
    "बुधबार",
    "बिहिबार",
    "शुक्रबार",
    "शनिबार",
]

week_short_np

Short Nepali day names.

python
week_short_np = [
    "आइत",
    "सोम",
    "मंगल",
    "बुध",
    "बिहि",
    "शुक्र",
    "शनि",
]

Weekday Reference Table

Indexweek_enweek_short_enweek_npweek_short_np
0SundaySunआइतबारआइत
1MondayMonसोमबारसोम
2TuesdayTueमंगलबारमंगल
3WednesdayWedबुधबारबुध
4ThursdayThuबिहिबारबिहि
5FridayFriशुक्रबारशुक्र
6SaturdaySatशनिबारशनि

Date Map

nepali_date_map

Complete mapping of days in each month for years BS 1976-2100.

python
# The structure of the date map
nepali_date_map = [
    {
        "year": 1976,
        "days": [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
        "totalDays": 366,
        "daysTillNow": ... # Total days from epoch
    },
    # ... more years ...
]

Example Usage:

python
from nepali_date_library import nepali_date_map

# Get month lengths for a specific year (e.g., 2082)
# The first year in the map is 1976, so year - 1976 gets the index
year_data = nepali_date_map[2082 - 1976]
print(year_data["days"])
# [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]

# Days in Magh 2082 (month index 9)
print(year_data["days"][9]) # 29

# Total days in 2082
print(year_data["totalDays"]) # 365

Month Length Variations

Nepali months have varying lengths (29-32 days) depending on the year:

MonthMin DaysMax DaysTypical
Baisakh303131
Jestha313231-32
Asar313231-32
Shrawan313232
Bhadra313231-32
Aswin303130-31
Kartik293029-30
Mangsir293029-30
Poush293029-30
Magh293029-30
Falgun293029-30
Chaitra303130-31

WARNING

Never hardcode month lengths! Always use NepaliDate().days_in_month() or the date map to get accurate values.


Using Constants for Custom Formatting

python
from nepali_date_library import NepaliDate, month_en, month_np, week_en, week_np

def format_date_custom(date: NepaliDate, nepali: bool = False) -> str:
    months = month_np if nepali else month_en
    days = week_np if nepali else week_en

    return f"{days[date.get_day()]}, {months[date.get_month()]} {date.get_date()}, {date.get_year()}"

date = NepaliDate(2082, 10, 15)
print(format_date_custom(date)) # 'Wednesday, Magh 15, 2082'
print(format_date_custom(date, True)) # 'बुधबार, माघ 15, 2082'

Released under the MIT License.