@majidh1/jalalidatepicker
Advanced tools
Comparing version 0.1.4 to 0.1.6
@@ -59,3 +59,3 @@ /* | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"isNaN\": () => (/* binding */ isNaN),\n/* harmony export */ \"isNumber\": () => (/* binding */ isNumber),\n/* harmony export */ \"isUndefined\": () => (/* binding */ isUndefined),\n/* harmony export */ \"isString\": () => (/* binding */ isString),\n/* harmony export */ \"clon\": () => (/* binding */ clon),\n/* harmony export */ \"isLeapYear\": () => (/* binding */ isLeapYear),\n/* harmony export */ \"getDaysInMonth\": () => (/* binding */ getDaysInMonth),\n/* harmony export */ \"mod\": () => (/* binding */ mod),\n/* harmony export */ \"getDays\": () => (/* binding */ getDays),\n/* harmony export */ \"getDiffDays\": () => (/* binding */ getDiffDays),\n/* harmony export */ \"getWeekDay\": () => (/* binding */ getWeekDay),\n/* harmony export */ \"getYears\": () => (/* binding */ getYears),\n/* harmony export */ \"addLeadingZero\": () => (/* binding */ addLeadingZero),\n/* harmony export */ \"isPlainObject\": () => (/* binding */ isPlainObject),\n/* harmony export */ \"extend\": () => (/* binding */ extend),\n/* harmony export */ \"createElement\": () => (/* binding */ createElement),\n/* harmony export */ \"addListenerMulti\": () => (/* binding */ addListenerMulti),\n/* harmony export */ \"setInnerHTML\": () => (/* binding */ setInnerHTML),\n/* harmony export */ \"normalizeMinMaxDate\": () => (/* binding */ normalizeMinMaxDate),\n/* harmony export */ \"getValidMonths\": () => (/* binding */ getValidMonths),\n/* harmony export */ \"isValidDay\": () => (/* binding */ isValidDay),\n/* harmony export */ \"setClassName\": () => (/* binding */ setClassName),\n/* harmony export */ \"isValidDateString\": () => (/* binding */ isValidDateString),\n/* harmony export */ \"getDateFromString\": () => (/* binding */ getDateFromString),\n/* harmony export */ \"getDateToString\": () => (/* binding */ getDateToString),\n/* harmony export */ \"jalaliToday\": () => (/* binding */ jalaliToday),\n/* harmony export */ \"getScrollParent\": () => (/* binding */ getScrollParent)\n/* harmony export */ });\nvar _this = undefined;\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar isNaN = Number.isNaN || window.isNaN;\nvar isNumber = function isNumber(value) {\n return typeof value === \"number\" && !isNaN(value);\n};\nvar isUndefined = function isUndefined(value) {\n return typeof value === \"undefined\";\n};\nvar isString = function isString(value) {\n return typeof value === \"string\";\n};\nvar clon = function clon(a) {\n return JSON.parse(JSON.stringify(a));\n};\nvar isLeapYear = function isLeapYear(year) {\n return ((year - 474) % 2820 + 512) * 682 % 2816 < 682;\n};\nvar getDaysInMonth = function getDaysInMonth(year, month) {\n return [0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, isLeapYear(year) ? 30 : 29][month];\n};\nvar mod = function mod(a, b) {\n return window.Math.abs(a - b * window.Math.floor(a / b));\n};\nvar getDays = function getDays(month, day) {\n if (month < 8) return (month - 1) * 31 + day;\n return 6 * 31 + (month - 7) * 30 + day;\n};\nvar getDiffDays = function getDiffDays(year1, month1, day1, year2, month2, day2) {\n var diffDays = getDays(month2, day2) - getDays(month1, day1);\n var y1 = year1 < year2 ? year1 : year2;\n var y2 = year1 < year2 ? year2 : year1;\n\n for (var y = y1; y < y2; y++) {\n if (isLeapYear(y)) diffDays += year1 < year2 ? 366 : -366;else diffDays += year1 < year2 ? 365 : -365;\n }\n\n return diffDays;\n};\nvar getWeekDay = function getWeekDay(year, month, day) {\n return mod(getDiffDays(1392, 3, 25, year, month, day), 7);\n};\nvar getYears = function getYears(month, day) {\n return 6 * 31 + (month - 7) * 30 + day;\n};\nvar addLeadingZero = function addLeadingZero(value) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n var str = String(Math.abs(value));\n var i = str.length;\n var result = \"\";\n\n if (value < 0) {\n result += \"-\";\n }\n\n while (i < length) {\n i += 1;\n result += \"0\";\n }\n\n return result + str;\n};\nvar isPlainObject = function isPlainObject(obj) {\n if (!obj || !obj.constructor || obj.nodeType) {\n return false;\n }\n\n try {\n return JSON.stringify(obj) === \"{}\";\n } catch (e) {\n return true;\n }\n};\nvar extend = function extend() {\n var options;\n var src;\n var copy;\n var copyIsArray;\n var clone;\n\n for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {\n params[_key] = arguments[_key];\n }\n\n var target = params[0] || {};\n var i = 1;\n var length = params.length;\n var deep = false; // Handle a deep copy situation\n\n if (typeof target === \"boolean\") {\n deep = target; // Skip the boolean and the target\n\n target = params[i] || {};\n i += 1;\n } // Handle case when target is a string or something (possible in deep copy)\n\n\n if (_typeof(target) !== \"object\" && typeof target !== \"function\") {\n target = {};\n } // Extend jQuery itself if only one argument is passed\n\n\n if (i === length) {\n target = _this;\n i -= 1;\n }\n\n for (; i < length; i++) {\n options = params[i]; // Only deal with non-null/undefined values\n\n if (!isUndefined(options) && options !== null) {\n // Extend the base object\n for (var j = 0; j < window.Object.keys(options).length; j++) {\n var name = window.Object.keys(options)[j];\n\n if (Object.prototype.hasOwnProperty.call(options, name)) {\n copy = options[name]; // Prevent Object.prototype pollution\n // Prevent never-ending loop\n\n if (name === \"__proto__\" || target === copy) {\n return true;\n }\n\n copyIsArray = Array.isArray(copy); // Recurse if we're merging plain objects or arrays\n\n if (deep && copy && (isPlainObject(copy) || copyIsArray)) {\n src = target[name]; // Ensure proper type for the source value\n\n if (copyIsArray && !Array.isArray(src)) {\n clone = [];\n } else if (!copyIsArray && !isPlainObject(src)) {\n clone = {};\n } else {\n clone = src;\n } // Never move original objects, clone them\n\n\n target[name] = extend(deep, clone, copy); // Don't bring in undefined values\n } else if (!isUndefined(copy)) {\n target[name] = copy;\n }\n }\n }\n }\n } // Return the modified object\n\n\n return target;\n};\nvar createElement = function createElement(tag, parent, eventNames, event, content) {\n var splits = tag.split(\".\");\n tag = splits.shift() || \"div\";\n var className = splits;\n var element = window.document.createElement(tag);\n\n if (isString(parent)) {\n window.document.querySelector(parent).appendChild(element);\n } else {\n parent.appendChild(element);\n }\n\n if (className.length) {\n element.className = className.join(\" \");\n }\n\n if (eventNames && event) {\n addListenerMulti(element, eventNames, event);\n }\n\n if (!isUndefined(content)) {\n setInnerHTML(element, content);\n }\n\n return element;\n};\nvar addListenerMulti = function addListenerMulti(element, eventNames, listener) {\n var events = eventNames.split(\" \");\n\n for (var i = 0, iLen = events.length; i < iLen; i++) {\n element.addEventListener(events[i], listener, false);\n }\n};\nvar setInnerHTML = function setInnerHTML(element, html) {\n element.innerHTML = html;\n};\nvar normalizeMinMaxDate = function normalizeMinMaxDate(year, month, day, initDate, minDate, maxDate) {\n if (isNaN(year) || year < 1000 || year > 10000) {\n year = initDate.year;\n } else {\n if (year < minDate.year) {\n year = minDate.year;\n } else if (year > maxDate.year) {\n year = maxDate.year;\n }\n }\n\n if (isNaN(month) || month < 1 || month > 12) {\n month = initDate.month;\n } else {\n if (year <= minDate.year && month < minDate.month) {\n month = minDate.month;\n } else if (year >= maxDate.year && month > maxDate.month) {\n month = maxDate.month;\n }\n }\n\n if (isNaN(day) || day < 1) {\n day = initDate.day;\n } else {\n if (month <= minDate.month && day < minDate.day) {\n day = minDate.day;\n } else if (month >= maxDate.month && day > maxDate.day) {\n day = maxDate.day;\n }\n }\n\n return {\n year: parseInt(year),\n month: parseInt(month),\n day: parseInt(day)\n };\n};\nvar getValidMonths = function getValidMonths(initDate, minDate, maxDate) {\n var months = [];\n var start = 1;\n var finish = 12;\n\n if (initDate.year === minDate.year) {\n start = minDate.month;\n\n if (initDate.year === maxDate.year) {\n finish = maxDate.month;\n }\n } else if (initDate.year === maxDate.year) {\n start = 1;\n finish = maxDate.month;\n }\n\n for (var i = start; i <= finish; i++) {\n months.push(i);\n }\n\n return months;\n};\nvar isValidDay = function isValidDay(initDate, day, minDate, maxDate) {\n if (initDate.year === minDate.year && initDate.month === minDate.month) {\n return day >= minDate.day;\n }\n\n if (initDate.year === maxDate.year && initDate.month === maxDate.month) {\n return day <= maxDate.day;\n }\n\n return true;\n};\nvar setClassName = function setClassName(element, className) {\n element.className = className;\n};\nvar isValidDateString = function isValidDateString(str, sepChar) {\n if (!str) {\n return false;\n }\n\n var date = str.split(sepChar);\n return date.length === 3 && date[0].length === 4 && date[1].length === 2 && date[2].length === 2;\n};\nvar getDateFromString = function getDateFromString(str, sepChar) {\n var date = str.split(sepChar);\n return {\n year: parseInt(date[0]),\n month: parseInt(date[1]),\n day: parseInt(date[2])\n };\n};\nvar getDateToString = function getDateToString(y, m, d, sepChar) {\n return y + sepChar + addLeadingZero(m) + sepChar + addLeadingZero(d);\n};\nvar jalaliToday = function jalaliToday() {\n var date = new Date();\n var gy = parseInt(date.getFullYear());\n var gm = parseInt(date.getMonth()) + 1;\n var gd = parseInt(date.getDate());\n var jy, days;\n var gdm = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n\n if (gy > 1600) {\n jy = 979;\n gy -= 1600;\n } else {\n jy = 0;\n gy -= 621;\n }\n\n var gy2 = gm > 2 ? gy + 1 : gy;\n days = 365 * gy + parseInt((gy2 + 3) / 4) - parseInt((gy2 + 99) / 100) + parseInt((gy2 + 399) / 400) - 80 + gd + gdm[gm - 1];\n jy += 33 * parseInt(days / 12053);\n days %= 12053;\n jy += 4 * parseInt(days / 1461);\n days %= 1461;\n\n if (days > 365) {\n jy += parseInt((days - 1) / 365);\n days = (days - 1) % 365;\n }\n\n var jm = days < 186 ? 1 + parseInt(days / 31) : 7 + parseInt((days - 186) / 30);\n var jd = 1 + (days < 186 ? days % 31 : (days - 186) % 30);\n return {\n year: jy,\n month: jm,\n day: jd\n };\n};\nvar getScrollParent = function getScrollParent(node) {\n if ([\"html\", \"body\", \"#document\"].indexOf((node.nodeName || \"\").toLowerCase()) >= 0) {\n return node.ownerDocument.body;\n }\n\n if (node instanceof HTMLElement) {\n var _window$getComputedSt = window.getComputedStyle(node),\n overflow = _window$getComputedSt.overflow,\n overflowX = _window$getComputedSt.overflowX,\n overflowY = _window$getComputedSt.overflowY;\n\n if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX)) {\n return node;\n }\n }\n\n return getScrollParent(node.parentNode);\n};\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/utils.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"isNaN\": () => (/* binding */ isNaN),\n/* harmony export */ \"isNumber\": () => (/* binding */ isNumber),\n/* harmony export */ \"isUndefined\": () => (/* binding */ isUndefined),\n/* harmony export */ \"isString\": () => (/* binding */ isString),\n/* harmony export */ \"clon\": () => (/* binding */ clon),\n/* harmony export */ \"isLeapYear\": () => (/* binding */ isLeapYear),\n/* harmony export */ \"getDaysInMonth\": () => (/* binding */ getDaysInMonth),\n/* harmony export */ \"mod\": () => (/* binding */ mod),\n/* harmony export */ \"getDays\": () => (/* binding */ getDays),\n/* harmony export */ \"getDiffDays\": () => (/* binding */ getDiffDays),\n/* harmony export */ \"getWeekDay\": () => (/* binding */ getWeekDay),\n/* harmony export */ \"getYears\": () => (/* binding */ getYears),\n/* harmony export */ \"addLeadingZero\": () => (/* binding */ addLeadingZero),\n/* harmony export */ \"isPlainObject\": () => (/* binding */ isPlainObject),\n/* harmony export */ \"extend\": () => (/* binding */ extend),\n/* harmony export */ \"createElement\": () => (/* binding */ createElement),\n/* harmony export */ \"addListenerMulti\": () => (/* binding */ addListenerMulti),\n/* harmony export */ \"setInnerHTML\": () => (/* binding */ setInnerHTML),\n/* harmony export */ \"normalizeMinMaxDate\": () => (/* binding */ normalizeMinMaxDate),\n/* harmony export */ \"getValidMonths\": () => (/* binding */ getValidMonths),\n/* harmony export */ \"isValidDay\": () => (/* binding */ isValidDay),\n/* harmony export */ \"setClassName\": () => (/* binding */ setClassName),\n/* harmony export */ \"isValidDateString\": () => (/* binding */ isValidDateString),\n/* harmony export */ \"getDateFromString\": () => (/* binding */ getDateFromString),\n/* harmony export */ \"getDateToString\": () => (/* binding */ getDateToString),\n/* harmony export */ \"jalaliToday\": () => (/* binding */ jalaliToday),\n/* harmony export */ \"getScrollParent\": () => (/* binding */ getScrollParent)\n/* harmony export */ });\nvar _this = undefined;\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar isNaN = Number.isNaN || window.isNaN;\nvar isNumber = function isNumber(value) {\n return typeof value === \"number\" && !isNaN(value);\n};\nvar isUndefined = function isUndefined(value) {\n return typeof value === \"undefined\";\n};\nvar isString = function isString(value) {\n return typeof value === \"string\";\n};\nvar clon = function clon(a) {\n return JSON.parse(JSON.stringify(a));\n};\nvar isLeapYear = function isLeapYear(year) {\n return ((year - 474) % 2820 + 512) * 682 % 2816 < 682;\n};\nvar getDaysInMonth = function getDaysInMonth(year, month) {\n return [0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, isLeapYear(year) ? 30 : 29][month];\n};\nvar mod = function mod(a, b) {\n return window.Math.abs(a - b * window.Math.floor(a / b));\n};\nvar getDays = function getDays(month, day) {\n if (month < 8) return (month - 1) * 31 + day;\n return 6 * 31 + (month - 7) * 30 + day;\n};\nvar getDiffDays = function getDiffDays(year1, month1, day1, year2, month2, day2) {\n var diffDays = getDays(month2, day2) - getDays(month1, day1);\n var y1 = year1 < year2 ? year1 : year2;\n var y2 = year1 < year2 ? year2 : year1;\n\n for (var y = y1; y < y2; y++) {\n if (isLeapYear(y)) diffDays += year1 < year2 ? 366 : -366;else diffDays += year1 < year2 ? 365 : -365;\n }\n\n return diffDays;\n};\nvar getWeekDay = function getWeekDay(year, month, day) {\n return mod(getDiffDays(1392, 3, 25, year, month, day), 7);\n};\nvar getYears = function getYears(month, day) {\n return 6 * 31 + (month - 7) * 30 + day;\n};\nvar addLeadingZero = function addLeadingZero(value) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n var str = String(Math.abs(value));\n var i = str.length;\n var result = \"\";\n\n if (value < 0) {\n result += \"-\";\n }\n\n while (i < length) {\n i += 1;\n result += \"0\";\n }\n\n return result + str;\n};\nvar isPlainObject = function isPlainObject(obj) {\n if (!obj || !obj.constructor || obj.nodeType) {\n return false;\n }\n\n try {\n return JSON.stringify(obj) === \"{}\";\n } catch (e) {\n return true;\n }\n};\nvar extend = function extend() {\n var options;\n var src;\n var copy;\n var copyIsArray;\n var clone;\n\n for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {\n params[_key] = arguments[_key];\n }\n\n var target = params[0] || {};\n var i = 1;\n var length = params.length;\n var deep = false; // Handle a deep copy situation\n\n if (typeof target === \"boolean\") {\n deep = target; // Skip the boolean and the target\n\n target = params[i] || {};\n i += 1;\n } // Handle case when target is a string or something (possible in deep copy)\n\n\n if (_typeof(target) !== \"object\" && typeof target !== \"function\") {\n target = {};\n } // Extend jQuery itself if only one argument is passed\n\n\n if (i === length) {\n target = _this;\n i -= 1;\n }\n\n for (; i < length; i++) {\n options = params[i]; // Only deal with non-null/undefined values\n\n if (!isUndefined(options) && options !== null) {\n // Extend the base object\n for (var j = 0; j < window.Object.keys(options).length; j++) {\n var name = window.Object.keys(options)[j];\n\n if (Object.prototype.hasOwnProperty.call(options, name)) {\n copy = options[name]; // Prevent Object.prototype pollution\n // Prevent never-ending loop\n\n if (name === \"__proto__\" || target === copy) {\n return true;\n }\n\n copyIsArray = Array.isArray(copy); // Recurse if we're merging plain objects or arrays\n\n if (deep && copy && (isPlainObject(copy) || copyIsArray)) {\n src = target[name]; // Ensure proper type for the source value\n\n if (copyIsArray && !Array.isArray(src)) {\n clone = [];\n } else if (!copyIsArray && !isPlainObject(src)) {\n clone = {};\n } else {\n clone = src;\n } // Never move original objects, clone them\n\n\n target[name] = extend(deep, clone, copy); // Don't bring in undefined values\n } else if (!isUndefined(copy)) {\n target[name] = copy;\n }\n }\n }\n }\n } // Return the modified object\n\n\n return target;\n};\nvar createElement = function createElement(tag, parent, eventNames, event, content) {\n var splits = tag.split(\".\");\n tag = splits.shift() || \"div\";\n var className = splits;\n var element = window.document.createElement(tag);\n\n if (isString(parent)) {\n window.document.querySelector(parent).appendChild(element);\n } else {\n parent.appendChild(element);\n }\n\n if (className.length) {\n element.className = className.join(\" \");\n }\n\n if (eventNames && event) {\n addListenerMulti(element, eventNames, event);\n }\n\n if (!isUndefined(content)) {\n setInnerHTML(element, content);\n }\n\n return element;\n};\nvar addListenerMulti = function addListenerMulti(element, eventNames, listener) {\n var events = eventNames.split(\" \");\n\n for (var i = 0, iLen = events.length; i < iLen; i++) {\n element.addEventListener(events[i], listener, false);\n }\n};\nvar setInnerHTML = function setInnerHTML(element, html) {\n element.innerHTML = html;\n};\nvar normalizeMinMaxDate = function normalizeMinMaxDate(year, month, day, initDate, minDate, maxDate) {\n if (isNaN(year) || year < 1000 || year > 10000) {\n year = initDate.year;\n } else {\n if (year < minDate.year) {\n year = minDate.year;\n } else if (year > maxDate.year) {\n year = maxDate.year;\n }\n }\n\n if (isNaN(month) || month < 1 || month > 12) {\n month = initDate.month;\n } else {\n if (year <= minDate.year && month < minDate.month) {\n month = minDate.month;\n } else if (year >= maxDate.year && month > maxDate.month) {\n month = maxDate.month;\n }\n }\n\n if (isNaN(day) || day < 1) {\n day = initDate.day;\n } else {\n if (month <= minDate.month && day < minDate.day) {\n day = minDate.day;\n } else if (month >= maxDate.month && day > maxDate.day) {\n day = maxDate.day;\n }\n }\n\n return {\n year: parseInt(year),\n month: parseInt(month),\n day: parseInt(day)\n };\n};\nvar getValidMonths = function getValidMonths(initDate, minDate, maxDate) {\n var months = [];\n var start = 1;\n var finish = 12;\n\n if (initDate.year === minDate.year) {\n start = minDate.month;\n\n if (initDate.year === maxDate.year) {\n finish = maxDate.month;\n }\n } else if (initDate.year === maxDate.year) {\n start = 1;\n finish = maxDate.month;\n }\n\n for (var i = start; i <= finish; i++) {\n months.push(i);\n }\n\n return months;\n};\nvar isValidDay = function isValidDay(initDate, day, minDate, maxDate) {\n if (isPlainObject(minDate) && isPlainObject(maxDate)) {\n return true;\n }\n\n if (minDate.year === maxDate.year && minDate.month === maxDate.month) {\n return day >= minDate.day && day <= maxDate.day;\n }\n\n if (initDate.year === minDate.year && initDate.month === minDate.month) {\n return day >= minDate.day;\n }\n\n if (initDate.year === maxDate.year && initDate.month === maxDate.month) {\n return day <= maxDate.day;\n }\n\n return true;\n};\nvar setClassName = function setClassName(element, className) {\n element.className = className;\n};\nvar isValidDateString = function isValidDateString(str, sepChar) {\n if (!str) {\n return false;\n }\n\n var date = str.split(sepChar);\n return date.length === 3 && date[0].length === 4 && date[1].length === 2 && date[2].length === 2;\n};\nvar getDateFromString = function getDateFromString(str, sepChar) {\n var date = str.split(sepChar);\n return {\n year: parseInt(date[0]),\n month: parseInt(date[1]),\n day: parseInt(date[2])\n };\n};\nvar getDateToString = function getDateToString(y, m, d, sepChar) {\n return y + sepChar + addLeadingZero(m) + sepChar + addLeadingZero(d);\n};\nvar jalaliToday = function jalaliToday() {\n var date = new Date();\n var gy = parseInt(date.getFullYear());\n var gm = parseInt(date.getMonth()) + 1;\n var gd = parseInt(date.getDate());\n var jy, days;\n var gdm = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n\n if (gy > 1600) {\n jy = 979;\n gy -= 1600;\n } else {\n jy = 0;\n gy -= 621;\n }\n\n var gy2 = gm > 2 ? gy + 1 : gy;\n days = 365 * gy + parseInt((gy2 + 3) / 4) - parseInt((gy2 + 99) / 100) + parseInt((gy2 + 399) / 400) - 80 + gd + gdm[gm - 1];\n jy += 33 * parseInt(days / 12053);\n days %= 12053;\n jy += 4 * parseInt(days / 1461);\n days %= 1461;\n\n if (days > 365) {\n jy += parseInt((days - 1) / 365);\n days = (days - 1) % 365;\n }\n\n var jm = days < 186 ? 1 + parseInt(days / 31) : 7 + parseInt((days - 186) / 30);\n var jd = 1 + (days < 186 ? days % 31 : (days - 186) % 30);\n return {\n year: jy,\n month: jm,\n day: jd\n };\n};\nvar getScrollParent = function getScrollParent(node) {\n if ([\"html\", \"body\", \"#document\"].indexOf((node.nodeName || \"\").toLowerCase()) >= 0) {\n return node.ownerDocument.body;\n }\n\n if (node instanceof HTMLElement) {\n var _window$getComputedSt = window.getComputedStyle(node),\n overflow = _window$getComputedSt.overflow,\n overflowX = _window$getComputedSt.overflowX,\n overflowY = _window$getComputedSt.overflowY;\n\n if (/auto|scroll|overlay/.test(overflow + overflowY + overflowX)) {\n return node;\n }\n }\n\n return getScrollParent(node.parentNode);\n};\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/utils.js?"); | ||
@@ -62,0 +62,0 @@ /***/ }), |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";(()=>{var t=void 0;function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=Number.isNaN||window.isNaN,i=function(t){return void 0===t},a=function(t){return"string"==typeof t},o=function(t){return JSON.parse(JSON.stringify(t))},r=function(t){return 682*((t-474)%2820+512)%2816<682},s=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},h=function(t,n,e){return i=function(t,n,e,i,a,o){for(var h=s(a,o)-s(n,e),u=t<i?i:t,c=t<i?t:i;c<u;c++)r(c)?h+=t<i?366:-366:h+=t<i?365:-365;return h}(1392,3,25,t,n,e),a=7,window.Math.abs(i-a*window.Math.floor(i/a));var i,a},u=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},c=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},d=function e(){for(var a,o,r,s,h,u=arguments.length,d=new Array(u),p=0;p<u;p++)d[p]=arguments[p];var y=d[0]||{},l=1,f=d.length,m=!1;for("boolean"==typeof y&&(m=y,y=d[l]||{},l+=1),"object"!==n(y)&&"function"!=typeof y&&(y={}),l===f&&(y=t,l-=1);l<f;l++)if(a=d[l],!i(a)&&null!==a)for(var v=0;v<window.Object.keys(a).length;v++){var D=window.Object.keys(a)[v];if(Object.prototype.hasOwnProperty.call(a,D)){if(r=a[D],"__proto__"===D||y===r)return!0;s=Array.isArray(r),m&&r&&(c(r)||s)?(o=y[D],h=s&&!Array.isArray(o)?[]:s||c(o)?o:{},y[D]=e(m,h,r)):i(r)||(y[D]=r)}}return y},p=function(t,n,e,o,r){var s=t.split(".");t=s.shift()||"div";var h=s,u=window.document.createElement(t);return a(n)?window.document.querySelector(n).appendChild(u):n.appendChild(u),h.length&&(u.className=h.join(" ")),e&&o&&y(u,e,o),i(r)||l(u,r),u},y=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},l=function(t,n){t.innerHTML=n},f=function(t,n,i,a,o,r){return e(t)||t<1e3||t>1e4?t=a.year:t<o.year?t=o.year:t>r.year&&(t=r.year),e(n)||n<1||n>12?n=a.month:t<=o.year&&n<o.month?n=o.month:t>=r.year&&n>r.month&&(n=r.month),e(i)||i<1?i=a.day:n<=o.month&&i<o.day?i=o.day:n>=r.month&&i>r.day&&(i=r.day),{year:parseInt(t),month:parseInt(n),day:parseInt(i)}},m=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},v=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},D=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return n.ownerDocument.body;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay|hidden/.test(i+o+a))return n}return t(n.parentNode)},g="jdp",w="".concat(g,"-container"),_="div.".concat(g,"-years"),C="div.".concat(g,"-year"),b="div.".concat(g,"-months"),x="div.".concat(g,"-month"),I="div.".concat(g,"-days"),M="div.".concat(g,"-day"),S="div.".concat(g,"-day-name"),N="div.".concat(g,"-icon-plus"),j="div.".concat(g,"-icon-minus"),O="div.".concat(g,"-footer"),E="div.".concat(g,"-btn-today"),Y="div.".concat(g,"-btn-empty"),H="not-in-range",P=new Event("change"),k="click",L="focus",A="today",T="attr",z=("data-".concat(g),function(t){return 6===t?".".concat("last-week"):""}),B=function(t,n){p(N+(n?F.options.maxDate.year===F.initDate.year?".".concat(H):"":F.options.maxDate.year===F.initDate.year&&F.options.maxDate.month===F.initDate.month?".".concat(H):""),t,k,n?function(){F.increaseYear()}:function(){F.increaseMonth()},F.options.plusHtml)},W=function(t,n){p(j+(n?F.options.minDate.year===F.initDate.year?".".concat(H):"":F.options.minDate.year===F.initDate.year&&F.options.minDate.month===F.initDate.month?".".concat(H):""),t,k,n?function(){F.decreaseYear()}:function(){F.decreaseMonth()},F.options.minusHtml)},V=function(){var t=p(_,F.dpContainer);B(t,!0);var n=p(C,t);W(t,!0);var e=p("input",n,"keyup change",(function(t){F.yearChange(t.target.value)}));e.tabIndex=-1,e.value=F.initDate.year,e.type="number"},J=function(){var t=p(b,F.dpContainer);B(t,!1);var n=p(x,t);W(t,!1);var e=p("select",n,"change",(function(t){F.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t,n,e){var i=[],a=1,o=12;t.year===n.year?(a=n.month,t.year===e.year&&(o=e.month)):t.year===e.year&&(a=1,o=e.month);for(var r=a;r<=o;r++)i.push(r);return i}(F.initDate,F.options.minDate,F.options.maxDate),a=F.options.months,o=0;o<i.length;o++){var r=p("option",e);r.value=i[o],r.text=a[i[o]-1],r.selected=i[o]===F.initDate.month}},R=function(){for(var t=p(I,F.dpContainer),n=0;n<7;n++)p(S+z(n),t,null,null,F.options.days[n]);for(var e,i,a=(e=F.initDate.year,i=F.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,r(e)?30:29][i]),o=h(F.initDate.year,F.initDate.month,1),s=7*Math.ceil((o+a)/7)-1,u=1,c=function(n){var e,i,o,r,s=h(F.initDate.year,F.initDate.month,u),c=(e=F.initDate,i=u,o=F.options.minDate,r=F.options.maxDate,e.year===o.year&&e.month===o.month?i>=o.day:e.year!==r.year||e.month!==r.month||i<=r.day);if(u<=s&&n<s||u>a)return p(M,t),"continue";if(!c)return p(M,t),u+=1,"continue";var d=z(s);F.valueDate.day===u&&F.valueDate.year===F.initDate.year&&F.valueDate.month===F.initDate.month&&(d+=".".concat("selected")),F.today.day===u&&F.today.year===F.initDate.year&&F.today.month===F.initDate.month&&(d+=".".concat("today"));var y=p(M+d,t,null,null,u);y.day=u,y.addEventListener(k,(function(){F.setValue(F.initDate.year,F.initDate.month,y.day)})),u+=1},d=0;d<=s;d++)c(d)},q=function(){var t=p(O,F.dpContainer);F.options.showTodayBtn&&p(E,t,k,(function(){F.setValue(F.today.year,F.today.month,F.today.day)}),"امروز"),F.options.showEmptyBtn&&p(Y,t,k,(function(){F.setValue()}),"خالی")},F=null;const X={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0};var G="visible",K={init:function(t){var n;this.options=d(X,t),this.options=U(this.options),window.onresize=$,this.options.autoHide&&(document.body.onclick=Z),this.options.autoShow&&(n=this.options.selector,document.querySelectorAll(n).forEach((function(t){t.addEventListener(L,(function(){K.show(t)}))})))},options:X,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||p(w,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=o(this.input.value),a(this._valueDate)&&(m(this._valueDate,this.options.separatorChar)?this._valueDate=v(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||o(this.valueDate),c(this._initDate)&&(this._initDate=this.options.initDate||o(this.today)),a(this._initDate)&&m(this._initDate,this.options.separatorChar)&&(this._initDate=v(this._initDate,this.options.separatorChar)),f(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){l((F=this).dpContainer,""),V(),J(),R(),q()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=G,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){D(t).addEventListener("scroll",(function(){K.setPosition()}),{passive:!0})}(t)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===G){for(var t=0,n=0,e=this.input,i=D(this.input);e.offsetParent;)t+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;t+this.dpContainer.offsetWidth>=window.document.body.offsetWidth&&(t-=t+this.dpContainer.offsetWidth-(window.document.body.offsetWidth+10)),i&&(n-=i.scrollTop),this.dpContainer.style.left=t+"px",this.dpContainer.style.top=n+this.input.offsetHeight+"px"}},setValue:function(t,n,e){var i,a,o,r;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+u(a)+r+u(o)),this.input.dispatchEvent(P)},increaseMonth:function(){this.options.changeMonthRotateYear&&12===this._initDate.month&&this.increaseYear(),this.monthChange(12===this._initDate.month?1:this._initDate.month+1)},decreaseMonth:function(){this.options.changeMonthRotateYear&&1===this._initDate.month&&this.decreaseYear(),this.monthChange(1===this._initDate.month?12:this._initDate.month-1)},monthChange:function(t){this._initDate=f(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=f(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},Q=function(t,n){var e=K.input.getAttribute(t);return e=e===A?o(K.today):a(e)&&m(e,n)?v(e,n):{}},U=function(t){return t.minDate===A&&(t.minDate=o(K.today)),t.maxDate===A&&(t.maxDate=o(K.today)),t.minDate===T&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return Q("data-jdp-min-date",t.separatorChar)}})),t.maxDate===T&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return Q("data-jdp-max-date",t.separatorChar)}})),t};function Z(t){K.dpContainer.style.visibility===G&&-1===t.path.indexOf(K.dpContainer)&&-1===t.path.indexOf(K.input)&&K.hide()}function $(){K.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};K.init(t)},show:function(t){K.show(t)},hide:function(){K.hide()}}})()})(); | ||
(()=>{"use strict";(()=>{var t=void 0;function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=Number.isNaN||window.isNaN,i=function(t){return void 0===t},a=function(t){return"string"==typeof t},o=function(t){return JSON.parse(JSON.stringify(t))},r=function(t){return 682*((t-474)%2820+512)%2816<682},s=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},h=function(t,n,e){return i=function(t,n,e,i,a,o){for(var h=s(a,o)-s(n,e),u=t<i?i:t,c=t<i?t:i;c<u;c++)r(c)?h+=t<i?366:-366:h+=t<i?365:-365;return h}(1392,3,25,t,n,e),a=7,window.Math.abs(i-a*window.Math.floor(i/a));var i,a},u=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},c=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},d=function e(){for(var a,o,r,s,h,u=arguments.length,d=new Array(u),p=0;p<u;p++)d[p]=arguments[p];var y=d[0]||{},l=1,f=d.length,m=!1;for("boolean"==typeof y&&(m=y,y=d[l]||{},l+=1),"object"!==n(y)&&"function"!=typeof y&&(y={}),l===f&&(y=t,l-=1);l<f;l++)if(a=d[l],!i(a)&&null!==a)for(var v=0;v<window.Object.keys(a).length;v++){var D=window.Object.keys(a)[v];if(Object.prototype.hasOwnProperty.call(a,D)){if(r=a[D],"__proto__"===D||y===r)return!0;s=Array.isArray(r),m&&r&&(c(r)||s)?(o=y[D],h=s&&!Array.isArray(o)?[]:s||c(o)?o:{},y[D]=e(m,h,r)):i(r)||(y[D]=r)}}return y},p=function(t,n,e,o,r){var s=t.split(".");t=s.shift()||"div";var h=s,u=window.document.createElement(t);return a(n)?window.document.querySelector(n).appendChild(u):n.appendChild(u),h.length&&(u.className=h.join(" ")),e&&o&&y(u,e,o),i(r)||l(u,r),u},y=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},l=function(t,n){t.innerHTML=n},f=function(t,n,i,a,o,r){return e(t)||t<1e3||t>1e4?t=a.year:t<o.year?t=o.year:t>r.year&&(t=r.year),e(n)||n<1||n>12?n=a.month:t<=o.year&&n<o.month?n=o.month:t>=r.year&&n>r.month&&(n=r.month),e(i)||i<1?i=a.day:n<=o.month&&i<o.day?i=o.day:n>=r.month&&i>r.day&&(i=r.day),{year:parseInt(t),month:parseInt(n),day:parseInt(i)}},m=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},v=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},D=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return n.ownerDocument.body;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(i+o+a))return n}return t(n.parentNode)},g="jdp",w="".concat(g,"-container"),_="div.".concat(g,"-years"),C="div.".concat(g,"-year"),b="div.".concat(g,"-months"),x="div.".concat(g,"-month"),I="div.".concat(g,"-days"),M="div.".concat(g,"-day"),S="div.".concat(g,"-day-name"),N="div.".concat(g,"-icon-plus"),j="div.".concat(g,"-icon-minus"),O="div.".concat(g,"-footer"),E="div.".concat(g,"-btn-today"),Y="div.".concat(g,"-btn-empty"),H="not-in-range",P=new Event("change"),k="click",L="focus",A="today",T="attr",z=("data-".concat(g),function(t){return 6===t?".".concat("last-week"):""}),B=function(t,n){p(N+(n?F.options.maxDate.year===F.initDate.year?".".concat(H):"":F.options.maxDate.year===F.initDate.year&&F.options.maxDate.month===F.initDate.month?".".concat(H):""),t,k,n?function(){F.increaseYear()}:function(){F.increaseMonth()},F.options.plusHtml)},W=function(t,n){p(j+(n?F.options.minDate.year===F.initDate.year?".".concat(H):"":F.options.minDate.year===F.initDate.year&&F.options.minDate.month===F.initDate.month?".".concat(H):""),t,k,n?function(){F.decreaseYear()}:function(){F.decreaseMonth()},F.options.minusHtml)},V=function(){var t=p(_,F.dpContainer);B(t,!0);var n=p(C,t);W(t,!0);var e=p("input",n,"keyup change",(function(t){F.yearChange(t.target.value)}));e.tabIndex=-1,e.value=F.initDate.year,e.type="number"},J=function(){var t=p(b,F.dpContainer);B(t,!1);var n=p(x,t);W(t,!1);var e=p("select",n,"change",(function(t){F.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t,n,e){var i=[],a=1,o=12;t.year===n.year?(a=n.month,t.year===e.year&&(o=e.month)):t.year===e.year&&(a=1,o=e.month);for(var r=a;r<=o;r++)i.push(r);return i}(F.initDate,F.options.minDate,F.options.maxDate),a=F.options.months,o=0;o<i.length;o++){var r=p("option",e);r.value=i[o],r.text=a[i[o]-1],r.selected=i[o]===F.initDate.month}},R=function(){for(var t=p(I,F.dpContainer),n=0;n<7;n++)p(S+z(n),t,null,null,F.options.days[n]);for(var e,i,a=(e=F.initDate.year,i=F.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,r(e)?30:29][i]),o=h(F.initDate.year,F.initDate.month,1),s=7*Math.ceil((o+a)/7)-1,u=1,d=function(n){var e,i,o,r,s=h(F.initDate.year,F.initDate.month,u),d=(e=F.initDate,i=u,o=F.options.minDate,r=F.options.maxDate,!(!c(o)||!c(r))||(o.year===r.year&&o.month===r.month?i>=o.day&&i<=r.day:e.year===o.year&&e.month===o.month?i>=o.day:e.year!==r.year||e.month!==r.month||i<=r.day));if(u<=s&&n<s||u>a)return p(M,t),"continue";if(!d)return p(M,t),u+=1,"continue";var y=z(s);F.valueDate.day===u&&F.valueDate.year===F.initDate.year&&F.valueDate.month===F.initDate.month&&(y+=".".concat("selected")),F.today.day===u&&F.today.year===F.initDate.year&&F.today.month===F.initDate.month&&(y+=".".concat("today"));var l=p(M+y,t,null,null,u);l.day=u,l.addEventListener(k,(function(){F.setValue(F.initDate.year,F.initDate.month,l.day)})),u+=1},y=0;y<=s;y++)d(y)},q=function(){var t=p(O,F.dpContainer);F.options.showTodayBtn&&p(E,t,k,(function(){F.setValue(F.today.year,F.today.month,F.today.day)}),"امروز"),F.options.showEmptyBtn&&p(Y,t,k,(function(){F.setValue()}),"خالی")},F=null;const X={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0};var G="visible",K={init:function(t){var n;this.options=d(X,t),this.options=U(this.options),window.onresize=$,this.options.autoHide&&(document.body.onclick=Z),this.options.autoShow&&(n=this.options.selector,document.querySelectorAll(n).forEach((function(t){t.addEventListener(L,(function(){K.show(t)}))})))},options:X,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||p(w,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=o(this.input.value),a(this._valueDate)&&(m(this._valueDate,this.options.separatorChar)?this._valueDate=v(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||o(this.valueDate),c(this._initDate)&&(this._initDate=this.options.initDate||o(this.today)),a(this._initDate)&&m(this._initDate,this.options.separatorChar)&&(this._initDate=v(this._initDate,this.options.separatorChar)),f(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){l((F=this).dpContainer,""),V(),J(),R(),q()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=G,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){D(t).addEventListener("scroll",(function(){K.setPosition()}),{passive:!0})}(t)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===G){for(var t=0,n=0,e=this.input,i=D(this.input);e.offsetParent;)t+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;t+this.dpContainer.offsetWidth>=window.document.body.offsetWidth&&(t-=t+this.dpContainer.offsetWidth-(window.document.body.offsetWidth+10)),i&&(n-=i.scrollTop),this.dpContainer.style.left=t+"px",this.dpContainer.style.top=n+this.input.offsetHeight+"px"}},setValue:function(t,n,e){var i,a,o,r;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+u(a)+r+u(o)),this.input.dispatchEvent(P)},increaseMonth:function(){this.options.changeMonthRotateYear&&12===this._initDate.month&&this.increaseYear(),this.monthChange(12===this._initDate.month?1:this._initDate.month+1)},decreaseMonth:function(){this.options.changeMonthRotateYear&&1===this._initDate.month&&this.decreaseYear(),this.monthChange(1===this._initDate.month?12:this._initDate.month-1)},monthChange:function(t){this._initDate=f(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=f(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},Q=function(t,n){var e=K.input.getAttribute(t);return e=e===A?o(K.today):a(e)&&m(e,n)?v(e,n):{}},U=function(t){return t.minDate===A&&(t.minDate=o(K.today)),t.maxDate===A&&(t.maxDate=o(K.today)),t.minDate===T&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return Q("data-jdp-min-date",t.separatorChar)}})),t.maxDate===T&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return Q("data-jdp-max-date",t.separatorChar)}})),t};function Z(t){K.dpContainer.style.visibility===G&&-1===t.path.indexOf(K.dpContainer)&&-1===t.path.indexOf(K.input)&&K.hide()}function $(){K.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};K.init(t)},show:function(t){K.show(t)},hide:function(){K.hide()}}})()})(); |
@@ -9,3 +9,3 @@ { | ||
"main": "dist/jalaliDatepicker.min.js", | ||
"version": "0.1.4", | ||
"version": "0.1.6", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "date", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67652
443