Skip to main content

NepaliDate

@brightsoftware/date-np


@brightsoftware/date-np / src / NepaliDate

Class: NepaliDate

Defined in: src/NepaliDate.ts:10

NepaliDate class for handling Nepali (Bikram Sambat) dates This class provides Date-like functionality but works with the Nepali calendar system

Methods

addDays()

addDays(days): NepaliDate

Defined in: src/NepaliDate.ts:197

Add days to the current date

Parameters

days

number

Returns

NepaliDate


addMonths()

addMonths(months): NepaliDate

Defined in: src/NepaliDate.ts:207

Add months to the current date

Parameters

months

number

Returns

NepaliDate


addYears()

addYears(years): NepaliDate

Defined in: src/NepaliDate.ts:217

Add years to the current date

Parameters

years

number

Returns

NepaliDate


clone()

clone(): NepaliDate

Defined in: src/NepaliDate.ts:281

Create a clone of this date

Returns

NepaliDate


compare()

compare(other): number

Defined in: src/NepaliDate.ts:237

Compare this date with another date Returns: -1 if this < other, 0 if equal, 1 if this > other

Parameters

other

NepaliDate

Returns

number


equals()

equals(other): boolean

Defined in: src/NepaliDate.ts:227

Check if this date equals another date

Parameters

other

NepaliDate

Returns

boolean


getDate()

getDate(): number

Defined in: src/NepaliDate.ts:119

Get the date

Returns

number


getDay()

getDay(): number

Defined in: src/NepaliDate.ts:127

Get the day of the week (0 = Sunday, 6 = Saturday) This converts to AD date to get the correct day

Returns

number


getDaysInMonth()

getDaysInMonth(): number

Defined in: src/NepaliDate.ts:159

Get the number of days in the current month

Returns

number


getDaysInMonthOf()

getDaysInMonthOf(month): number

Defined in: src/NepaliDate.ts:169

Get the number of days in a specific month of the current year

Parameters

month

number

Returns

number


getFirstDayOfMonth()

getFirstDayOfMonth(): NepaliDate

Defined in: src/NepaliDate.ts:182

Create a new NepaliDate with the first day of the current month

Returns

NepaliDate


getFullYear()

getFullYear(): number

Defined in: src/NepaliDate.ts:105

Get the year (BS)

Returns

number


getLastDayOfMonth()

getLastDayOfMonth(): NepaliDate

Defined in: src/NepaliDate.ts:189

Create a new NepaliDate with the last day of the current month

Returns

NepaliDate


getMonth()

getMonth(): number

Defined in: src/NepaliDate.ts:112

Get the month (0-based, like JavaScript Date)

Returns

number


setDate()

setDate(date): void

Defined in: src/NepaliDate.ts:151

Set the date

Parameters

date

number

Returns

void


setFullYear()

setFullYear(year): void

Defined in: src/NepaliDate.ts:135

Set the year

Parameters

year

number

Returns

void


setMonth()

setMonth(month): void

Defined in: src/NepaliDate.ts:143

Set the month (0-based)

Parameters

month

number

Returns

void


toADDate()

toADDate(): Date

Defined in: src/NepaliDate.ts:253

Convert to AD Date

Returns

Date


toString()

toString(): string

Defined in: src/NepaliDate.ts:274

String representation

Returns

string


fromADDate()

static fromADDate(adDate): NepaliDate

Defined in: src/NepaliDate.ts:260

Create NepaliDate from AD Date

Parameters

adDate

Date

Returns

NepaliDate


today()

static today(): NepaliDate

Defined in: src/NepaliDate.ts:267

Get today's Nepali date

Returns

NepaliDate