UNPKG

np-date-picker-vue-3

Version:

An easy-to-use and customizable nepali date picker component powered by Vue 3

749 lines (748 loc) 34.5 kB
import { ref as k, computed as P, createElementBlock as M, openBlock as N, withModifiers as m3, withDirectives as q, createCommentVNode as j, createElementVNode as g, normalizeClass as G, vModelText as c3, toDisplayString as H, Fragment as W, renderList as B, vModelSelect as Z, normalizeStyle as h3, resolveComponent as g3, createVNode as z, mergeProps as x } from "vue"; function p3(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var $ = {}, J = {}, e3; function D3() { return e3 || (e3 = 1, function(e) { e.EPOCH = new Date(1943, 3, 14).getTime(), e.START_YEAR = 2e3, e.NEPALI_DATE_MAP = [[2e3, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365], [2001, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2002, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2003, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2004, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365], [2005, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2006, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2007, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2008, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365], [2009, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2010, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2011, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2012, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365], [2013, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2014, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2015, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2016, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365], [2017, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2018, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2019, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366], [2020, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2021, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2022, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365], [2023, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366], [2024, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2025, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2026, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2027, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365], [2028, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2029, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365], [2030, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2031, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365], [2032, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2033, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2034, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2035, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365], [2036, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2037, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2038, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2039, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365], [2040, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2041, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2042, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2043, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365], [2044, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2045, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2046, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2047, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2048, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2049, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365], [2050, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366], [2051, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2052, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2053, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365], [2054, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366], [2055, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2056, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30, 365], [2057, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2058, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 365], [2059, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2060, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2061, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2062, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31, 365], [2063, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2064, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2065, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2066, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31, 365], [2067, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2068, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2069, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2070, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30, 365], [2071, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2072, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30, 365], [2073, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31, 366], [2074, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2075, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2076, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365], [2077, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31, 366], [2078, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2079, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30, 365], [2080, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30, 365], [2081, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30, 366], [2082, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30, 365], [2083, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30, 365], [2084, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30, 365], [2085, 31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30, 366], [2086, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30, 365], [2087, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30, 366], [2088, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30, 365]], e.NEPALI_DATE_MAP.forEach(function(a, y, u) { a.push(a[13] + (y === 0 ? 0 : u[y - 1][14])); }); }(J)), J; } var K = {}, a3; function _3() { if (a3) return K; a3 = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.default = Y; var e = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], a = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], y = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], u = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], c = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], C = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], E = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], b = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"]; function T(r) { return r < 10 ? "0" + r : "" + r; } function A(r) { for (var l = "", h = 0; h < r.length; h += 1) l += c[r.charCodeAt(h) - 48]; return l; } function O(r) { return function(l) { return r <= 2 ? String(l.year).substring(2) : r === 3 ? String(l.year).substring(1) : l.year; }; } function o(r) { return function(l) { return r <= 2 ? A(String(l.year).substring(2)) : A(r === 3 ? String(l.year).substring(1) : String(l.year)); }; } function t(r) { return function(l) { return r === 1 ? String(l.month + 1) : r === 2 ? T(l.month + 1) : r === 3 ? a[l.month] : e[l.month]; }; } function s(r) { return function(l) { return r === 1 ? A(String(l.month + 1)) : r === 2 ? A(T(l.month + 1)) : r === 3 ? u[l.month] : y[l.month]; }; } function f(r) { return function(l) { return r === 1 ? String(l.day) : r === 2 ? T(l.day) : r === 3 ? C[l.getDay()] : n[l.getDay()]; }; } function v(r) { return function(l) { return r === 1 ? A(String(l.day)) : r === 2 ? A(T(l.day)) : r === 3 ? E[l.getDay()] : b[l.getDay()]; }; } function p(r) { return function() { return r; }; } var m = { Y: O, y: o, M: t, m: s, D: f, d: v }; function S(r) { return r in m; } function D(r) { for (var l = !1, h = "", w = "", I = 0, V = [], R = 0; R < r.length; R += 1) { var L = r[R]; if (L === w) { I += 1; continue; } if (w !== "" && (V.push(m[w](I)), w = "", I = 0), L === '"') { l = !l; continue; } !S(L) || l ? h += L : (h && (V.push(p(h)), h = ""), w = L, I = 1); } return h ? V.push(p(h)) : w && V.push(m[w](I)), V; } function Y(r, l) { return D(l).map(function(h) { return h(r); }).join(""); } return K; } var t3; function E3() { if (t3) return $; t3 = 1, Object.defineProperty($, "__esModule", { value: !0 }); var e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, a = /* @__PURE__ */ function() { function o(t, s) { for (var f = 0; f < s.length; f++) { var v = s[f]; v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(t, v.key, v); } } return function(t, s, f) { return s && o(t.prototype, s), f && o(t, f), t; }; }(), y = /* @__PURE__ */ function() { function o(t, s) { var f = [], v = !0, p = !1, m = void 0; try { for (var S = t[Symbol.iterator](), D; !(v = (D = S.next()).done) && (f.push(D.value), !(s && f.length === s)); v = !0) ; } catch (Y) { p = !0, m = Y; } finally { try { !v && S.return && S.return(); } finally { if (p) throw m; } } return f; } return function(t, s) { if (Array.isArray(t)) return t; if (Symbol.iterator in Object(t)) return o(t, s); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(), u = D3(), c = _3(), C = n(c); function n(o) { return o && o.__esModule ? o : { default: o }; } function E(o) { if (Array.isArray(o)) { for (var t = 0, s = Array(o.length); t < o.length; t++) s[t] = o[t]; return s; } else return Array.from(o); } function b(o, t) { if (!(o instanceof t)) throw new TypeError("Cannot call a class as a function"); } var T = 14; function A(o) { var t = o.split(/[-./]/, 3), s = t.map(function(r) { var l = parseInt(r, 10); if (Number.isNaN(l)) throw new Error("Invalid date"); return l; }), f = y(s, 3), v = f[0], p = f[1], m = p === void 0 ? 1 : p, S = f[2], D = S === void 0 ? 1 : S; if (v < u.START_YEAR || v >= u.START_YEAR + u.NEPALI_DATE_MAP.length) throw new Error("Nepal year out of range"); if (m < 1 || m > 12) throw new Error("Invalid nepali month must be between 1 - 12"); var Y = u.NEPALI_DATE_MAP[v - u.START_YEAR][m]; if (D < 1 || D > Y) throw new Error("Invalid nepali date must be between 1 - " + Y + " in " + v + " " + m); return [v, m - 1, D]; } var O = function() { function o() { if (b(this, o), arguments.length === 0) this.setEnglishDate(/* @__PURE__ */ new Date()); else if (arguments.length === 1) { var t = arguments.length <= 0 ? void 0 : arguments[0]; if ((typeof t > "u" ? "undefined" : e(t)) === "object") if (t instanceof Date) this.setEnglishDate(t); else if (t instanceof o) this.timestamp = t.timestamp, this.year = t.year, this.month = t.month, this.day = t.day; else if (typeof t == "number") this.setEnglishDate(new Date(t)); else throw new Error("Invalid date argument"); else if (typeof t == "string") this.set.apply(this, E(A(t))); else throw new Error("Invalid date argument"); } else if (arguments.length === 3) this.set(arguments.length <= 0 ? void 0 : arguments[0], arguments.length <= 1 ? void 0 : arguments[1], arguments.length <= 2 ? void 0 : arguments[2]); else throw new Error("Invalid argument syntax"); } return a(o, [{ key: "setEnglishDate", value: function(s) { this.timestamp = s; for (var f = Math.floor((this.timestamp - u.EPOCH) / 864e5), v = Math.floor(f / 366); f >= u.NEPALI_DATE_MAP[v][T]; ) v += 1; f -= u.NEPALI_DATE_MAP[v - 1][T]; var p = u.NEPALI_DATE_MAP[v]; for (this.year = p[0], this.month = 0; f >= p[this.month + 1]; ) this.month += 1, f -= p[this.month]; this.day = f + 1; } }, { key: "getEnglishDate", value: function() { return this.timestamp; } }, { key: "parse", value: function(s) { this.set.apply(this, E(A(s))); } }, { key: "getYear", value: function() { return this.year; } }, { key: "getMonth", value: function() { return this.month; } }, { key: "getDate", value: function() { return this.day; } }, { key: "getDay", value: function() { return this.timestamp.getDay(); } }, { key: "getHours", value: function() { return this.timestamp.getHours(); } }, { key: "getMinutes", value: function() { return this.timestamp.getMinutes(); } }, { key: "getSeconds", value: function() { return this.timestamp.getSeconds(); } }, { key: "getMilliseconds", value: function() { return this.timestamp.getMilliseconds(); } }, { key: "getTime", value: function() { return this.timestamp.getTime(); } }, { key: "setYear", value: function(s) { this.set(s, this.month, this.day); } }, { key: "setMonth", value: function(s) { this.set(this.year, s, this.day); } }, { key: "setDate", value: function(s) { this.set(this.year, this.month, s); } }, { key: "set", value: function(s, f, v) { for (var p = s + Math.floor(f / 12) - u.START_YEAR, m = u.NEPALI_DATE_MAP[p], S = m[T] - m[T - 1], D = f % 12, Y = D < 0 ? 12 + D : D, r = 0; r < Y; r += 1) S += m[r + 1]; S += v - 1, this.setEnglishDate(new Date(u.EPOCH + S * 864e5)); } }, { key: "format", value: function(s) { return (0, C.default)(this, s); } }, { key: "toString", value: function() { return this.year + "/" + (this.month + 1) + "/" + this.day; } }]), o; }(); return O.minimum = function() { return new Date(u.EPOCH); }, O.maximum = function() { return new Date(u.EPOCH + u.NEPALI_DATE_MAP[u.NEPALI_DATE_MAP.length - 1][T] * 864e5); }, $.default = O, $; } var S3 = E3(); const _ = /* @__PURE__ */ p3(S3), n3 = [ { year: 2e3, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2001, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2002, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2003, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2004, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2005, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2006, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2007, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2007, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2008, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31] }, { year: 2009, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2010, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2011, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2012, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30] }, { year: 2013, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2014, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2015, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2016, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30] }, { year: 2017, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2018, value: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2019, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2020, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2021, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2022, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30] }, { year: 2023, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2024, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2025, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2026, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2027, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2028, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2029, value: [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30] }, { year: 2030, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2031, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2032, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2033, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2034, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2035, value: [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31] }, { year: 2036, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2037, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2038, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2039, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30] }, { year: 2040, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2041, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2042, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2043, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30] }, { year: 2044, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2045, value: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2046, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2047, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2048, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2049, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30] }, { year: 2050, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2051, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2052, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2053, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30] }, { year: 2054, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2055, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2056, value: [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30] }, { year: 2057, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2058, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2059, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2060, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2061, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2062, value: [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31] }, { year: 2063, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2064, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2065, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2066, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31] }, { year: 2067, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2068, value: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2069, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2070, value: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30] }, { year: 2071, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2072, value: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2073, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31] }, { year: 2074, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2075, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2076, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30] }, { year: 2077, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2078, value: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2079, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2080, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30] }, { year: 2081, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31] }, { year: 2082, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30] }, { year: 2083, value: [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2084, value: [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2085, value: [31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30] }, { year: 2086, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2087, value: [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30] }, { year: 2088, value: [30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30] }, { year: 2089, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2090, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2091, value: [31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30] }, { year: 2092, value: [30, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2093, value: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2094, value: [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2095, value: [31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30] }, { year: 2096, value: [30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30] }, { year: 2097, value: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30] }, { year: 2098, value: [31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 29, 31] }, { year: 2099, value: [31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30] } ], Q = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], u3 = [ "Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra" ], o3 = [ "बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र" ], K3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ENGLISH_NEPALI_MONTH: u3, ENGLISH_WEEK: Q, NEPALI_MONTH: o3, NEPALI_WEEK: l3, YEAR_DATES: n3 }, Symbol.toStringTag, { value: "Module" })); function r3(e) { const a = k(e.modelValue === "" ? new _() : new _(e.modelValue)), y = k(e.calenderType === "Nepali"), u = k(e.calenderType === "English"), c = k(null), C = P(() => y.value ? a.value.format("yyyy") : a.value.format("YYYY")), n = k("dddd, dd mmmm"), E = k("DDDD, DD MMMM"), b = P(() => y.value ? a.value.format(n.value) : a.value.format(E.value)), T = P(() => y.value ? "आज" : "Today"), A = P(() => e.monthSelect === !1 && e.yearSelect === !1 ? y.value ? a.value.format("mmmm yyyy") : a.value.format("MMMM YYYY") : e.monthSelect === !1 ? y.value ? a.value.format("mmmm") : a.value.format("MMMM") : e.yearSelect === !1 ? y.value ? a.value.format("yyyy") : a.value.format("YYYY") : ""), O = P(() => y.value ? o3 : u3), o = P(() => a.value.year), t = P(() => (n3.forEach((i) => { i.year == a.value.year && i.value.forEach((d, U) => { U == a.value.month && (c.value = d); }); }), Array(c.value).fill().map((i, d) => new _(o.value, a.value.month, d + 1)))), s = P(() => y.value ? l3 : Q); function f(i) { return a.value = i, r(), a.value.format(e.format); } function v() { a.value.setMonth(h.value); } function p(i) { return a.value.getTime() === i.getTime(); } function m(i) { let d = new _(); return i.day == d.day && i.year == d.year && i.month == d.month; } function S() { return a.value = new _(), w(a.value.getMonth(), a.value.getYear()), r(), new _().format(e.format); } const D = k(!1); function Y() { D.value = !0, setTimeout(() => document.addEventListener("click", r), 200); } function r() { D.value = !1, document.removeEventListener("click", r); } const l = k(e.modelValue === "" ? new _().getYear() : new _(e.modelValue).getYear()), h = k(e.modelValue === "" ? new _().getMonth() : new _(e.modelValue).getMonth()); function w(i, d) { h.value = i, l.value = d; } function I() { a.value.setYear(l.value); } function V(i) { return new _(i).format("yyyy-mm-d"); } function R(i) { return V(i).substr(8, 10); } function L() { let i = a.value.month - 1, d = a.value.year; i < 0 && (d--, i = 11), w(i, d), a.value = new _(d, i, 1); } function s3() { let i = a.value.month + 1, d = a.value.year; i > 11 && (d++, i = 0), w(i, d), a.value = new _(d, i, 1); } const y3 = k(2001), f3 = k(87); function X(i) { return new _(i, 0, 1).format("yyyy-mm-d"); } function v3(i) { return X(i).substr(0, 4); } const F = k(null), d3 = P(() => { let i = new _(l.value, h.value, 1); return Q.forEach((d, U) => { i.format("DDD") === "Sun" ? F.value = 7 : i.format("DDD") === d && (F.value = U); }), F.value; }); return { // states date: a, formatNepali: y, formatEnglish: u, endDay: c, formattedYear: C, defaultDateFormat: n, defaultEnglishDateFormat: E, getToday: S, selectDate: f, formattedDate: b, formattedTodayText: T, formattedYearOrMonth: A, getMonthsList: O, year: o, days: t, weekdays: s, yearValue: l, monthValue: h, visible: D, // methods monthSelectChange: v, active: p, checkToday: m, setMonthAndYear: w, yearSelectChange: I, show: Y, hide: r, convertToNepali: V, getNepaliDays: R, // feature next-prev prev: L, next: s3, // others NepaliDate: _, // feature years numberOfYears: f3, getNepaliDateWithYear: X, getNepaliYears: v3, startingYear: y3, // feature week startMonthValue: F, startWeek: d3 }; } const i3 = (e, a) => { const y = e.__vccOpts || e; for (const [u, c] of a) y[u] = c; return y; }, M3 = { name: "NepaliDatePicker", props: { // format: {type: String, default: "yyyy-mm-dd"}, calenderType: { type: String, default: "Nepali" }, format: { type: String, default(e) { return e.calenderType === "English" ? "YYYY-MM-DD" : "yyyy-mm-dd"; } }, yearSelect: { type: Boolean, default: !0 }, monthSelect: { type: Boolean, default: !0 }, classValue: { type: String, default: "" }, placeholder: { type: String, default: "" }, modelValue: { type: String, default: "" } }, setup(e, a) { const { emit: y } = a, u = P({ get: () => e.modelValue, set: (b) => y("update:modelValue", b) }), { getToday: c, selectDate: C } = r3(e); function n(b) { u.value = C(b); } function E() { u.value = c(); } return { dateValue: u, /* useDate Starts */ ...r3(e), /* useDate Ends */ select: n, today: E }; } }, N3 = ["placeholder"], T3 = { class: "calendar__header" }, A3 = { class: "calendar__year" }, w3 = { class: "calendar__date" }, k3 = { class: "calendar__body" }, b3 = { class: "calendar__month" }, Y3 = ["label", "value"], P3 = ["value", "label"], C3 = { style: { padding: "3px" } }, V3 = { class: "calendar__weeks" }, O3 = { class: "calendar__days" }, I3 = ["onClick"], L3 = { class: "calendar__footer" }; function H3(e, a, y, u, c, C) { return N(), M("div", { class: "datepicker", onClick: a[9] || (a[9] = m3(() => { }, ["stop"])) }, [ q(g("input", { type: "text", "onUpdate:modelValue": a[0] || (a[0] = (n) => u.dateValue = n), onFocus: a[1] || (a[1] = (...n) => e.show && e.show(...n)), placeholder: y.placeholder, class: G(["mt-1 block w-full rounded-md shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 border-gray", y.classValue]) }, null, 42, N3), [ [c3, u.dateValue] ]), e.visible ? (N(), M("div", { key: 0, class: G(["calendar", { show: e.visible }]) }, [ g("div", T3, [ g("div", A3, H(e.formattedYear), 1), g("div", w3, H(e.formattedDate), 1) ]), g("div", k3, [ g("div", b3, [ g("button", { class: "calendar__month__prev", onClick: a[2] || (a[2] = (...n) => e.prev && e.prev(...n)) }, a[10] || (a[10] = [ g("b", null, ">", -1) ])), g("span", null, H(e.formattedYearOrMonth), 1), y.monthSelect ? q((N(), M("select", { key: 0, onChange: a[3] || (a[3] = (...n) => e.monthSelectChange && e.monthSelectChange(...n)), "onUpdate:modelValue": a[4] || (a[4] = (n) => e.monthValue = n), size: "mini", style: {} }, [ (N(!0), M(W, null, B(e.getMonthsList, (n, E) => (N(), M("option", { style: { "text-align-last": "center" }, key: n, label: n, value: E }, null, 8, Y3))), 128)) ], 544)), [ [Z, e.monthValue] ]) : j("", !0), y.yearSelect ? q((N(), M("select", { key: 1, onChange: a[5] || (a[5] = (...n) => e.yearSelectChange && e.yearSelectChange(...n)), "onUpdate:modelValue": a[6] || (a[6] = (n) => e.yearValue = n), size: "mini", style: { "margin-left": "5px" } }, [ (N(!0), M(W, null, B(e.numberOfYears, (n) => (N(), M("option", { style: { "text-align-last": "center" }, key: n, value: e.startingYear + (n - 1), label: e.formatNepali ? e.getNepaliDateWithYear(e.startingYear + (n - 1)).substr(0, 4) : e.startingYear + (n - 1) }, null, 8, P3))), 128)) ], 544)), [ [Z, e.yearValue] ]) : j("", !0), g("button", { icon: "el-icon-arrow-right", onClick: a[7] || (a[7] = (...n) => e.next && e.next(...n)) }, a[11] || (a[11] = [ g("b", null, ">", -1) ])) ]), g("div", C3, [ g("div", V3, [ (N(!0), M(W, null, B(e.weekdays, (n, E) => (N(), M("div", { style: { "font-weight": "bold" }, class: "calendar__weekday", key: E }, H(n), 1))), 128)) ]), g("div", O3, [ g("div", { class: "calendar__day_spacer", style: h3({ gridColumn: `span ${e.startWeek}` }) }, null, 4), (N(!0), M(W, null, B(e.days, (n, E) => (N(), M("div", { class: G([ "calendar__day", { selected: e.active(n) }, { today: e.checkToday(n) } ]), key: E, onClick: (b) => u.select(n) }, H(e.formatNepali ? e.convertToNepali(n).substr(8, 10) : n.day), 11, I3))), 128)) ]) ]) ]), g("div", L3, [ g("button", { onClick: a[8] || (a[8] = (...n) => u.today && u.today(...n)) }, H(e.formattedTodayText), 1) ]) ], 2)) : j("", !0) ]); } const R3 = /* @__PURE__ */ i3(M3, [["render", H3], ["__scopeId", "data-v-e3b4ebe7"]]), F3 = { components: { NepaliDatePicker: R3 }, props: { fromDate: {}, toDate: {}, format: { type: String, default: "yyyy-mm-dd" }, calenderType: { type: String, default: "Nepali" }, yearSelect: { type: Boolean, default: !0 }, monthSelect: { type: Boolean, default: !0 }, classValue: { type: String, default: "" }, placeholder: { type: String, default: "" } }, setup(e, { emit: a }) { function y(c) { a("update:fromDate", c); } function u(c) { a("update:toDate", c); } return { fromDateFn: y, toDateFn: u }; } }, W3 = { style: { display: "flex", "margin-bottom": "40px" } }; function B3(e, a, y, u, c, C) { const n = g3("NepaliDatePicker"); return N(), M("div", W3, [ z(n, x({ ...e.$attrs, ...e.$props }, { classValue: "form-control", placeholder: "From Date", "model-value": y.fromDate, "onUpdate:modelValue": u.fromDateFn }), null, 16, ["model-value", "onUpdate:modelValue"]), z(n, x({ ...e.$attrs, ...e.$props }, { style: { "margin-left": "30px" }, placeholder: "To Date", classValue: "form-control", "model-value": y.toDate, "onUpdate:modelValue": u.toDateFn }), null, 16, ["model-value", "onUpdate:modelValue"]) ]); } const U3 = /* @__PURE__ */ i3(F3, [["render", B3]]); export { K3 as CONSTANT, U3 as DateRangePicker, R3 as NepaliDatePicker, r3 as useDate };