1 line
26 KiB
JavaScript
1 line
26 KiB
JavaScript
|
var calendarFunctions={};!function($){var calendarData={bsMonths:["बैशाख","जेठ","असार","साउन","भदौ","असोज","कार्तिक","मंसिर","पौष","माघ","फागुन","चैत"],bsDays:["आइत","सोम","मंगल","बुध","बिही","शुक्र","शनि"],nepaliNumbers:["0","1","2","3","4","5","6","7","8","9"],bsMonthUpperDays:[[30,31],[31,32],[31,32],[31,32],[31,32],[30,31],[29,30],[29,30],[29,30],[29,30],[29,30],[30,31]],extractedBsMonthData:[[0,1,1,22,1,3,1,1,1,3,1,22,1,3,1,3,1,22,1,3,1,19,1,3,1,1,3,1,2,2,1,3,1],[1,2,2,2,2,2,2,1,3,1,3,1,2,2,2,3,2,2,2,1,3,1,3,1,2,2,2,2,2,2,2,2,2,2,2,1,3,1,2,2,2,2,2,2,2,2,2,2,2,1,3,1,2,2,2,2,2,1,1,1,2,2,2,2,2,1,3,1,1,2],[0,1,2,1,3,1,3,1,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,2,2,1,3,1,3,1,2,2,2,2,2,2,2,2,2,1,3,1,3,1,2,2,2,2,2,2,2,2,2,1,3,1,3,1,1,1,1,2,2,2,2,2,1,3,1,1,2],[1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,2,2,2,1,3,1,3,1,3,1,3,1,3,1,2,2,2,1,3,1,3,1,3,1,3,1,3,1,3,2,2,1,3,1,2,2,2,1,2],[59,1,26,1,28,1,2,1,12],[0,1,2,2,2,2,2,2,2,2,2,2,2,1,3,1,3,1,3,1,2,2,2,2,2,2,2,2,2,2,2,1,3,1,2,2,2,2,2,2,2,2,2,2,2,1,3,1,2,2,2,2,2,2,2,2,2,2,5,1,1,2,2,1,3,1,2,1,2],[0,12,1,3,1,3,1,5,1,11,1,3,1,3,1,18,1,3,1,3,1,18,1,3,1,3,1,27,1,2],[1,2,2,2,2,1,2,2,2,2,2,2,2,3,1,3,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,15,2,4],[0,1,2,2,2,2,1,3,1,3,1,3,1,2,2,2,3,2,2,2,1,3,1,3,1,3,1,2,2,2,2,2,2,2,1,3,1,3,1,3,1,2,2,2,2,2,2,2,2,2,1,3,1,3,1,2,2,2,15,2,4],[1,1,3,1,3,1,14,1,3,1,1,1,3,1,14,1,3,1,3,1,3,1,18,1,3,1,3,1,3,1,14,1,3,15,1,2,1,1],[0,1,1,3,1,3,1,10,1,3,1,3,1,1,1,3,1,3,1,10,1,3,1,3,1,3,1,3,1,14,1,3,1,3,1,3,1,3,1,10,1,20,1,1,1],[1,2,2,1,3,1,3,1,3,1,2,2,2,2,2,3,2,2,2,2,2,1,3,1,3,1,3,1,2,2,2,2,2,2,2,1,3,1,3,1,3,1,3,1,2,2,2,2,2,2,2,1,3,1,3,1,20,3]],minBsYear:1970,maxBsYear:2100,minAdDateEqBsDate:{ad:{year:1913,month:3,date:13},bs:{year:1970,month:1,date:1}}},validationFunctions={validateRequiredParameters:function(requiredParameters){$.each(requiredParameters,function(key,value){if("undefined"==typeof value||null===value)throw new ReferenceError("Missing required parameters: "+Object.keys(requiredParameters).join(", "))})},validateBsYear:function(bsYear){if("number"!=typeof bsYear||null===bsYear)throw new TypeError("Invalid parameter bsYear value");if(bsYear<calendarData.minBsYear||bsYear>calendarData.maxBsYear)throw new RangeError("Parameter bsYear value should be in range of "+calendarData.minBsYear+" to "+calendarData.maxBsYear)},validateAdYear:function(adYear){if("number"!=typeof adYear||null===adYear)throw new TypeError("Invalid parameter adYear value");if(adYear<calendarData.minBsYear-57||adYear>calendarData.maxBsYear-57)throw new RangeError("Parameter adYear value should be in range of "+(calendarData.minBsYear-57)+" to "+(calendarData.maxBsYear-57))},validateBsMonth:function(bsMonth){if("number"!=typeof bsMonth||null===bsMonth)throw new TypeError("Invalid parameter bsMonth value");if(bsMonth<1||bsMonth>12)throw new RangeError("Parameter bsMonth value should be in range of 1 to 12")},validateAdMonth:function(adMonth){if("number"!=typeof adMonth||null===adMonth)throw new TypeError("Invalid parameter adMonth value");if(adMonth<1||adMonth>12)throw new RangeError("Parameter adMonth value should be in range of 1 to 12")},validateBsDate:function(bsDate){if("number"!=typeof bsDate||null===bsDate)throw new TypeError("Invalid parameter bsDate value");if(bsDate<1||bsDate>32)throw new RangeError("Parameter bsDate value should be in range of 1 to 32")},validateAdDate:function(adDate){if("number"!=typeof adDate||null===adDate)throw new TypeError("Invalid parameter adDate value");if(adDate<1||adDate>31)throw new RangeError("Parameter adDate value should be in range of 1 to 31")},validatePositiveNumber:function(numberParameters){$.each(numberParameters,function(key,value){if("number"!=typeof value||null===value||value<0)throw new ReferenceError("Invalid parameters: "+Object.keys(numberParameters).join(", "));if("yearDiff"===key&&value>calendarData.maxBsYear-calendarData.minBsYear+1)th
|