1.4.8
This function converts AD date object to BS date object.
(string)
any available date formats and required only if adDate is string
(string)
any available date formats
string
:
converts AD date object to BS date object.
NepaliFunctions.AD2BS({year: 2001, month: 6, day: 1})
// returns {year: 2058, month: 2, day: 19}
NepaliFunctions.AD2BS({year: 2008, month: 5, day: 28})
// returns {year: 2065, month: 2, day: 15}
NepaliFunctions.AD2BS("2008-05-28")
// returns 2065-02-15
NepaliFunctions.AD2BS("2008-05-28", "YYYY-MM-DD")
// returns 2065-02-15
NepaliFunctions.AD2BS("2008-05-28", "YYYY-MM-DD", "YYYY/MM/DD")
// returns 2065/02/15
This function converts BS date object to AD date object.
(string)
any available date formats and required only if bsDate is string
(string)
any available date formats
string
:
converts BS date object to AD date object.
NepaliFunctions.BS2AD({year: 2058, month: 2, day: 19})
// returns {year: 2001, month: 6, day: 1}
NepaliFunctions.BS2AD({year: 2065, month: 2, day: 15})
// returns {year: 2008, month: 5, day: 28}
NepaliFunctions.BS2AD("2065-02-15")
// returns 2008-05-28
NepaliFunctions.BS2AD("2065-02-15", "YYYY-MM-DD")
// returns 2008-05-28
NepaliFunctions.BS2AD("2065-02-15", "YYYY-MM-DD", "YYYY/MM/DD")
// returns 2008/05/28
This function returns date in target format.
string
:
returns date in target format.
NepaliFunctions.ConvertToDateFormat({year: 2000, month: 1, day: 1}, "YYYY-MM-DD")
// Returns "2001-01-01"
NepaliFunctions.ConvertToDateFormat({year: 2000, month: 1, day: 1}, "YYYY/MM/DD")
// Returns "2001/01/01"
NepaliFunctions.ConvertToDateFormat({year: 2000, month: 1, day: 1}, "MM-DD-YYYY")
// Returns "01-01-2001"
NepaliFunctions.ConvertToDateFormat({year: 2000, month: 1, day: 1}, "MM/DD/YYYY")
// Returns "01/01/2001"
This function returns date in object format {year, month, day}.
object
:
returns date in object format.
NepaliFunctions.ConvertToDateObject("2000-01-01", "YYYY-MM-DD")
// returns { year: 2000, month: 1, day: 1}
NepaliFunctions.ConvertToDateObject("2000/01/01", "YYYY/MM/DD")
// returns { year: 2000, month: 1, day: 1}
NepaliFunctions.ConvertToDateObject("01-01-2000", "MM-DD-YYYY")
// returns { year: 2000, month: 1, day: 1}
NepaliFunctions.ConvertToDateObject("01/01/2000", "MM/DD/YYYY")
// returns { year: 2000, month: 1, day: 1}
This function converts unicode to number.
(string)
any unicode number
number
:
that number.
NepaliFunctions.ConvertToNumber("१२३४५६७८९")
// Returns 123456789
NepaliFunctions.ConvertToNumber("१२३.५")
// Returns 123.5
This function converts number to unicode.
(number)
any number
string
:
that number converted to unicode string.
NepaliFunctions.ConvertToUnicode(123456789)
// Returns १२३४५६७८९
NepaliFunctions.ConvertToUnicode(123.50)
// Returns १२३.५
This function returns number to words in string.
string
:
that number, converted to words.
NepaliFunctions.NumberToWords(123456000.12, true)
// Returns Twelve Crore Thirty Four Lakh Fifty Six Thousand Rupees and Twelve Paisa
NepaliFunctions.NumberToWords(12, true)
NepaliFunctions.NumberToWords(123456000.12, false)
// Returns Twelve Crore Thirty Four Lakh Fifty Six Thousand
NepaliFunctions.NumberToWords(12, false)
// Returns Twelve
This function returns number to words in unicode string.
string
:
that number, converted to words in unicode.
NepaliFunctions.NumberToWordsUnicode(123456000.12, true)
// Returns बाह्र करोड चौतीस लाख छपन्न हजार रुपैंया, बाह्र पैसा
NepaliFunctions.NumberToWordsUnicode(12, true)
NepaliFunctions.NumberToWordsUnicode(123456000.12, false)
// Returns बाह्र करोड चौतीस लाख छपन्न हजार
NepaliFunctions.NumberToWordsUnicode(12, false)
// Returns बाह्र
This function returns parsed date in object format {year, month, day}.
(string)
any date string
object
:
returns date in object and its format.
NepaliFunctions.ParseDate("2000-01-01")
// returns { parsedDate: { year: 2000, month: 1, day: 1}, parsedFormat: "YYYY-MM-DD" }
This function returns that number of days between the two AD dates objects.
(string)
any available date formats and required only if startDate or endDate is string
number
:
that number of days between the two AD dates.
NepaliFunctions.AD.DatesDiff({year: 2001, month: 3, day: 15}, {year: 2001, month: 3, day: 17})
// Returns 2
NepaliFunctions.AD.DatesDiff({year: 2003, month: 5, day: 2}, {year: 2003, month: 8, day: 1})
// Returns 91
NepaliFunctions.AD.DatesDiff('2003-05-02', '2003-08-01')
// Returns 91
NepaliFunctions.AD.DatesDiff('2003-05-02', '2003-08-01', 'YYYY-MM-DD')
// Returns 91
This function returns the current AD date object.
(string)
any available date formats.
(object | string)
:
the current AD date object or string if date format is provided.
NepaliFunctions.AD.GetCurrentDate()
// Returns {year: 2020, month: 1, day: 1}
// if today"s date is 1st January 2020
NepaliFunctions.AD.GetCurrentDate('YYYY-MM-DD')
// Returns 2020-01-01
// if today"s date is 1st January 2020
This function returns the current AD day.
number
:
the current AD day.
NepaliFunctions.AD.GetCurrentDay()
// Returns 1
// if today"s date is 1st January 2020
This function returns the current AD month.
number
:
the current AD month.
NepaliFunctions.AD.GetCurrentMonth()
// Returns 1
// if today"s date is 1st January 2020
This function returns the current AD year.
number
:
the current AD year.
NepaliFunctions.AD.GetCurrentYear()
// Returns 2020
// if today"s date is 1st January 2020
This function returns the AD day.
(number)
any number
string
:
the AD day.
NepaliFunctions.AD.GetDay(0)
// Returns Sunday
NepaliFunctions.AD.GetDay(5)
// Returns Friday
NepaliFunctions.AD.GetDay(7)
// Returns null
This function returns the AD days.
array
:
the AD days.
NepaliFunctions.AD.GetDays()
// Returns ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
This function returns the number of days in the given AD year and month.
number
:
that number of days in the given AD year and month.
NepaliFunctions.AD.GetDaysInMonth(2015, 2)
// Returns 28
NepaliFunctions.AD.GetDaysInMonth(2020, 1)
// Returns 31
This function returns the AD day.
(number)
any number
string
:
the AD day.
NepaliFunctions.AD.GetDayShort(0)
// Returns S
NepaliFunctions.AD.GetDayShort(5)
// Returns F
NepaliFunctions.AD.GetDayShort(7)
// Returns null
This function returns the AD days Short.
array
:
the AD days short.
NepaliFunctions.AD.GetDaysShort()
// Returns ["S", "M", "T", "W", "T", "F", "S"]
This function returns the full AD date.
(string)
any available date formats and required only if adDate is string
string
:
the full AD date.
NepaliFunctions.AD.GetFullDate({year: 2001, month: 3, day: 15})
// Returns 15 March 2001
NepaliFunctions.AD.GetFullDate({year: 2003, month: 5, day: 2})
// Returns 2 May 2003
NepaliFunctions.AD.GetFullDate("2003/05/02", "YYYY/MM/DD")
// Returns 2 May 2003
This function returns the day for the given AD date object.
(string)
any available date formats and required only if adDate is string
string
:
the day.
NepaliFunctions.AD.GetFullDay({year: 2001, month: 3, day: 15})
// Returns Thursday
NepaliFunctions.AD.GetFullDay({year: 2003, month: 5, day: 2})
// Returns Friday
NepaliFunctions.AD.GetFullDay('2003-05-02', 'YYYY-MM-DD')
// Returns Friday
This function returns the AD month.
(number)
any number
string
:
the AD month.
NepaliFunctions.AD.GetMonth(0)
// Returns January
NepaliFunctions.AD.GetMonth(5)
// Returns June
NepaliFunctions.AD.GetMonth(11)
// Returns December
NepaliFunctions.AD.GetMonth(-1)
// Returns null
NepaliFunctions.AD.GetMonth(12)
// Returns null
This function returns the AD months.
array
:
the AD months.
NepaliFunctions.AD.GetMonths()
// Returns ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
This function returns the BS date object after adding the number of days.
(number)
any number
(string)
any available date formats and required only if bsDate is string
object
:
the BS date object after adding the number of days.
NepaliFunctions.BS.AddDays({year: 2001, month: 3, day: 15}, 2)
// Returns {year: 2001, month: 3, day: 17}
NepaliFunctions.BS.AddDays({year: 2003, month: 5, day: 2}, 90)
// Returns {year: 2003, month: 8, day: 1}
NepaliFunctions.BS.AddDays('2003-05-02', 90, 'YYYY-MM-DD')
// '2003-08-01'
This function returns that number of days between the two BS dates.
(string)
any available date formats and required only if startDate or endDate is string
number
:
that number of days between the two BS dates.
NepaliFunctions.BS.DatesDiff({year: 2001, month: 3, day: 15}, {year: 2001, month: 3, day: 17})
// Returns 2
NepaliFunctions.BS.DatesDiff({year: 2003, month: 5, day: 2}, {year: 2003, month: 8, day: 1})
// Returns 90
NepaliFunctions.BS.DatesDiff('2003-05-02', '2003-08-01', 'YYYY-MM-DD')
// Returns 90
This function returns the current BS date object.
(string)
any available date formats
(object | string)
:
the current BS date object or string if date format is provided.
NepaliFunctions.BS.GetCurrentDate()
// Returns {year: 2076, month: 9, day: 1}
// if today"s date is 1st Poush 2076
NepaliFunctions.BS.GetCurrentDate('YYYY-MM-DD')
// Returns {year: 2076, month: 9, day: 1}
// if today"s date is 1st Poush 2076
This function returns the current BS day.
number
:
the current BS day.
NepaliFunctions.BS.GetCurrentDay()
// Returns 1
// if today"s date is 1st Poush 2076
This function returns the current BS month.
number
:
the current BS month.
NepaliFunctions.BS.GetCurrentMonth()
// Returns 9
// if today"s date is 1st Poush 2076
This function returns the current BS year.
number
:
the current BS year.
NepaliFunctions.BS.GetCurrentYear()
// Returns 2076
// if today"s date is 1st Poush 2076
This function returns the BS day in unicode.
(number)
any number
string
:
the BS day in unicode.
NepaliFunctions.BS.GetDayInUnicode(0)
// Returns आइतवार
NepaliFunctions.BS.GetDayInUnicode(4)
// Returns बिहिवार
NepaliFunctions.BS.GetDayInUnicode(7)
// Returns null
This function returns the BS days in short.
array
:
the BS days in short.
NepaliFunctions.BS.GetDaysInUnicodeShort()
// Returns ["आ", "सो", "मं", "बु", "बि", "शु", "श"]
This function returns the number of days in the given BS year and month.
number
:
that number of days in the given BS year and month.
NepaliFunctions.BS.GetDaysInMonth(2015, 2)
// Returns 32
NepaliFunctions.BS.GetDaysInMonth(2020, 1)
// Returns 31
This function returns the BS days in unicode.
array
:
the BS days in unicode.
NepaliFunctions.BS.GetDaysInUnicode()
// Returns ["आइतवार", "सोमवार", "मङ्गलवार", "बुधवार", "बिहिवार", "शुक्रवार", "शनिवार"]
This function returns the BS day in unicode.
(number)
any number
string
:
the BS day in unicode.
NepaliFunctions.BS.GetDayInUnicodeShort(0)
// Returns आ
NepaliFunctions.BS.GetDayInUnicodeShort(4)
// Returns बि
NepaliFunctions.BS.GetDayInUnicodeShort(7)
// Returns null
This function returns the full BS date.
(boolean)
true or false
(string)
any available date formats and required only if bsDate is string
string
:
the full BS date.
NepaliFunctions.BS.GetFullDate({year: 2075, month: 3, day: 15}, false)
// Returns 15 Ashar 2075
NepaliFunctions.BS.GetFullDate({year: 2075, month: 5, day: 2}, false)
// Returns 2 Bhadra 2075
NepaliFunctions.BS.GetFullDate("2075-03-15", false, "YYYY-MM-DD")
// Returns 2 Bhadra 2075
NepaliFunctions.BS.GetFullDate({year: 2075, month: 3, day: 15}, true)
// Returns १५ अषाढ २०७५
NepaliFunctions.BS.GetFullDate({year: 2075, month: 5, day: 2}, true)
// Returns २ भाद्र २०७५
NepaliFunctions.BS.GetFullDate("2075-03-15", true, "YYYY-MM-DD")
// Returns २ भाद्र २०७५
This function returns the day for the given BS date object or date string.
(string)
any available date formats and required only if bsDate is string
string
:
the day.
NepaliFunctions.BS.GetFullDay({year: 2045, month: 3, day: 15})
// Returns Wednesday
NepaliFunctions.BS.GetFullDay({year: 2077, month: 5, day: 2})
// Returns Tuesday
This function returns the day for the given BS date object or date string.
(string)
any available date formats and required only if bsDate is string
string
:
the day.
NepaliFunctions.BS.GetFullDayInUnicode({year: 2045, month: 3, day: 15})
// Returns बुधवार
NepaliFunctions.BS.GetFullDayInUnicode({year: 2077, month: 5, day: 2})
// Returns मङ्गलवार
NepaliFunctions.BS.GetFullDayInUnicode('2077-05-02', 'YYYY-MM-DD')
// Returns मङ्गलवार
This function returns the BS month in English.
(number)
any number
string
:
the BS month.
NepaliFunctions.BS.GetMonth(0)
// Returns Baisakh
NepaliFunctions.BS.GetMonth(5)
// Returns Ashoj
NepaliFunctions.BS.GetMonth(11)
// Returns Chaitra
NepaliFunctions.BS.GetMonth(-1)
// Returns null
NepaliFunctions.BS.GetMonth(12)
// Returns null
This function returns the BS month in unicode.
(number)
any number
string
:
the BS month in unicode.
NepaliFunctions.BS.GetMonthInUnicode(0)
// Returns बैशाख
NepaliFunctions.BS.GetMonthInUnicode(5)
// Returns आश्विन
NepaliFunctions.BS.GetMonthInUnicode(11)
// Returns चैत्र
NepaliFunctions.BS.GetMonthInUnicode(-1)
// Returns null
NepaliFunctions.BS.GetMonthInUnicode(12)
// Returns null
This function returns the BS months in English.
array
:
the BS months.
NepaliFunctions.BS.GetMonths()
// Returns ["Baisakh", "Jestha", "Ashar", "Shrawan", "Bhadra", "Ashoj", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"]
This function returns the BS months.
array
:
the BS months.
NepaliFunctions.BS.GetMonthsInUnicode()
// Returns ["बैशाख", "जेठ", "अषाढ", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मङ्सिर", "पौष", "माघ", "फाल्गुन", "चैत्र"]
This function returns if checkDate is between startDate and endDate
(object)
check date object or date string
(object)
start date object or date string
(object)
end date object or date string
(string)
any available date formats and required only if startDate or endDate is string
(boolean)
boolean
:
true if checkDate is between startDate and endDate
NepaliFunctions.BS.IsBetweenDates({year: 2076, month: 2, day: 5}, {year: 2076, month: 1, day: 1}, {year: 2076, month: 2, day: 10})
// Returns true
NepaliFunctions.BS.IsBetweenDates({year: 2076, month: 1, day: 1}, {year: 2076, month: 1, day: 5}, {year: 2076, month: 2, day: 10})
// Returns false
NepaliFunctions.BS.IsBetweenDates('2076-02-05', '2076-01-01', '2076-02-10')
// Returns true
NepaliFunctions.BS.IsBetweenDates('2076-01-01', '2076-01-05', '2076-02-10')
// Returns false
NepaliFunctions.BS.IsBetweenDates('2076/02/05', '2076/01/01', '2076/02/10', 'YYYY/MM/DD')
// Returns true
NepaliFunctions.BS.IsBetweenDates('2076/01/01', '2076/01/05', '2076/02/10', 'YYYY/MM/DD')
// Returns false
This function returns true if date1 is equal to date2.
(object)
date object or date string
(object)
date object or date string
(string)
any available date formats and required only if startDate or endDate is string
boolean
:
true if date1 is equal to date2.
NepaliFunctions.BS.IsEqualTo({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 1, day: 1 })
// Returns true
NepaliFunctions.BS.IsEqualTo({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsEqualTo("2076-01-01", "2076-01-01")
// Returns true
NepaliFunctions.BS.IsEqualTo("2076-01-01", "2076-01-02")
// Returns false
NepaliFunctions.BS.IsEqualTo("2076/02/01", "2076/02/01", "YYYY/MM/DD")
// Returns true
NepaliFunctions.BS.IsEqualTo("2076/03/01", "2076/02/01", "YYYY/MM/DD")
// Returns false
This function returns true if date1 is greater than date2.
(object)
date object or date string
(object)
date object or date string
(string)
any available date formats and required only if startDate or endDate is string
boolean
:
true if date1 is greater than date2.
NepaliFunctions.BS.IsGreaterThan({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 1, day: 1 })
// Returns true
NepaliFunctions.BS.IsGreaterThan({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsGreaterThan({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsGreaterThan("2076-02-01", "2076-01-01")
// Returns true
NepaliFunctions.BS.IsGreaterThan("2076-01-01", "2076-01-02")
// Returns false
NepaliFunctions.BS.IsGreaterThan("2076/03/01", "2076/02/01", "YYYY/MM/DD")
// Returns true
NepaliFunctions.BS.IsGreaterThan("2076/03/01", "2076/04/01", "YYYY/MM/DD")
// Returns false
NepaliFunctions.BS.IsGreaterThan("2076/03/01", "2076/03/01", "YYYY/MM/DD")
// Returns false
This function returns true if date1 is greater than or equal to date2.
(object)
date object or date string
(object)
date object or date string
(string)
any available date formats and required only if startDate or endDate is string
boolean
:
true if date1 is greater than or equal to date2.
NepaliFunctions.BS.IsGreaterThanOrEqualTo({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 1, day: 1 })
// Returns true
NepaliFunctions.BS.IsGreaterThanOrEqualTo({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsGreaterThanOrEqualTo({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns true
NepaliFunctions.BS.IsGreaterThanOrEqualTo("2076-02-01", "2076-01-01")
// Returns true
NepaliFunctions.BS.IsGreaterThanOrEqualTo("2076-01-01", "2076-01-02")
// Returns false
NepaliFunctions.BS.IsGreaterThanOrEqualTo("2076/03/01", "2076/02/01", "YYYY/MM/DD")
// Returns true
NepaliFunctions.BS.IsGreaterThanOrEqualTo("2076/03/01", "2076/04/01", "YYYY/MM/DD")
// Returns false
NepaliFunctions.BS.IsGreaterThanOrEqualTo("2076/03/01", "2076/03/01", "YYYY/MM/DD")
// Returns true
This function returns true if date1 is less than date2.
(object)
date object or date string
(object)
date object or date string
(string)
any available date formats and required only if startDate or endDate is string
boolean
:
true if date1 is less than date2.
NepaliFunctions.BS.IsLessThan({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns true
NepaliFunctions.BS.IsLessThan({ year: 2076, month: 3, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsLessThan({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsLessThan("2076-02-01", "2076-03-01")
// Returns true
NepaliFunctions.BS.IsLessThan("2076-01-03", "2076-01-02")
// Returns false
NepaliFunctions.BS.IsLessThan("2076/01/01", "2076/02/01", "YYYY/MM/DD")
// Returns true
NepaliFunctions.BS.IsLessThan("2076/03/01", "2076/02/01", "YYYY/MM/DD")
// Returns false
NepaliFunctions.BS.IsLessThan("2076/03/01", "2076/03/01", "YYYY/MM/DD")
// Returns false
This function returns true if date1 is less than date2.
(object)
date object or date string
(object)
date object or date string
(string)
any available date formats and required only if startDate or endDate is string
boolean
:
true if date1 is less than date2.
NepaliFunctions.BS.IsLessThanOrEqualTo({ year: 2076, month: 1, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns true
NepaliFunctions.BS.IsLessThanOrEqualTo({ year: 2076, month: 3, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns false
NepaliFunctions.BS.IsLessThanOrEqualTo({ year: 2076, month: 2, day: 1 }, { year: 2076, month: 2, day: 1 })
// Returns true
NepaliFunctions.BS.IsLessThanOrEqualTo("2076-02-01", "2076-03-01")
// Returns true
NepaliFunctions.BS.IsLessThanOrEqualTo("2076-01-03", "2076-01-02")
// Returns false
NepaliFunctions.BS.IsLessThanOrEqualTo("2076/01/01", "2076/02/01", "YYYY/MM/DD")
// Returns true
NepaliFunctions.BS.IsLessThanOrEqualTo("2076/03/01", "2076/02/01", "YYYY/MM/DD")
// Returns false
NepaliFunctions.BS.IsLessThanOrEqualTo("2076/03/01", "2076/03/01", "YYYY/MM/DD")
// Returns true
This function checks the validity of the BS date.
(string)
any available date formats and required only if bsDate is string
boolean
:
the validity of the BS date object.
NepaliFunctions.BS.ValidateDate({year: 2000, month: 2, day: 30})
// Returns true
NepaliFunctions.BS.ValidateDate({year: 2064, month: 4, day: 32})
// Returns true
NepaliFunctions.BS.ValidateDate({year: 2000, month: 13, day: 30})
// Returns false
NepaliFunctions.BS.ValidateDate({year: 2000, month: 12, day: 32})
// Returns false
NepaliFunctions.BS.ValidateDate("2078-01-05")
// Returns true
NepaliFunctions.BS.ValidateDate("2078-01-32")
// Returns false
NepaliFunctions.BS.ValidateDate("2078/01/30")
// Returns false
NepaliFunctions.BS.ValidateDate("2078/01/30", "YYYY/MM/DD")
// Returns true