Introduction By Rohan Adhikari

Nepali Datepicker is the Ultimate Date Selection Tool with 70+ Features with including Nepali Functions!

Welcome to the world of NepaliDatePicker, a powerful JavaScript plugin designed to enhance date selection in Nepali language and culture. With its latest version, v0.0.1, this plugin brings you an array of robust features specifically tailored to meet the unique requirements of the Nepali calendar system.

NepaliDatePicker v0.0.1 is the result of meticulous development and attention to detail. Packed with over 70 exciting features, this plugin offers a seamless and user-friendly experience for date selection in the Nepali language. Whether you are building a website, web application, or any digital platform that incorporates Nepali calendars, this plugin will undoubtedly be a valuable asset in your development toolkit.

Let's explore some of the key features that make the Nepali Datepicker Plugin stand out:

  1. Nepali Calendar Support: This plugin is built from the ground up to support the Nepali calendar system, providing accurate and reliable date conversions.
  2. Date Selection: Users can effortlessly select Nepali dates using an interactive and visually appealing datepicker interface.
  3. Multiple Date Selection: The plugin offers the option to make multiple date selectable simultaneously, ensuring flexibility for users familiar.
  4. Customizable Themes: Tailor the look and feel of the datepicker to match your website's design by choosing pre-defined themes or by customizing the CSS as well as JS.
  5. Localization: The plugin supports multiple languages, making it accessible to a broader audience. It includes localization for English and Nepali, with the ability to add more languages easily.
  6. Range Selection: Enable users to select date ranges effortlessly, facilitating tasks such as booking systems, event scheduling, or any scenario requiring a span of dates.
  7. Keyboard Navigation: Navigate through the datepicker using keyboard shortcuts, improving accessibility and convenience for users.
  8. Time Selection: Extend the functionality beyond just dates by incorporating time selection capabilities for more advanced use cases.
  9. Callback Functions: Utilize callback functions to perform specific actions when a date is selected or changed, allowing for seamless integration with your application's logic.
  10. Nepali Functions: This plugin includes a comprehensive set of Nepali functions, empowering developers to perform various date-related operations within their applications easily.
And that's just the tip of the iceberg! With over 70 features packed into this plugin, you can be confident that it will cater to all your date selection needs while seamlessly integrating into your existing codebase.

Whether you're building a personal blog, e-commerce platform, or enterprise-grade application, the Nepali Datepicker JavaScript Plugin v0.0.1 provides the tools and flexibility you require. Say goodbye to date-related headaches and embrace the power of a dedicated Nepali datepicker solution.

Download and integrate the Nepali Datepicker JavaScript Plugin v0.0.1 into your project today, and unlock a world of possibilities for your Nepali users!


Github Code Example:

Grab the sample file to intigrate Nepali datepicker with source file from our Github repository.

Installation

You can install NepaliDatePicker v0.0.1 by the following ways:

  1. By downloading our plugin
  2. By using our CDN(Content Delivery Network)

Download the Plugin

You can download the plugin directly from the Github repository. Once downloaded, include the plugin file in your project directory.

<html>
<head>
    <link href="Nepali-datepicker.min.css" rel="stylesheet">
</head>
<body>
     <script src="https://code.jquery.com/jquery-3.7.0.min.js"
        integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
     <script src="Nepali-datepicker.min.js"></script>
</body>
</html>

CDN

Include the following script tag in your HTML file:

<html>
<head>
    <link href="https://cdn.rohan.info.np/NepaliDatePicker/Nepali-datepicker.min.css" rel="stylesheet">
</head>
<body>
     <script src="https://code.jquery.com/jquery-3.7.0.min.js"
        integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
     <script src="https://cdn.rohan.info.np/NepaliDatePicker/Nepali-datepicker.min.js"></script>
</body>
</html>

Usage

To use NepaliDatePicker in your project, follow these steps:

  1. Add a text input field to your HTML file with a class name datepicker-her.
  2. <input class="datepicker-here" type="text">
  3. Add attributes if needed to change working behaviour of Datepicker. For Nepali Datepicker attributes refer to Atrributes Doc. Example:
  4. <input class="datepicker-here" type="text" data-language="nep" data-position="bottom left">
  5. Or you can also change its function dynamicly as like below:
  6. $("#datepickerExample").datepicker({ language: "nep", minDate: NepaliFunctions.GetCurrentBsDate() });
  7. That's it! The Nepali datepicker is now ready for use.

Features

To customize the working of datepicker according to you need, We provide various features. you can define feature inline just by giving attribute

data-feature_name="value"
in html element. The features available for Nepali Datepicker are follows:

Inline

This Property makes DatePicker Inline and always visible.

Data Type

(property) inline: boolean

Default

inline: false

Example

$("#datepickerExample").datepicker({ language: "nep", inline: true });
 //OR
