np-date-picker-vue-3
Version:
An easy-to-use and customizable nepali date picker component powered by Vue 3
781 lines (780 loc) • 34.8 kB
JavaScript
import { ref as V, computed as H, mergeModels as f3, useModel as e3, createElementBlock as b, openBlock as Y, withModifiers as g3, withDirectives as Q, createCommentVNode as X, createElementVNode as E, normalizeClass as Z, unref as s, vModelText as p3, toDisplayString as W, isRef as r3, Fragment as q, renderList as U, vModelSelect as n3, normalizeStyle as _3, createVNode as l3, mergeProps as u3 } from "vue";
function D3(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var j = {}, z = {}, o3;
function E3() {
return o3 || (o3 = 1, function(r) {
r.EPOCH = new Date(1943, 3, 14).getTime(), r.START_YEAR = 2e3, r.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]], r.NEPALI_DATE_MAP.forEach(function(n, d, v) {
n.push(n[13] + (d === 0 ? 0 : v[d - 1][14]));
});
}(z)), z;
}
var G = {}, i3;
function S3() {
if (i3) return G;
i3 = 1, Object.defineProperty(G, "__esModule", {
value: !0
}), G.default = k;
var r = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], n = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], d = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], v = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], A = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], T = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], P = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], I = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], F = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"];
function N(t) {
return t < 10 ? "0" + t : "" + t;
}
function M(t) {
for (var a = "", h = 0; h < t.length; h += 1)
a += A[t.charCodeAt(h) - 48];
return a;
}
function C(t) {
return function(a) {
return t <= 2 ? String(a.year).substring(2) : t === 3 ? String(a.year).substring(1) : a.year;
};
}
function l(t) {
return function(a) {
return t <= 2 ? M(String(a.year).substring(2)) : M(t === 3 ? String(a.year).substring(1) : String(a.year));
};
}
function e(t) {
return function(a) {
return t === 1 ? String(a.month + 1) : t === 2 ? N(a.month + 1) : t === 3 ? n[a.month] : r[a.month];
};
}
function u(t) {
return function(a) {
return t === 1 ? M(String(a.month + 1)) : t === 2 ? M(N(a.month + 1)) : t === 3 ? v[a.month] : d[a.month];
};
}
function y(t) {
return function(a) {
return t === 1 ? String(a.day) : t === 2 ? N(a.day) : t === 3 ? T[a.getDay()] : P[a.getDay()];
};
}
function f(t) {
return function(a) {
return t === 1 ? M(String(a.day)) : t === 2 ? M(N(a.day)) : t === 3 ? I[a.getDay()] : F[a.getDay()];
};
}
function _(t) {
return function() {
return t;
};
}
var c = {
Y: C,
y: l,
M: e,
m: u,
D: y,
d: f
};
function D(t) {
return t in c;
}
function g(t) {
for (var a = !1, h = "", w = "", L = 0, O = [], $ = 0; $ < t.length; $ += 1) {
var R = t[$];
if (R === w) {
L += 1;
continue;
}
if (w !== "" && (O.push(c[w](L)), w = "", L = 0), R === '"') {
a = !a;
continue;
}
!D(R) || a ? h += R : (h && (O.push(_(h)), h = ""), w = R, L = 1);
}
return h ? O.push(_(h)) : w && O.push(c[w](L)), O;
}
function k(t, a) {
return g(a).map(function(h) {
return h(t);
}).join("");
}
return G;
}
var s3;
function M3() {
if (s3) return j;
s3 = 1, Object.defineProperty(j, "__esModule", {
value: !0
});
var r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
return typeof l;
} : function(l) {
return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
}, n = /* @__PURE__ */ function() {
function l(e, u) {
for (var y = 0; y < u.length; y++) {
var f = u[y];
f.enumerable = f.enumerable || !1, f.configurable = !0, "value" in f && (f.writable = !0), Object.defineProperty(e, f.key, f);
}
}
return function(e, u, y) {
return u && l(e.prototype, u), y && l(e, y), e;
};
}(), d = /* @__PURE__ */ function() {
function l(e, u) {
var y = [], f = !0, _ = !1, c = void 0;
try {
for (var D = e[Symbol.iterator](), g; !(f = (g = D.next()).done) && (y.push(g.value), !(u && y.length === u)); f = !0)
;
} catch (k) {
_ = !0, c = k;
} finally {
try {
!f && D.return && D.return();
} finally {
if (_) throw c;
}
}
return y;
}
return function(e, u) {
if (Array.isArray(e))
return e;
if (Symbol.iterator in Object(e))
return l(e, u);
throw new TypeError("Invalid attempt to destructure non-iterable instance");
};
}(), v = E3(), A = S3(), T = P(A);
function P(l) {
return l && l.__esModule ? l : { default: l };
}
function I(l) {
if (Array.isArray(l)) {
for (var e = 0, u = Array(l.length); e < l.length; e++)
u[e] = l[e];
return u;
} else
return Array.from(l);
}
function F(l, e) {
if (!(l instanceof e))
throw new TypeError("Cannot call a class as a function");
}
var N = 14;
function M(l) {
var e = l.split(/[-./]/, 3), u = e.map(function(t) {
var a = parseInt(t, 10);
if (Number.isNaN(a))
throw new Error("Invalid date");
return a;
}), y = d(u, 3), f = y[0], _ = y[1], c = _ === void 0 ? 1 : _, D = y[2], g = D === void 0 ? 1 : D;
if (f < v.START_YEAR || f >= v.START_YEAR + v.NEPALI_DATE_MAP.length)
throw new Error("Nepal year out of range");
if (c < 1 || c > 12)
throw new Error("Invalid nepali month must be between 1 - 12");
var k = v.NEPALI_DATE_MAP[f - v.START_YEAR][c];
if (g < 1 || g > k)
throw new Error("Invalid nepali date must be between 1 - " + k + " in " + f + " " + c);
return [f, c - 1, g];
}
var C = function() {
function l() {
if (F(this, l), arguments.length === 0)
this.setEnglishDate(/* @__PURE__ */ new Date());
else if (arguments.length === 1) {
var e = arguments.length <= 0 ? void 0 : arguments[0];
if ((typeof e > "u" ? "undefined" : r(e)) === "object")
if (e instanceof Date)
this.setEnglishDate(e);
else if (e instanceof l)
this.timestamp = e.timestamp, this.year = e.year, this.month = e.month, this.day = e.day;
else if (typeof e == "number")
this.setEnglishDate(new Date(e));
else
throw new Error("Invalid date argument");
else if (typeof e == "string")
this.set.apply(this, I(M(e)));
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 n(l, [{
key: "setEnglishDate",
value: function(u) {
this.timestamp = u;
for (var y = Math.floor((this.timestamp - v.EPOCH) / 864e5), f = Math.floor(y / 366); y >= v.NEPALI_DATE_MAP[f][N]; )
f += 1;
y -= v.NEPALI_DATE_MAP[f - 1][N];
var _ = v.NEPALI_DATE_MAP[f];
for (this.year = _[0], this.month = 0; y >= _[this.month + 1]; )
this.month += 1, y -= _[this.month];
this.day = y + 1;
}
}, {
key: "getEnglishDate",
value: function() {
return this.timestamp;
}
}, {
key: "parse",
value: function(u) {
this.set.apply(this, I(M(u)));
}
}, {
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(u) {
this.set(u, this.month, this.day);
}
}, {
key: "setMonth",
value: function(u) {
this.set(this.year, u, this.day);
}
}, {
key: "setDate",
value: function(u) {
this.set(this.year, this.month, u);
}
}, {
key: "set",
value: function(u, y, f) {
for (var _ = u + Math.floor(y / 12) - v.START_YEAR, c = v.NEPALI_DATE_MAP[_], D = c[N] - c[N - 1], g = y % 12, k = g < 0 ? 12 + g : g, t = 0; t < k; t += 1)
D += c[t + 1];
D += f - 1, this.setEnglishDate(new Date(v.EPOCH + D * 864e5));
}
}, {
key: "format",
value: function(u) {
return (0, T.default)(this, u);
}
}, {
key: "toString",
value: function() {
return this.year + "/" + (this.month + 1) + "/" + this.day;
}
}]), l;
}();
return C.minimum = function() {
return new Date(v.EPOCH);
}, C.maximum = function() {
return new Date(v.EPOCH + v.NEPALI_DATE_MAP[v.NEPALI_DATE_MAP.length - 1][N] * 864e5);
}, j.default = C, j;
}
var A3 = M3();
const S = /* @__PURE__ */ D3(A3), v3 = [
{ 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] }
], t3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], d3 = [
"आइत",
"सोम",
"मंगल",
"बुध",
"बिहि",
"शुक्र",
"शनि"
], m3 = [
"Baisakh",
"Jestha",
"Asar",
"Shrawan",
"Bhadra",
"Aswin",
"Kartik",
"Mangsir",
"Poush",
"Magh",
"Falgun",
"Chaitra"
], c3 = [
"बैशाख",
"जेठ",
"असार",
"श्रावण",
"भाद्र",
"आश्विन",
"कार्तिक",
"मंसिर",
"पौष",
"माघ",
"फाल्गुण",
"चैत्र"
], B3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ENGLISH_NEPALI_MONTH: m3,
ENGLISH_WEEK: t3,
NEPALI_MONTH: c3,
NEPALI_WEEK: d3,
YEAR_DATES: v3
}, Symbol.toStringTag, { value: "Module" }));
function T3(r) {
const n = V(
r.modelValue === "" ? new S() : new S(r.modelValue)
), d = V(r.calenderType === "Nepali"), v = V(r.calenderType === "English"), A = V(null), T = H(
() => d.value ? n.value.format("yyyy") : n.value.format("YYYY")
), P = V("dddd, dd mmmm"), I = V("DDDD, DD MMMM"), F = H(
() => d.value ? n.value.format(P.value) : n.value.format(I.value)
), N = H(
() => d.value ? "आज" : "Today"
), M = H(() => r.monthSelect === !1 && r.yearSelect === !1 ? d.value ? n.value.format("mmmm yyyy") : n.value.format("MMMM YYYY") : r.monthSelect === !1 ? d.value ? n.value.format("mmmm") : n.value.format("MMMM") : r.yearSelect === !1 ? d.value ? n.value.format("yyyy") : n.value.format("YYYY") : ""), C = H(
() => d.value ? c3 : m3
), l = H(() => n.value.year), e = H(() => (v3.forEach((o) => {
o.year == n.value.year && o.value.forEach((p, J) => {
J == n.value.month && (A.value = p);
});
}), Array(A.value).fill().map((o, p) => new S(l.value, n.value.month, p + 1)))), u = H(
() => d.value ? d3 : t3
);
function y(o) {
return n.value = o, t(), n.value.format(r.format);
}
function f() {
n.value.setMonth(h.value);
}
function _(o) {
return n.value.getTime() === o.getTime();
}
function c(o) {
let p = new S();
return o.day == p.day && o.year == p.year && o.month == p.month;
}
function D() {
return n.value = new S(), w(n.value.getMonth(), n.value.getYear()), t(), new S().format(r.format);
}
const g = V(!1);
function k() {
g.value = !0, setTimeout(() => document.addEventListener("click", t), 200);
}
function t() {
g.value = !1, document.removeEventListener("click", t);
}
const a = V(
r.modelValue === "" ? new S().getYear() : new S(r.modelValue).getYear()
), h = V(
r.modelValue === "" ? new S().getMonth() : new S(r.modelValue).getMonth()
);
function w(o, p) {
h.value = o, a.value = p;
}
function L() {
n.value.setYear(a.value);
}
function O(o) {
return new S(o).format("yyyy-mm-d");
}
function $(o) {
return O(o).substr(8, 10);
}
function R() {
let o = n.value.month - 1, p = n.value.year;
o < 0 && (p--, o = 11), w(o, p), n.value = new S(p, o, 1);
}
function B() {
let o = n.value.month + 1, p = n.value.year;
o > 11 && (p++, o = 0), w(o, p), n.value = new S(p, o, 1);
}
const m = V(2001), i = V(87);
function x(o) {
return new S(o, 0, 1).format("yyyy-mm-d");
}
function a3(o) {
return x(o).substr(0, 4);
}
const K = V(null), h3 = H(() => {
let o = new S(a.value, h.value, 1);
return t3.forEach((p, J) => {
o.format("DDD") === "Sun" ? K.value = 7 : o.format("DDD") === p && (K.value = J);
}), K.value;
});
return {
// states
date: n,
formatNepali: d,
formatEnglish: v,
endDay: A,
formattedYear: T,
defaultDateFormat: P,
defaultEnglishDateFormat: I,
getToday: D,
selectDate: y,
formattedDate: F,
formattedTodayText: N,
formattedYearOrMonth: M,
getMonthsList: C,
year: l,
days: e,
weekdays: u,
yearValue: a,
monthValue: h,
visible: g,
// methods
monthSelectChange: f,
active: _,
checkToday: c,
setMonthAndYear: w,
yearSelectChange: L,
show: k,
hide: t,
convertToNepali: O,
getNepaliDays: $,
// feature next-prev
prev: R,
next: B,
// others
NepaliDate: S,
// feature years
numberOfYears: i,
getNepaliDateWithYear: x,
getNepaliYears: a3,
startingYear: m,
// feature week
startMonthValue: K,
startWeek: h3
};
}
const N3 = (r, n) => {
const d = r.__vccOpts || r;
for (const [v, A] of n)
d[v] = A;
return d;
}, w3 = ["placeholder"], k3 = { class: "calendar__header" }, b3 = { class: "calendar__year" }, Y3 = { class: "calendar__date" }, P3 = { class: "calendar__body" }, V3 = { class: "calendar__month" }, C3 = ["label", "value"], O3 = ["value", "label"], I3 = { style: { padding: "3px" } }, L3 = { class: "calendar__weeks" }, R3 = { class: "calendar__days" }, H3 = ["onClick"], x3 = { class: "calendar__footer" }, F3 = {
__name: "NepaliDatePicker",
props: /* @__PURE__ */ f3({
calenderType: { type: String, default: "Nepali" },
format: {
type: String,
default(r) {
return r.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: { default: "" },
modelModifiers: {}
}),
emits: ["update:modelValue"],
setup(r) {
const n = r, d = e3(r, "modelValue"), {
getToday: v,
selectDate: A,
monthValue: T,
formattedYear: P,
formattedDate: I,
formattedYearOrMonth: F,
getMonthsList: N,
yearSelectChange: M,
yearValue: C,
numberOfYears: l,
startingYear: e,
monthSelectChange: u,
weekdays: y,
days: f,
startWeek: _,
visible: c,
show: D,
prev: g,
next: k,
active: t,
checkToday: a,
formatNepali: h,
convertToNepali: w,
formattedTodayText: L,
getNepaliDateWithYear: O
} = T3(n);
function $(B) {
d.value = A(B);
}
function R() {
d.value = v();
}
return (B, m) => (Y(), b("div", {
class: "datepicker",
onClick: m[8] || (m[8] = g3(() => {
}, ["stop"]))
}, [
Q(E("input", {
type: "text",
"onUpdate:modelValue": m[0] || (m[0] = (i) => d.value = i),
onFocus: m[1] || (m[1] = (...i) => s(D) && s(D)(...i)),
placeholder: r.placeholder,
class: Z(["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", r.classValue])
}, null, 42, w3), [
[p3, d.value]
]),
s(c) ? (Y(), b("div", {
key: 0,
class: Z(["calendar", { show: s(c) }])
}, [
E("div", k3, [
E("div", b3, W(s(P)), 1),
E("div", Y3, W(s(I)), 1)
]),
E("div", P3, [
E("div", V3, [
E("button", {
class: "calendar__month__prev",
onClick: m[2] || (m[2] = (...i) => s(g) && s(g)(...i))
}, m[9] || (m[9] = [
E("b", null, ">", -1)
])),
E("span", null, W(s(F)), 1),
r.monthSelect ? Q((Y(), b("select", {
key: 0,
onChange: m[3] || (m[3] = (...i) => s(u) && s(u)(...i)),
"onUpdate:modelValue": m[4] || (m[4] = (i) => r3(T) ? T.value = i : null),
size: "mini",
style: {}
}, [
(Y(!0), b(q, null, U(s(N), (i, x) => (Y(), b("option", {
style: { "text-align-last": "center" },
key: i,
label: i,
value: x
}, null, 8, C3))), 128))
], 544)), [
[n3, s(T)]
]) : X("", !0),
r.yearSelect ? Q((Y(), b("select", {
key: 1,
onChange: m[5] || (m[5] = (...i) => s(M) && s(M)(...i)),
"onUpdate:modelValue": m[6] || (m[6] = (i) => r3(C) ? C.value = i : null),
size: "mini",
style: { "margin-left": "5px" }
}, [
(Y(!0), b(q, null, U(s(l), (i) => (Y(), b("option", {
style: { "text-align-last": "center" },
key: i,
value: s(e) + (i - 1),
label: s(h) ? s(O)(s(e) + (i - 1)).substr(0, 4) : s(e) + (i - 1)
}, null, 8, O3))), 128))
], 544)), [
[n3, s(C)]
]) : X("", !0),
E("button", {
icon: "el-icon-arrow-right",
onClick: m[7] || (m[7] = (...i) => s(k) && s(k)(...i))
}, m[10] || (m[10] = [
E("b", null, ">", -1)
]))
]),
E("div", I3, [
E("div", L3, [
(Y(!0), b(q, null, U(s(y), (i, x) => (Y(), b("div", {
style: { "font-weight": "bold" },
class: "calendar__weekday",
key: x
}, W(i), 1))), 128))
]),
E("div", R3, [
E("div", {
class: "calendar__day_spacer",
style: _3({ gridColumn: `span ${s(_)}` })
}, null, 4),
(Y(!0), b(q, null, U(s(f), (i, x) => (Y(), b("div", {
class: Z([
"calendar__day",
{ selected: s(t)(i) },
{ today: s(a)(i) }
]),
key: x,
onClick: (a3) => $(i)
}, W(s(h) ? s(w)(i).substr(8, 10) : i.day), 11, H3))), 128))
])
])
]),
E("div", x3, [
E("button", { onClick: R }, W(s(L)), 1)
])
], 2)) : X("", !0)
]));
}
}, y3 = /* @__PURE__ */ N3(F3, [["__scopeId", "data-v-ca718903"]]), $3 = { style: { display: "flex", "margin-bottom": "40px" } }, K3 = /* @__PURE__ */ Object.assign({
inheritAttrs: !1
}, {
__name: "DateRangePicker",
props: /* @__PURE__ */ f3({
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: "" }
}, {
fromDate: {},
fromDateModifiers: {},
toDate: {},
toDateModifiers: {}
}),
emits: ["update:fromDate", "update:toDate"],
setup(r) {
const n = r, d = e3(r, "fromDate"), v = e3(r, "toDate");
return (A, T) => (Y(), b("div", $3, [
l3(y3, u3({
modelValue: d.value,
"onUpdate:modelValue": T[0] || (T[0] = (P) => d.value = P)
}, { ...A.$attrs, ...n }, {
classValue: "form-control",
placeholder: "From Date"
}), null, 16, ["modelValue"]),
l3(y3, u3({
modelValue: v.value,
"onUpdate:modelValue": T[1] || (T[1] = (P) => v.value = P)
}, { ...A.$attrs, ...n }, {
style: { "margin-left": "30px" },
placeholder: "To Date",
classValue: "form-control"
}), null, 16, ["modelValue"])
]));
}
});
export {
B3 as CONSTANT,
K3 as DateRangePicker,
y3 as NepaliDatePicker,
T3 as useDate
};
//# sourceMappingURL=np-date-picker-vue-3.es.js.map