leapfrogtechnology / nepali-date-picker

Nepali Date Picker jQuery Plugin 🇳🇵
http://leapfrogtechnology.github.io/nepali-date-picker/demo/
ISC License
87 stars 71 forks source link

calendarFunctions doesnot work if value passed as parameter #22

Closed hackerz12on closed 4 years ago

hackerz12on commented 5 years ago

I have a value '2019, 9, 17' as ad date, I want to convert this to bs date. The problem is: if i run console.log(calendarFunctions.getBsDateByAdDate(2019, 9, 17)); It shows correct value but if i write var cp = '2019, 9, 17 '; console.log(calendarFunctions.getBsDateByAdDate(cp)); then it says invalid format. What is the issue with this ??

sanishmaharjan commented 5 years ago

I have a value '2019, 9, 17' as ad date, I want to convert this to bs date. The problem is: if i run console.log(calendarFunctions.getBsDateByAdDate(2019, 9, 17)); It shows correct value but if i write var cp = '2019, 9, 17 '; console.log(calendarFunctions.getBsDateByAdDate(cp)); then it says invalid format. What is the issue with this ??

@hackerz12on getBsDateByAdDate function does not accept date as string. You need to pass three parameters year, month & month-date as:

var year = 2019;
var month = 9;
var date = 17;
console.log(calendarFunctions.getBsDateByAdDate(year, month, date));