<input class="datepicker-here" type="text" data-language="nep" data-inline="true">

Language

This Property change DatePicker Language.

Data Type

(property) language: string

Default

language: "nep"

Example

$("#datepickerExample").datepicker({ language: "nep", inline: true });
 //OR
<input class="datepicker-here" type="text" data-language="nep">

Note: Currently Nepali only available in default but you can customize it.

StartDate

This Property set the StartDate on which default view shown.

Data Type

(property) startDate: object
//datefomrat = {year:string,month:string,day:string}

Default

startDate: currentdate

Example

$("#datepickerExample").datepicker({ startDate: NepaliFunctions.GetCurrentBsDate() });

FirstDay

This Property set the FirstDay from which the day start.

Data Type

(property) firstDay: integer

Default

firstDay: 0

Example

$("#datepickerExample").datepicker({ startDay: 0 });
//0 = आइतवार, 1 = सोमवार, 2= मङ्गलवार, 3 = बुधवार, 4= बिहिवार, 5 = शुक्रवार, 6 = शनिवार

Weekends

This Property set the Weekend to marks as holiday.

Data Type

(property) weekends: array

Default

weekends: [6]

Example

$("#datepickerExample").datepicker({ weekends: [0,6] });
//0 = आइतवार, 1 = सोमवार, 2= मङ्गलवार, 3 = बुधवार, 4= बिहिवार, 5 = शुक्रवार, 6 = शनिवार

DateFormat

This Property set the format of date and return date on that format.

Data Type

(property) dateFormat: string

Default

dateFormat: 'mm.dd.yyyy'

Example

$("#datepickerExample").datepicker({ dateFormat: 'mm/dd/yyyy' });

AltField

This Property set the altfield where duplicate of datevalue will be set.

Data Type

(property) altField: string or jqueryselector

Default

altField: ''

Example

$("#datepickerExample").datepicker({ altField: '#altfield'
// give # for element's id and . for element's class});

AltFieldDateFormat

This Property set the dateformat for date that return on altfield.

Data Type

(property) altFieldDateFormat: string

Default

altFieldDateFormat: 'dd/mm/yyyy'

Example

$("#datepickerExample").datepicker({ altFieldDateFormat: 'dd-mm-yyyy'});

ToggleSelected

This Property define wheather to remove selection when clicking on selected cell.

Data Type

(property) toggleSelected: boolean

Default

toggleSelected: true

Example

$("#datepickerExample").datepicker({ toggleSelected:false});

KeyboardNav

This Property define wheather to activate Hotkeys or not.

Data Type

(property) keyboardNav: boolean

Default

keyboardNav: true

Example

$("#datepickerExample").datepicker({ keyboardNav:false});

Position

This Property define postion of datepicker.

Data Type

(property) position: string

Default

position: 'bottom left'

Example

$("#datepickerExample").datepicker({ position: 'top left'});
// available positions: top left,top right, bottom left, bottom right

Offset

This Property define distance between datepicker intializer element and datepicker.

Data Type

(property) offset: integer

Default

offset: 12

Example

$("#datepickerExample").datepicker({ offset: 32});

View

This Property define distance between datepicker intializer element and datepicker.

Data Type

(property) view: string

Default

view: "days"

Example

$("#datepickerExample").datepicker({ view: "months"});
//available views: years, months, days

MinView

This Property define minView for datepicker from which view date will be returned.

Data Type

(property) minView: string

Default

minView: "days"

Example

$("#datepickerExample").datepicker({ minView: "months"});
//available views: years, months, days

ShowOtherMonths

This Property define wheather to show months from other years or not.

Data Type

(property) showOtherMonths: boolean

Default

showOtherMonths: true

Example

$("#datepickerExample").datepicker({ showOtherMonths: false });

SelectOtherMonths

This Property define wheather to select months from other year or not.

Data Type

(property) selectOtherMonths: boolean

Default

selectOtherMonths: true

Example

$("#datepickerExample").datepicker({ selectOtherMonths: false });

MoveToOtherMonthsOnSelect

This Property define wheather to move other month view from other year or not on select.

Data Type

(property) moveToOtherMonthsOnSelect: boolean

Default

moveToOtherMonthsOnSelect: true

Example

$("#datepickerExample").datepicker({ moveToOtherMonthsOnSelect: false });

ShowOtherYears

This Property define wheather to show year from other decade.

Data Type

(property) showOtherYears: boolean

Default

showOtherYears: true

Example

$("#datepickerExample").datepicker({ showOtherYears: false });

SelectOtherYears

This Property define wheather to select year from other decade.

Data Type

(property) selectOtherYears: boolean

Default

selectOtherYears: true

Example

$("#datepickerExample").datepicker({ selectOtherYears: false });

MoveToOtherYearsOnSelect

This Property define wheather to move to year view from other decade on select.

Data Type

(property) moveToOtherYearsOnSelect: boolean

Default

moveToOtherYearsOnSelect: true

Example

$("#datepickerExample").datepicker({ moveToOtherYearsOnSelect: false });

MinDate

This Property define minimum date from where selection of date start.

Data Type

(property) minDate: object

Default

minDate: uptocalendar capacity

Example

$("#datepickerExample").datepicker({ minDate: {year: 2080, month: 1, day: 1} });

MaxDate

This Property define maximun date upto where selection of date start.

Data Type

(property) maxDate: object

Default

maxDate: uptocalendar capacity

Example

$("#datepickerExample").datepicker({ maxDate: {year: 2089, month: 1, day: 1} });

DisableNavWhenOutOfRange

This Property define wheather to disable nav(forward and backward button) option on Out range of given min or max date.

Data Type

(property) disableNavWhenOutOfRange: boolean

Default

disableNavWhenOutOfRange: true

Example

$("#datepickerExample").datepicker({ disableNavWhenOutOfRange: false });

MultipleDates

This Property define wheather to make multiple date selectable or not.

Data Type

(property) multipleDates: boolean

Default

multipleDates: false

Example

$("#datepickerExample").datepicker({ multipleDates: true });

MultipleDatesSeparator

This Property define the seprator between date when multiple date are selected.

Data Type

(property) multipleDatesSeparator: string

Default

multipleDatesSeparator: ','

Example

$("#datepickerExample").datepicker({ multipleDatesSeparator: ' ' });
//Note: neede symbol or white space.

Range

This Property define wheather to make range selectable or not. If you need beetwen dates or dateperoid you can enable this option.

Data Type

(property) range: boolean

Default

range: false

Example

$("#datepickerExample").datepicker({ range: true});

TodayButton

This Property define wheather to show today btn which select today date.

Data Type

(property) todayButton: boolean

Default

todayButton: false

Example

$("#datepickerExample").datepicker({ todayButton: true });

ClearButton

This Property define wheather to show clear btn which clear selected date.

Data Type

(property) clearButton: boolean

Default

clearButton: false

Example

$("#datepickerExample").datepicker({ clearButton: true });

ShowEvent

This Property define on which event datepicker have to shown.

Data Type

(property) showEvent: string

Default

showEvent: 'focus'

Example

$("#datepickerExample").datepicker({ showEvent: 'click' });
//Note: you have to pass the valid javascript event

AutoClose

This Property define wheather to close datepicker on date selection or not.

Data Type

(property) autoClose: boolean

Default

autoClose: true

Example

$("#datepickerExample").datepicker({ autoClose: false });

MonthsField

This Property define which type of month shown on month view.

Data Type

(property) monthsField: string

Default

monthsField: "monthsShort"

Example

$("#datepickerExample").datepicker({ monthsField: "months" });
//available options: months,monthsShort
//months=["Baisakh","Jestha","Ashar","Shrawan","Bhadra","Ashoj","Kartik","Mangsir","Poush","Magh","Falgun","Chaitra"]
//monthsShort=["बैशाख","जेठ","अषाढ","श्रावण","भाद्र","आश्विन","कार्तिक","मङ्सिर","पौष","माघ","फाल्गुन","चैत्र"]

Events

Events are the signal which are sent when certain defined function execute. To receive event you need to define event handler. The avaible events defined in Nepali datepicker are mentioned below.

  1. OnSelect
  2. OnShow
  3. OnHide
  4. OnChangeMonth
  5. OnChangeYear
  6. OnChangeDecade
  7. OnChangeView
  8. OnRenderCell

OnSelect

This Event will fired when cell is selected.

Returns

dateFormat: (string) the format on which date was formated
date: (string) date on user selected

Example

$("#datepickerExample").datepicker({
   onSelect: function (dateFormat,date){
     console.log("Date format is:"+dateformat);
     console.log("The selected date is:"+date);
   }
});

OnShow

This Event will fired when datepicker is visible to user.

Example

$("#datepickerExample").datepicker({
  onShow: function (){
      console.log("Date picker is shown.");
  }
});

OnHide

This Event will fired when datepicker is invisible to user.

Example

$("#datepickerExample").datepicker({
  onHide: function (){
      console.log("Date picker is hidden.");
  }
});

OnChangeMonth

This Event will fired when month of datepicker is changed.

Returns

month: (string) the month selected
year: (string) the year selected

Example

$("#datepickerExample").datepicker({
  onChangeMonth: function (month,year) {
      console.log("Month is changed and new month is "+ month+" and year is "+year);
  }
});

OnChangeYear

This Event will fired when year of datepicker is changed.

Returns

year: (string) the year selected

Example

$("#datepickerExample").datepicker({
  onChangeYear: function (year) {
      console.log("Year is changed and new year is "+year);
  }
});

OnChangeDecade

This Event will fired when year of datepicker is changed.

Returns

decade: (string) the yeargroup selected

Example

$("#datepickerExample").datepicker({
  onChangeDecade: function (decade) {
      console.log("Decade is changed and new year group is "+decade);
  }
});

OnChangeView

This Event will fired when view of datepicker is changed.

Returns

view: (string) the view showed

Example

$("#datepickerExample").datepicker({
            onChangeView: function (view) {
                console.log("View is changed and new view is "+view);
            }
          });

OnRenderCell

This Event will fired on every cell rendered.

Returns

date: (object) date on redered cell
cellType: (string) rendered cell type
            

Example

var disabledDays = [5,6,7,8];
$("#datepickerExample").datepicker({
  onRenderCell: function (date, cellType) {
     if (cellType == "day") {
        var day = date.day,
        isDisabled = disabledDays.indexOf(day) != -1;
        return { disabled: isDisabled };
      }
  }
});

Hot Keys

Hot keys are also known as keyboard shortcut. To make convenient and efficient way to access certain functions of Nepali Datepicker, We provide certain key combination. So The following are the keycombinations to perform its specific task:

Hot Keys Functions.
Ctrl + Right Arrow key Move to next month.
Ctrl + Left Arrow key Move to previous month.
Ctrl + up Arrow key Move to next month.
Ctrl + down Arrow key Move to previous month.
Shift + Right Arrow key Move to next year.
Shift + Left Arrow key Move to previous year.
Shift + up Arrow key Move to next year.
Shift + down Arrow key Move to previous year.
Alt + Right Arrow key Move to next decade.
Alt + Left Arrow key Move to previous decade.
Alt + up Arrow key Move to next decade.
Alt + down Arrow key Move to previous decade.
Ctril + Shift + up Arrow key Day view is shown then move to month view
Or Month view is show then move to Year view

NepaliFunctions

Nepali Dates Functions, a JavaScript plugin that enables seamless conversion between Nepali and Gregorian calendars. With just a few lines of code, you can effortlessly display Nepali dates on your website or application. This plugin simplifies date calculations, formatting, and manipulation in the Nepali calendar system, providing a convenient solution for developers. Experience the power of Nepali Dates and enhance your user experience today.

The Functions available are as follow:

ConvertToDateObject

This function returns date in object format { year, month, day }.

new ConvertToDateObject(dateString: string, dateFormat: string): object

Parameters

dateString (string) any date string

Returns

object: returns date in object and its format.

Example

NepaliFunctions.ParseDate("2080-01-01")
// returns { parsedDate: { year: 2080, month: 1, day: 1}, parsedFormat: "YYYY-MM-DD" }

ConvertDateFormat

This function returns date in target format.

new ConvertDateFormat(dateObj: string, returnFormat: string): string

Parameters

dateObj (string) any date object
returnFormat (string) target format

Returns

string: returns date in target format.

Example

NepaliFunctions.ConvertDateFormat({year: 2080, month: 1, day: 1}, "MM/DD/YYYY")
// Returns "01/01/2080"

NepaliFunctions.ConvertDateFormat({year: 2080, month: 1, day: 1}, "MM-DD-YYYY")
// Returns "01-01-2080"

NepaliFunctions.ConvertDateFormat({year: 2080, month: 1, day: 1}, "YYYY-MM-DD")
// Returns "2080-01-01"

NepaliFunctions.ConvertDateFormat({year: 2080, month: 1, day: 1}, "YYYY/MM/DD")
// Returns "2080/01/01"

AD2BS

This function converts AD date object to BS date object.

new AD2BS(adDate: (object | string), sourceDateFormat: string, returnDateFormat: string): string

Parameters

adDate ((object | string)) any AD date object or AD date string
sourceDateFormat (string) any available date formats and required only if adDate is string
returnDateFormat (string) any available date formats

Returns

string: converts AD date object to BS date object.

Example

NepaliFunctions.AD2BS({year: 2023, month: 7, day: 5})
// returns {year: 2080, month: 3, day: 20}

NepaliFunctions.AD2BS("2023-07-05")
// returns 2080-03-20

NepaliFunctions.AD2BS("2023-07-05", "YYYY-MM-DD")
// returns 2080-03-20

NepaliFunctions.AD2BS("2023-07-05", "YYYY-MM-DD", "YYYY/MM/DD")
// returns 2080/03/20

BS2AD

This function converts BS date object to AD date object.

new BS2AD(bsDate: (object | string), sourceDateFormat: string, returnDateFormat: string): string

Parameters

bsDate ((object | string)) any BS date object or BS date string
sourceDateFormat (string) any available date formats and required only if bsDate is string
returnDateFormat (string) any available date formats

Returns

string: converts BS date object to AD date object.

Example

NepaliFunctions.BS2AD({year: 2080, month: 3, day: 20})
// returns {year: 2023, month: 7, day: 5}

NepaliFunctions.BS2AD("2080-05-05")
// returns 2023-07-05

NepaliFunctions.BS2AD("2080-05-05", "YYYY-MM-DD")
// returns 2023-07-05

NepaliFunctions.BS2AD("2080-05-05", "YYYY-MM-DD", "YYYY/MM/DD")
// returns 2023/07/05

ParseDate

This function returns parsed date in object format {year, month, day}.

new ParseDate(dateString: string): object

Parameters

dateString (string) any date string

Returns

object: returns date in object and its format.

Example

NepaliFunctions.ParseDate("2080-01-01")
// returns { parsedDate: { year: 2080, month: 1, day: 1}, parsedFormat: "YYYY-MM-DD" }

GetCurrentBsDate

This function returns the current BS date object.

new GetCurrentBsDate(dateFormat: string): (object | string)

Parameters

dateFormat (string) any available date formats

Returns

(object | string): the current BS date object or string if date format is provided.

Example

NepaliFunctions.GetCurrentBsDate()
// Returns {year: 2080, month: 3, day: 20}
// if today's date is 3rd Ashar 2080

NepaliFunctions.GetCurrentBsDate('YYYY-MM-DD')
// Returns {year: 2080, month: 3, day: 20}
// if today's date is 3rd Ashar 2080

GetCurrentAdDate

This function returns the current AD date object.

new GetCurrentAdDate(dateFormat: string): (object | string)

Parameters

dateFormat (string) any available date formats.

Returns

(object | string): the current AD date object or string if date format is provided.

Example

NepaliFunctions.GetCurrentAdDate()
// Returns {year: 2023, month: 7, day: 5}
// if today"s date is 5th July 2023

NepaliFunctions.GetCurrentAdDate('YYYY-MM-DD')
// Returns 2023-07-05
// if today's date is 5th July 2023

GetCurrentBsYear

This function returns the current BS year.

new GetCurrentBsYear(): number

Returns

number: the current BS year.

Example

NepaliFunctions.GetCurrentBsYear()
// Returns 2080
// if today's date is 3rd Ashar 2080

GetCurrentAdYear

This function returns the current AD year.

new GetCurrentAdYear(): number

Returns

number: the current AD year.

Example

NepaliFunctions.GetCurrentAdYear()
// Returns 2023
// if today's date is 5th July 2023

GetCurrentBsMonth

This function returns the current BS month.

This function returns the current BS month.

Returns

number: the current BS month.

Example

NepaliFunctions.GetCurrentBsMonth()
// Returns 3
// if today's date is 3rd Ashar 2080

GetCurrentAdMonth

This function returns the current AD month.

new GetCurrentAdMonth(): number

Returns

number: the current AD month.

Example

NepaliFunctions.GetCurrentAdMonth()
// Returns 7
// if today's date is 5th July 2023

GetCurrentBsDay

This function returns the current BS day.

new GetCurrentBsDay(): number

Returns

number: the current BS day.

Example

NepaliFunctions.GetCurrentBsDay()
// Returns 3
// if today's date is 3rd Ashar 2080
            

GetCurrentAdDay

This function returns the current AD day.

new ConvertToDateObject(dateString: string, dateFormat: string): object

Returns

number: the current AD day.

Example

NepaliFunctions.GetCurrentAdDay()
// Returns 5
// if today's date is 5th July 2023

GetBsMonths

This function returns the BS months in English.

new GetBsMonths(): array

Returns

array: the BS months.

Example

NepaliFunctions.GetBsMonths()
// Returns  ["Baisakh", "Jestha", "Ashar", "Shrawan", "Bhadra", "Ashoj", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"]

GetAdMonths

This function returns the AD months.

new GetAdMonths(): array

Returns

array: the AD months.

Example

NepaliFunctions.GetAdMonths()
// Returns ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

GetBsMonth

This function returns the BS month in English.

new GetBsMonth(number: number): string

Parameters

number (number) any number

Returns

string: the BS month.

Example

NepaliFunctions.GetBsMonth(11)
// Returns Chaitra

NepaliFunctions.GetBsMonth(0)
// Returns Baisakh

NepaliFunctions.GetBsMonth(-1)
// Returns null

NepaliFunctions.GetBsMonth(12)
// Returns null

GetAdMonth

This function returns the AD month.

new GetAdMonth(number: number): string

Parameters

number (number) any number

Returns

string: the AD month.

Example

NepaliFunctions.GetAdMonth(2)
// Returns March

NepaliFunctions.GetAdMonth(11)
// Returns December

NepaliFunctions.GetAdMonth(-1)
// Returns null

NepaliFunctions.GetAdMonth(12)
// Returns null

GetBsMonthsInUnicode

This function returns the BS months.

new GetBsMonthsInUnicode(): array

Returns

array: the BS months.

Example

NepaliFunctions.GetBsMonthsInUnicode()
// Returns ["बैशाख", "जेठ", "अषाढ", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मङ्सिर", "पौष", "माघ", "फाल्गुन", "चैत्र"]

GetBsMonthInUnicode

This function returns the BS month in unicode.

new GetBsMonthInUnicode(number: number): string

Parameters

number (number) any number

Returns

string: the BS month in unicode.

Example

NepaliFunctions.GetBsMonthInUnicode(0)
// Returns बैशाख

NepaliFunctions.GetBsMonthInUnicode(11)
// Returns चैत्र

NepaliFunctions.GetBsMonthInUnicode(12)
// Returns null

NepaliFunctions.GetBsMonthInUnicode(-1)
// Returns null

GetBsDaysUnicode

This function returns the BS days in unicode.

new GetBsDaysUnicode(): array

Returns

array: the BS days in unicode.

Example

NepaliFunctions.GetBsDaysUnicode()
// Returns ["आइतवार", "सोमवार", "मङ्गलवार", "बुधवार", "बिहिवार", "शुक्रवार", "शनिवार"]

GetAdDays

This function returns the AD days.

new GetAdDays(): array

Returns

array: the AD days.

Example

NepaliFunctions.GetAdDays()
// Returns ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

GetBsDayUnicode

This function returns the BS day in unicode.

new GetBsDayUnicode(number: number): string

Parameters

number (number) any number

Returns

string: the BS day in unicode.

Example

NepaliFunctions.GetBsDayUnicode(0)
// Returns आइतवार

NepaliFunctions.GetBsDayUnicode(7)
// Returns null

GetAdDay

This function returns the AD day.

new GetAdDay(number: number): string

Parameters

number (number) any number

Returns

string: the AD day.

Example

NepaliFunctions.GetAdDay(0)
// Returns Sunday

NepaliFunctions.GetAdDay(7)
// Returns null

GetBsDayInNumber

This function returns Bs Day in Number.

new GetBsDayInNumber(dateString: string, dateFormat: string): object

Parameters

dateString (string) any date string

Returns

number: returns day as number

Example

NepaliFunctions.GetBsDayInNumber({year: '2080',month: '3',day: '20',})
// returns 3

GetBsDaysUnicodeShort

This function returns the BS day in unicode.

new GetBsDayUnicodeShort(number: number): string

Parameters

number (number) any number

Returns

string: the BS day in unicode.

Example

NepaliFunctions.GetBsDayUnicodeShort(0)
// Returns आ

NepaliFunctions.GetBsDayUnicodeShort(7)
// Returns null

GetAdDaysShort

This function returns the AD days Short.

new GetAdDaysShort(): array

Returns

array: the AD days short.

Example

NepaliFunctions.GetAdDaysShort()
// returns ["S", "M", "T", "W", "T", "F", "S"]

GetBsDayUnicodeShort

This function returns the BS day in unicode.

new GetBsDayUnicodeShort(number: number): string

Parameters

number (number) any number

Returns

string: the BS day in unicode.

Example

NepaliFunctions.GetBsDayUnicodeShort(1)
// returns सो

NepaliFunctions.GetBsDayUnicodeShort(7)
// Returns null

GetAdDayShort

This function returns the AD day.

new GetAdDayShort(number: number): string

Parameters

number (number) any number

Returns

string: the AD day.

Example

NepaliFunctions.GetAdDayShort(1)
// returns M

NepaliFunctions.GetAdDayShort(7)
// returns null

GetBsFullDate

This function returns the full BS date.

new GetBsFullDate(bsDate: (object | string), unicodeFlag: boolean, dateFormat: string): string

Parameters

bsDate ((object | string)) any date object or date string
unicodeFlag (boolean) true or false
dateFormat (string) any available date formats and required only if bsDate is string

Returns

string: the full BS date.

Example

NepaliFunctions.GetBsFullDate({year: 2080, month: 3, day: 22}, false)
// returns 22 Ashar 2080

NepaliFunctions.GetBsFullDate("2080-03-22", false, "YYYY-MM-DD")
// returns 22 Ashar 2080

NepaliFunctions.GetBsFullDate("2079-03-15", true, "YYYY-MM-DD")
// returns १५ अषाढ २०७९

NepaliFunctions.GetBsFullDate({year: 2080, month: 12, day: 15}, true)
// returns १५ चैत्र २०८०

NepaliFunctions.GetBsFullDate({year: 2080, month: 5, day: 18}, true)
// returns १८ भाद्र २०८०

GetAdFullDate

This function returns the full AD date.

new GetAdFullDate(adDate: (object | string), dateFormat: string): string

Parameters

adDate (object | string) any date object or date string
dateFormat (string) any available date formats and required only if adDate is string

Returns

string: the full AD date.

Example

NepaliFunctions.GetAdFullDate({year: 2023, month: 3, day: 28})
// returns 28 March 2023

NepaliFunctions.GetAdFullDate("2023/09/04", "YYYY/MM/DD")
// returns 4 September 2023

GetBsFullDay

This function returns the day for the given BS date object or date string.

new GetBsFullDay(bsDate: (object | string), dateFormat: string): string

Parameters

bsDate (object | string) any date object or date string
dateFormat (string) any available date formats and required only if bsDate is string

Returns

string: the day.

Example

NepaliFunctions.GetBsFullDay({year: 2072, month: 3, day: 15})
// returns Tuesday

GetBsFullDayInUnicode

This function returns the day for the given BS date object or date string.

new GetBsFullDayInUnicode(bsDate: (object | string), dateFormat: string): string

Parameters

bsDate (object | string) any date object or date string
dateFormat (string) any available date formats and required only if bsDate is string

Returns

string: the day.

Example

NepaliFunctions.GetBsFullDayInUnicode({year: 2070, month: 12, day: 15})
// returns शनिवार

NepaliFunctions.GetBsFullDayInUnicode('2072-12-15', 'YYYY-MM-DD')
// Returns सोमवार

GetAdFullDay

This function returns the day for the given AD date object.

new GetAdFullDay(adDate: (object | string), dateFormat: string): string

Parameters

adDate (object | string) any date object or date string
dateFormat (string) any available date formats and required only if adDate is string

Returns

string: the day.

Example

NepaliFunctions.GetAdFullDay({year: 2021, month: 3, day: 15})
// returns Monday

NepaliFunctions.GetAdFullDay('2023-05-02', 'YYYY-MM-DD')
// returns Tuesday

GetDaysInBsMonth

This function returns the number of days in the given BS year and month.

new GetDaysInBsMonth(year: number, month: number): number

Parameters

year (number) any number
month (number) any number

Returns

number: that number of days in the given BS year and month.

Example

NepaliFunctions.GetDaysInBsMonth(2072, 12)
// returns 30

GetDaysInAdMonth

This function returns the number of days in the given AD year and month.

new GetDaysInAdMonth(year: number, month: number): number

Parameters

year (number) any number
month (number) any number

Returns

number: that number of days in the given AD year and month.

Example

NepaliFunctions.GetDaysInAdMonth(2022, 1)
// returns 31

BsDatesDiff

This function returns that number of days between the two BS dates.

new BsDatesDiff(startDate: (object | string), endDate: (object | string), dateFormat: string): number

Parameters

startDate ((object | string)) any BS date object or date string
endDate ((object | string)) any BS date object or date string
dateFormat (string) any available date formats and required only if startDate or endDate is string

Returns

number: that number of days between the two BS dates.

Example

NepaliFunctions.BsDatesDiff({year: 2021, month: 3, day: 15}, {year: 2020, month: 3, day: 17})
// returns 363

NepaliFunctions.BsDatesDiff('2023-05-06', '2023-08-06', 'YYYY-MM-DD')
//return 91

AdDatesDiff

This function returns that number of days between the two AD dates objects.

new AdDatesDiff(startDate: (object | string), endDate: (object | string), dateFormat: string): number

Parameters

startDate ((object | string)) any AD date object or date string
endDate ((object | string)) any AD date object or date string
dateFormat (string) any available date formats and required only if startDate or endDate is string

Returns

number: that number of days between the two AD dates.

Example

NepaliFunctions.AdDatesDiff({year: 2023, month: 5, day: 6}, {year: 2023, month: 8, day: 6})
// returns 92

NepaliFunctions.AdDatesDiff('2021-03-15', '2020-03-17')
// returns 363

NepaliFunctions.AdDatesDiff('2021-03-15', '2020-03-17', 'YYYY-MM-DD')
// returns 363

BsAddDays

This function returns the BS date object after adding the number of days.

new BsAddDays(bsDate: (object | string), noOfDays: number, dateFormat: string): object

Parameters

bsDate ((object | string)) any date object or date string
noOfDays (number) any number
dateFormat (string) any available date formats and required only if bsDate is string

Returns

object: the BS date object after adding the number of days.

Example

NepaliFunctions.BsAddDays({year: 2023, month: 5, day: 2}, 90)
// returns {year: 2023, month: 8, day: 1}

NepaliFunctions.BsAddDays('2023-05-02', 90, 'YYYY-MM-DD')
// returns 2023-08-01

BsAddMonth

This function returns the BS date object after adding the number of months.

new BsAddMonth(bsDate: (object | string), noOfMonths: number, dateFormat: string): object

Parameters

bsDate ((object | string)) any date object or date string
noOfMonths (number) any number
dateFormat (string) any available date formats and required only if bsDate is string

Returns

object: the BS date object after adding the number of months.

Example

NepaliFunctions.BsAddMonth({year: 2023, month: 5, day: 2}, 90)
// returns {year: '2030', month: '11', day: 2}

NepaliFunctions.BsAddMonth('2023-05-02', 90, 'YYYY-MM-DD')
// returns 2030-11-02

ValidateBsDate

This function checks the validity of the BS date.

new ValidateBsDate(bsDate: (object | string), dateFormat: string): boolean

Parameters

bsDate ((object | string)) any BS date object or BS date string
dateFormat (string) any available date formats and required only if bsDate is string

Returns

boolean: the validity of the BS date object.

Example

NepaliFunctions.ValidateBsDate({year: 2020, month: 2, day: 30})
// returns true

NepaliFunctions.ValidateBsDate({year: 2020, month: 13, day: 30})
// returns false

NepaliFunctions.ValidateBsDate("2078-05-05")
// returns true

NepaliFunctions.ValidateBsDate("2078/01/30")
// returns false

NepaliFunctions.ValidateBsDate("2078/01/30", "YYYY/MM/DD")
// returns true

CompareBsDates

This function returns true if date is greater.

new CompareBsDates(date1: (object | string), date2: (object | string), dateFormat: string): boolean

Parameters

date1 ((object | string)) first date object or date string
date2 ((object | string)) second date object or date string
dateFormat (string) any available date formats and required only if startDate or endDate is string

Returns

boolean: true if date1 is greater than date2.

Example

NepaliFunctions.CompareBsDates({year: 2078, month: 2, day: 1}, {year: 2078, month: 1, day: 1})
// returns true

NepaliFunctions.CompareBsDates('2076-02-01', '2076-01-01')
// returns true

NepaliFunctions.CompareBsDates('2076-02-01', '2076-03-01')
// returns false

BetweenBsDates

This function returns if checkDate is between startDate and endDate.

new BetweenBsDates(checkDate: object, startDate: object, endDate: object, dateFormat: string, inclusive: boolean): boolean

Parameters

checkDate (object) check date object or date string
startDate (object) start date object or date string
endDate (object) end date object or date string
dateFormat (string) any available date formats and required only if startDate or endDate is string
inclusive (boolean)

Returns

boolean: true if checkDate is between startDate and endDate

Example

NepaliFunctions.BetweenBsDates({year: 2076, month: 2, day: 5}, {year: 2076, month: 1, day: 1}, {year: 2076, month: 2, day: 10})
// returns true

NepaliFunctions.BetweenBsDates('2076-01-01', '2076-01-05', '2076-02-10')
// returns false

NepaliFunctions.BetweenBsDates('2076/02/05', '2076/01/01', '2076/02/10', 'YYYY/MM/DD')
// returns true
            

ConvertToUnicode

This function converts number to unicode.

new ConvertToUnicode(number: number): string

Parameters

number (number) any number

Returns

string: that number converted to unicode string.

Example

NepaliFunctions.ConvertToUnicode(123456789)
// returns १२३४५६७८९

NepaliFunctions.ConvertToUnicode(14365.50)
//returns १४३६५.५

ConvertToNumber

This function converts unicode to number.

new ConvertToNumber(unicode: string): number

Parameters

unicode (string) any unicode number

Returns

number: that number.

Example

NepaliFunctions.ConvertToNumber("१२३४५६७८९")
// returns 123456789

NepaliFunctions.ConvertToNumber("१४३६५.५")
// returns 14365.50

NumberToWords

This function returns number to words in string.

new NumberToWords(number: number, isCurrency: boolean): string

Parameters

number (number) any number
isCurrency (boolean) true if you want to display currency

Returns

string: that number, converted to words.

Example

NepaliFunctions.NumberToWords(123456890.95, true)
// returns Twelve Crore Thirty Four Lakh Fifty Six Thousand Ninety Rupees and Ninety Five Paisa

NepaliFunctions.NumberToWords(15, true)
// returns Fifteen Rupees

NepaliFunctions.NumberToWords(15, false)
// returns Fifteen
            

NumberToWordsUnicode

This function returns number to words in unicode string.

new NumberToWordsUnicode(number: number, isCurrency: boolean): string

Parameters

number (number) any number
isCurrency (boolean) true if you want to display currency

Returns

string: that number, converted to words in unicode.

Example

NepaliFunctions.NumberToWordsUnicode(12345.1, true)
// returns बाह्र हजार तीन सय पैंतालिस रुपैंया दस पैसा

NepaliFunctions.NumberToWordsUnicode(12345.1, false)
// returns बाह्र हजार तीन सय पैंतालिस