bs-ad-calendar-react 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bs-ad-calendar.css +1 -1
- package/dist/bs-ad-calendar.js +510 -485
- package/dist/bs-ad-calendar.umd.cjs +1 -1
- package/dist/hooks/useCalendar.d.ts +1 -1
- package/package.json +1 -1
package/dist/bs-ad-calendar.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as C, jsx as g, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as mt, useState as H, useEffect as Dt, useRef as xt } from "react";
|
|
3
|
+
const tt = [1943, 4, 14], Lt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Se = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], _ = [[[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365]];
|
|
4
4
|
let Rt = class extends Error {
|
|
5
5
|
constructor(t) {
|
|
6
6
|
super(t), this.name = "DateOutOfRangeError";
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
|
-
const _t = () =>
|
|
9
|
+
const _t = () => tt[0] + 1, jt = () => tt[0] + _.length - 1, Pt = () => 2e3, Wt = () => 2e3 + _.length - 1, yt = (e) => e % 400 === 0 || e % 4 === 0 && e % 100 !== 0, Ct = (e) => yt(e) ? Se : Lt, be = (e, t, n) => !(e < _t() || e > jt() || t < 1 || t > 12 || n < 1 || n > Ct(e)[t - 1]), Nt = (e, t, n) => {
|
|
10
10
|
let a = e * 365 + n;
|
|
11
11
|
for (let s = 0; s < t - 1; s++) a += Lt[s];
|
|
12
12
|
return t <= 2 && (e -= 1), a += Math.floor(e / 4) - Math.floor(e / 100) + Math.floor(e / 400), a;
|
|
13
13
|
};
|
|
14
14
|
function Ee(e, t, n) {
|
|
15
15
|
const a = t + 1;
|
|
16
|
-
if (!
|
|
17
|
-
let s = 2e3, r = 1, o = 1,
|
|
18
|
-
for (;
|
|
16
|
+
if (!be(e, a, n)) throw new Rt("Date out of range");
|
|
17
|
+
let s = 2e3, r = 1, o = 1, i = Math.abs(Nt(e, a, n) - Nt(...tt)), u = 0;
|
|
18
|
+
for (; i >= _[u][1]; ) i -= _[u][1], s += 1, u += 1;
|
|
19
19
|
let h = 0;
|
|
20
|
-
for (;
|
|
21
|
-
return o +=
|
|
20
|
+
for (; i >= _[u][0][h]; ) i -= _[u][0][h], r += 1, h += 1;
|
|
21
|
+
return o += i, [s, r - 1, o];
|
|
22
22
|
}
|
|
23
|
-
const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n >
|
|
23
|
+
const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n > _[e - 2e3][0][t - 1]), Ye = (e, t, n) => {
|
|
24
24
|
let a = n - 1;
|
|
25
25
|
const s = e - 2e3;
|
|
26
|
-
for (let r = 0; r < t - 1; r++) a +=
|
|
27
|
-
for (let r = 0; r < s; r++) a +=
|
|
26
|
+
for (let r = 0; r < t - 1; r++) a += _[s][0][r];
|
|
27
|
+
for (let r = 0; r < s; r++) a += _[r][1];
|
|
28
28
|
return a;
|
|
29
29
|
}, ke = (e, t, n) => {
|
|
30
30
|
const a = t + 1;
|
|
31
31
|
if (!we(e, a, n)) throw new Rt("Date out of range");
|
|
32
|
-
let [s, r, o] = [
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
for (;
|
|
36
|
-
const h =
|
|
32
|
+
let [s, r, o] = [tt[0], 1, 1];
|
|
33
|
+
const i = Ct(s).slice(0, tt[1] - 1).reduce((f, l) => f + l, 0) + tt[2] - 1;
|
|
34
|
+
let u = Math.abs(Ye(e, a, n) + i);
|
|
35
|
+
for (; u >= 366 && yt(s) || u >= 365 && !yt(s); ) u -= yt(s) ? 366 : 365, s += 1;
|
|
36
|
+
const h = Ct(s);
|
|
37
37
|
let c = 0;
|
|
38
|
-
for (;
|
|
39
|
-
return o +=
|
|
40
|
-
},
|
|
41
|
-
const t = e.getTime(), n = t < Ce ?
|
|
42
|
-
return { year: s, month0: r, day: o, hour:
|
|
43
|
-
},
|
|
44
|
-
const
|
|
45
|
-
let
|
|
46
|
-
const h = -1 *
|
|
47
|
-
return new Date(
|
|
38
|
+
for (; u >= h[c]; ) u -= h[c], r += 1, c += 1;
|
|
39
|
+
return o += u, [s, r - 1, o];
|
|
40
|
+
}, W = { enMinYear: _t, enMaxYear: jt, npMinYear: Pt, npMaxYear: Wt, englishToNepali: Ee, nepaliToEnglish: ke }, Ut = "en", T = "ne", Jt = 207e5, Kt = 198e5, Ce = 5049018e5, $e = new Date(1986, 0, 1, 0, 15), pt = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], $t = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Gt = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], Ae = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], At = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], vt = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ve = ["जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"], Fe = ["जन", "फेब", "मार", "अप्रि", "मे", "जुन", "जुला", "अग", "सेप", "अक्टो", "नोभे", "डिसे"], zt = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], et = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], St = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Vt = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], qt = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], xe = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g, Ne = (e) => {
|
|
41
|
+
const t = e.getTime(), n = t < Ce ? Kt : Jt, a = new Date(t + n), s = a.getUTCFullYear(), r = a.getUTCMonth(), o = a.getUTCDate(), i = a.getUTCHours(), u = a.getUTCMinutes(), h = a.getUTCSeconds(), c = a.getUTCMilliseconds(), f = a.getUTCDay();
|
|
42
|
+
return { year: s, month0: r, day: o, hour: i, minute: u, second: h, ms: c, weekDay: f };
|
|
43
|
+
}, Ht = (e, t, n, a, s, r, o) => {
|
|
44
|
+
const i = new Date(e, t, n, a, s, r, o);
|
|
45
|
+
let u = i < $e ? Kt : Jt;
|
|
46
|
+
const h = -1 * i.getTimezoneOffset() * 60 * 1e3;
|
|
47
|
+
return new Date(i.getTime() - u + h);
|
|
48
48
|
}, bt = (e) => {
|
|
49
49
|
const t = e.match(xe);
|
|
50
50
|
return t ? t.map((n) => n.startsWith("[") && n.endsWith("]") ? n.slice(1, -1) : n) : [];
|
|
51
|
-
},
|
|
51
|
+
}, R = (e) => {
|
|
52
52
|
if (e.length === 0) return new RegExp("");
|
|
53
53
|
let t = [...e];
|
|
54
54
|
if (t = t.sort((a, s) => s.length - a.length), t[0] === "") return new RegExp("");
|
|
55
55
|
const n = `(${t.join("|")})`;
|
|
56
56
|
return new RegExp(n);
|
|
57
|
-
}, x = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), He = (e) => e.split("").map((t) =>
|
|
57
|
+
}, x = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), He = (e) => e.split("").map((t) => zt[t.charCodeAt(0) - 48]).join(""), Y = (e, t) => {
|
|
58
58
|
const n = typeof e == "string" ? e : String(e);
|
|
59
|
-
return t !==
|
|
60
|
-
}, Oe = (e, t) =>
|
|
59
|
+
return t !== T ? n : He(n);
|
|
60
|
+
}, Oe = (e, t) => Y(e.getYear(), t).substring(2), Be = (e, t) => Y(e.getYear(), t), Te = (e, t) => Y(e.getEnglishYear(), t).substring(2), Ie = (e, t) => Y(e.getEnglishYear(), t), Le = (e, t) => Y(e.getMonth() + 1, t), Re = (e, t) => Y(x(e.getMonth() + 1), t), _e = (e, t) => t === T ? Ae[e.getMonth()] : $t[e.getMonth()], je = (e, t) => t === T ? Gt[e.getMonth()] : pt[e.getMonth()], Pe = (e, t) => Y(e.getEnglishMonth() + 1, t), We = (e, t) => Y(x(e.getEnglishMonth() + 1), t), Ue = (e, t) => t === T ? Fe[e.getEnglishMonth()] : vt[e.getEnglishMonth()], Je = (e, t) => t === T ? ve[e.getEnglishMonth()] : At[e.getEnglishMonth()], Ke = (e, t) => Y(e.getDate(), t), Ge = (e, t) => Y(x(e.getDate()), t), ze = (e, t) => Y(e.getEnglishDate(), t), Ve = (e, t) => Y(x(e.getEnglishDate()), t), Zt = (e, t) => Y(e.getDay(), t), ft = (e, t) => t === T ? Vt[e.getDay()] : et[e.getDay()], Qt = (e, t) => t === T ? qt[e.getDay()] : St[e.getDay()], te = (e, t) => Y(e.getHours(), t), ee = (e, t) => Y(x(e.getHours()), t), ne = (e, t) => {
|
|
61
61
|
const n = e.getHours(), a = n > 12 ? n - 12 : n;
|
|
62
|
-
return
|
|
62
|
+
return Y(a, t);
|
|
63
63
|
}, se = (e, t) => {
|
|
64
64
|
const n = e.getHours(), a = n > 12 ? n - 12 : n;
|
|
65
|
-
return
|
|
66
|
-
}, ae = (e, t) =>
|
|
67
|
-
const a = bt(t), s = (r) => r in Ht ? Ht[r](e, n) : r;
|
|
68
|
-
return a.map(s).join("");
|
|
69
|
-
}, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, L), Ze = (e) => {
|
|
70
|
-
const t = x(e.getYear()), n = x(e.getMonth() + 1), a = x(e.getDate()), s = x(e.getHours()), r = x(e.getMinutes()), o = x(e.getSeconds()), u = e.getMilliseconds(), i = u === 0 ? "" : `.${Xt(u)}`;
|
|
71
|
-
return `${t}-${n}-${a} ${s}:${r}:${o}${i}`;
|
|
72
|
-
}, Ot = { YY: Be, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: Ge, DD: ze, d: Zt, dd: Dt, ddd: Dt, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
|
|
65
|
+
return Y(x(a), t);
|
|
66
|
+
}, ae = (e, t) => Y(e.getMinutes(), t), re = (e, t) => Y(x(e.getMinutes()), t), oe = (e, t) => Y(e.getSeconds(), t), ie = (e, t) => Y(x(e.getSeconds()), t), ue = (e, t) => Y(Xt(e.getMilliseconds()), t), ce = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "PM" : "AM", he = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "pm" : "am", Ot = { YY: Oe, YYYY: Be, M: Le, MM: Re, MMM: _e, MMMM: je, D: Ke, DD: Ge, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, le = (e, t, n) => {
|
|
73
67
|
const a = bt(t), s = (r) => r in Ot ? Ot[r](e, n) : r;
|
|
74
68
|
return a.map(s).join("");
|
|
75
|
-
},
|
|
69
|
+
}, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, T), Ze = (e) => {
|
|
70
|
+
const t = x(e.getYear()), n = x(e.getMonth() + 1), a = x(e.getDate()), s = x(e.getHours()), r = x(e.getMinutes()), o = x(e.getSeconds()), i = e.getMilliseconds(), u = i === 0 ? "" : `.${Xt(i)}`;
|
|
71
|
+
return `${t}-${n}-${a} ${s}:${r}:${o}${u}`;
|
|
72
|
+
}, Bt = { YY: Te, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: ze, DD: Ve, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
|
|
73
|
+
const a = bt(t), s = (r) => r in Bt ? Bt[r](e, n) : r;
|
|
74
|
+
return a.map(s).join("");
|
|
75
|
+
}, Qe = (e, t) => de(e, t, Ut), t3 = (e, t) => de(e, t, T);
|
|
76
76
|
function e3(e) {
|
|
77
77
|
const t = e.split(/[-./]/, 3), [n, a = 1, s = 1] = t.map((r) => {
|
|
78
78
|
const o = parseInt(r, 10);
|
|
@@ -83,19 +83,19 @@ function e3(e) {
|
|
|
83
83
|
}
|
|
84
84
|
function n3(e) {
|
|
85
85
|
if (!e) return [0, 0, 0, 0];
|
|
86
|
-
const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((
|
|
87
|
-
const h = parseInt(
|
|
86
|
+
const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((u) => {
|
|
87
|
+
const h = parseInt(u, 10);
|
|
88
88
|
if (Number.isNaN(h)) throw new Error("Invalid time");
|
|
89
89
|
return h;
|
|
90
90
|
});
|
|
91
|
-
let
|
|
92
|
-
return Number.isNaN(
|
|
91
|
+
let i = parseInt(n, 10);
|
|
92
|
+
return Number.isNaN(i) && (i = 0), [s, r, o, i];
|
|
93
93
|
}
|
|
94
94
|
function s3(e) {
|
|
95
|
-
const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o,
|
|
96
|
-
return [a, s, r, o,
|
|
95
|
+
const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o, i, u, h] = n3(n);
|
|
96
|
+
return [a, s, r, o, i, u, h];
|
|
97
97
|
}
|
|
98
|
-
const Tt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM:
|
|
98
|
+
const Tt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(pt), MMM: R($t), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
|
|
99
99
|
function a3(e) {
|
|
100
100
|
const t = [], n = [];
|
|
101
101
|
for (const s of e) s in Tt ? (t.push(s), n.push(Tt[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
|
|
@@ -103,129 +103,129 @@ function a3(e) {
|
|
|
103
103
|
return { dateTokens: t, regex: new RegExp(`^${a}$`) };
|
|
104
104
|
}
|
|
105
105
|
function r3(e, t) {
|
|
106
|
-
let [n, a, s, r, o,
|
|
107
|
-
for (let
|
|
108
|
-
const
|
|
109
|
-
switch (
|
|
106
|
+
let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
|
|
107
|
+
for (let l = 0; l < e.length; l++) {
|
|
108
|
+
const $ = e[l], D = parseInt(t[l + 1]);
|
|
109
|
+
switch ($) {
|
|
110
110
|
case "YYYY":
|
|
111
|
-
n =
|
|
111
|
+
n = D;
|
|
112
112
|
break;
|
|
113
113
|
case "YY":
|
|
114
|
-
n = 2e3 + parseInt(t[
|
|
114
|
+
n = 2e3 + parseInt(t[l]);
|
|
115
115
|
break;
|
|
116
116
|
case "MM":
|
|
117
117
|
case "M":
|
|
118
|
-
a =
|
|
118
|
+
a = D;
|
|
119
119
|
break;
|
|
120
120
|
case "MMMM":
|
|
121
|
-
a =
|
|
121
|
+
a = pt.indexOf(t[l + 1]) + 1;
|
|
122
122
|
break;
|
|
123
123
|
case "MMM":
|
|
124
|
-
a =
|
|
124
|
+
a = $t.indexOf(t[l + 1]) + 1;
|
|
125
125
|
break;
|
|
126
126
|
case "DD":
|
|
127
127
|
case "D":
|
|
128
|
-
s =
|
|
128
|
+
s = D;
|
|
129
129
|
break;
|
|
130
130
|
case "HH":
|
|
131
131
|
case "H":
|
|
132
|
-
r =
|
|
132
|
+
r = D;
|
|
133
133
|
break;
|
|
134
134
|
case "hh":
|
|
135
135
|
case "h":
|
|
136
|
-
o =
|
|
136
|
+
o = D, f = !0;
|
|
137
137
|
break;
|
|
138
138
|
case "mm":
|
|
139
139
|
case "m":
|
|
140
|
-
|
|
140
|
+
i = D;
|
|
141
141
|
break;
|
|
142
142
|
case "ss":
|
|
143
143
|
case "s":
|
|
144
|
-
|
|
144
|
+
u = D;
|
|
145
145
|
break;
|
|
146
146
|
case "SSS":
|
|
147
|
-
h =
|
|
147
|
+
h = D;
|
|
148
148
|
break;
|
|
149
149
|
case "A":
|
|
150
150
|
case "a":
|
|
151
|
-
c = t[
|
|
151
|
+
c = t[l + 1].toLowerCase() === "pm";
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute:
|
|
154
|
+
return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
|
|
155
155
|
}
|
|
156
156
|
function ge(e, t) {
|
|
157
157
|
const n = bt(t), { dateTokens: a, regex: s } = a3(n), r = RegExp(s).exec(e);
|
|
158
158
|
if (!r) throw new Error("Invalid date format");
|
|
159
|
-
const { year: o, month0:
|
|
160
|
-
return [o,
|
|
159
|
+
const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = r3(a, r);
|
|
160
|
+
return [o, i, u, h, c, f, l];
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const It = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(At), MMM: R(vt), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
|
|
163
163
|
function o3(e) {
|
|
164
164
|
const t = [], n = [];
|
|
165
|
-
for (const s of e) s in
|
|
165
|
+
for (const s of e) s in It ? (t.push(s), n.push(It[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
|
|
166
166
|
const a = n.join("");
|
|
167
167
|
return { dateTokens: t, regex: new RegExp(`^${a}$`) };
|
|
168
168
|
}
|
|
169
169
|
function i3(e, t) {
|
|
170
|
-
let [n, a, s, r, o,
|
|
171
|
-
for (let
|
|
172
|
-
const
|
|
173
|
-
switch (
|
|
170
|
+
let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
|
|
171
|
+
for (let l = 0; l < e.length; l++) {
|
|
172
|
+
const $ = e[l], D = parseInt(t[l + 1]);
|
|
173
|
+
switch ($) {
|
|
174
174
|
case "YYYY":
|
|
175
|
-
n =
|
|
175
|
+
n = D;
|
|
176
176
|
break;
|
|
177
177
|
case "YY":
|
|
178
|
-
n = 2e3 + parseInt(t[
|
|
178
|
+
n = 2e3 + parseInt(t[l]);
|
|
179
179
|
break;
|
|
180
180
|
case "MM":
|
|
181
181
|
case "M":
|
|
182
|
-
a =
|
|
182
|
+
a = D;
|
|
183
183
|
break;
|
|
184
184
|
case "MMMM":
|
|
185
|
-
a = At.indexOf(t[
|
|
185
|
+
a = At.indexOf(t[l + 1]) + 1;
|
|
186
186
|
break;
|
|
187
187
|
case "MMM":
|
|
188
|
-
a =
|
|
188
|
+
a = vt.indexOf(t[l + 1]) + 1;
|
|
189
189
|
break;
|
|
190
190
|
case "DD":
|
|
191
191
|
case "D":
|
|
192
|
-
s =
|
|
192
|
+
s = D;
|
|
193
193
|
break;
|
|
194
194
|
case "HH":
|
|
195
195
|
case "H":
|
|
196
|
-
r =
|
|
196
|
+
r = D;
|
|
197
197
|
break;
|
|
198
198
|
case "hh":
|
|
199
199
|
case "h":
|
|
200
|
-
o =
|
|
200
|
+
o = D, f = !0;
|
|
201
201
|
break;
|
|
202
202
|
case "mm":
|
|
203
203
|
case "m":
|
|
204
|
-
|
|
204
|
+
i = D;
|
|
205
205
|
break;
|
|
206
206
|
case "ss":
|
|
207
207
|
case "s":
|
|
208
|
-
|
|
208
|
+
u = D;
|
|
209
209
|
break;
|
|
210
210
|
case "SSS":
|
|
211
|
-
h =
|
|
211
|
+
h = D;
|
|
212
212
|
break;
|
|
213
213
|
case "A":
|
|
214
214
|
case "a":
|
|
215
|
-
c = t[
|
|
215
|
+
c = t[l + 1].toLowerCase() === "pm";
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute:
|
|
218
|
+
return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
|
|
219
219
|
}
|
|
220
220
|
function u3(e, t) {
|
|
221
221
|
const n = bt(t), { dateTokens: a, regex: s } = o3(n), r = RegExp(s).exec(e);
|
|
222
222
|
if (!r) throw new Error("Invalid date format");
|
|
223
|
-
const { year: o, month0:
|
|
224
|
-
return [o,
|
|
223
|
+
const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = i3(a, r);
|
|
224
|
+
return [o, i, u, h, c, f, l];
|
|
225
225
|
}
|
|
226
226
|
function c3(e) {
|
|
227
227
|
const t = { एम: "AM", पिम: "PM" };
|
|
228
|
-
|
|
228
|
+
Gt.forEach((a, s) => t[a] = pt[s]), qt.forEach((a, s) => t[a] = St[s]), Vt.forEach((a, s) => t[a] = et[s]), zt.forEach((a, s) => t[a] = String(s));
|
|
229
229
|
const n = new RegExp(Object.keys(t).join("|"), "g");
|
|
230
230
|
return e.replace(n, (a) => t[a]);
|
|
231
231
|
}
|
|
@@ -233,23 +233,23 @@ function h3(e, t) {
|
|
|
233
233
|
const n = c3(e);
|
|
234
234
|
return ge(n, t);
|
|
235
235
|
}
|
|
236
|
-
class
|
|
236
|
+
class Et extends Error {
|
|
237
237
|
constructor(t) {
|
|
238
238
|
super(t), this.name = "ValidationError";
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
const l3 = (e) => {
|
|
242
|
-
if (e < 0 || e > 23) throw new
|
|
242
|
+
if (e < 0 || e > 23) throw new Et("Hour should be in the range 0-23");
|
|
243
243
|
}, d3 = (e) => {
|
|
244
|
-
if (e < 0 || e > 59) throw new
|
|
244
|
+
if (e < 0 || e > 59) throw new Et("Minute should be in the range 0-59");
|
|
245
245
|
}, g3 = (e) => {
|
|
246
|
-
if (e < 0 || e > 59) throw new
|
|
246
|
+
if (e < 0 || e > 59) throw new Et("Second should be in the range 0-59");
|
|
247
247
|
}, m3 = (e) => {
|
|
248
|
-
if (e < 0 || e > 999) throw new
|
|
249
|
-
},
|
|
248
|
+
if (e < 0 || e > 999) throw new Et("Millisecond should be in the range 0-999");
|
|
249
|
+
}, D3 = (e, t, n, a) => {
|
|
250
250
|
l3(e), d3(t), g3(n), m3(a);
|
|
251
251
|
};
|
|
252
|
-
class
|
|
252
|
+
class w {
|
|
253
253
|
timestamp;
|
|
254
254
|
year;
|
|
255
255
|
yearEn;
|
|
@@ -263,7 +263,7 @@ class Y {
|
|
|
263
263
|
constructor(...t) {
|
|
264
264
|
if (t.length === 0) this.initFromCurrentDate();
|
|
265
265
|
else if (t.length === 1 && t[0] instanceof Date) this.initFromEnglishDate(t[0]);
|
|
266
|
-
else if (t.length === 1 && t[0] instanceof
|
|
266
|
+
else if (t.length === 1 && t[0] instanceof w) this.initFromNepaliDate(t[0]);
|
|
267
267
|
else if (t.length === 1 && typeof t[0] == "string") this.parseFromString(t[0]);
|
|
268
268
|
else if (t.length === 1 && typeof t[0] == "number") this.initFromTimestamp(t[0]);
|
|
269
269
|
else if (t.length === 2 && typeof t[0] == "string" && typeof t[1] == "string") this.parseFromStringWithFormat(t[0], t[1]);
|
|
@@ -295,9 +295,9 @@ class Y {
|
|
|
295
295
|
}
|
|
296
296
|
_setDateObject(t, n = !0) {
|
|
297
297
|
this.timestamp = t;
|
|
298
|
-
const { year: a, month0: s, day: r, hour: o, minute:
|
|
299
|
-
if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute =
|
|
300
|
-
const [h, c, f] =
|
|
298
|
+
const { year: a, month0: s, day: r, hour: o, minute: i, weekDay: u } = Ne(t);
|
|
299
|
+
if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute = i, this.weekDay = u, n) {
|
|
300
|
+
const [h, c, f] = W.englishToNepali(a, s, r);
|
|
301
301
|
this.year = h, this.month = c, this.day = f;
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -364,10 +364,10 @@ class Y {
|
|
|
364
364
|
setTime(t) {
|
|
365
365
|
this._setDateObject(new Date(t));
|
|
366
366
|
}
|
|
367
|
-
set(t, n, a, s, r, o,
|
|
368
|
-
|
|
369
|
-
const [
|
|
370
|
-
this.year = t, this.month = n, this.day = a, this._setDateObject(
|
|
367
|
+
set(t, n, a, s, r, o, i) {
|
|
368
|
+
D3(s, r, o, i);
|
|
369
|
+
const [u, h, c] = W.nepaliToEnglish(t, n, a);
|
|
370
|
+
this.year = t, this.month = n, this.day = a, this._setDateObject(Ht(u, h, c, s, r, o, i), !1);
|
|
371
371
|
}
|
|
372
372
|
setDateObject(t) {
|
|
373
373
|
this._setDateObject(t, !0);
|
|
@@ -387,35 +387,35 @@ class Y {
|
|
|
387
387
|
formatEnglishDateInNepali(t) {
|
|
388
388
|
return t3(this, t);
|
|
389
389
|
}
|
|
390
|
-
static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0,
|
|
391
|
-
const
|
|
392
|
-
return new
|
|
390
|
+
static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0, i = 0) {
|
|
391
|
+
const u = Ht(t, n, a, s, r, o, i);
|
|
392
|
+
return new w(u);
|
|
393
393
|
}
|
|
394
394
|
static parseNepaliFormat(t, n) {
|
|
395
|
-
const [a, s, r, o,
|
|
396
|
-
return new
|
|
395
|
+
const [a, s, r, o, i, u, h] = h3(t, n);
|
|
396
|
+
return new w(a, s, r, o, i, u, h);
|
|
397
397
|
}
|
|
398
398
|
static parseEnglishDate(t, n) {
|
|
399
|
-
const [a, s, r, o,
|
|
400
|
-
return
|
|
399
|
+
const [a, s, r, o, i, u, h] = u3(t, n);
|
|
400
|
+
return w.fromEnglishDate(a, s, r, o, i, u, h);
|
|
401
401
|
}
|
|
402
402
|
static getDaysOfMonth(t, n) {
|
|
403
|
-
if (t <
|
|
403
|
+
if (t < W.npMinYear() || t > W.npMaxYear()) throw new Error("Year out of range");
|
|
404
404
|
if (n < 0 || n > 11) throw new Error("Month out of range");
|
|
405
|
-
return
|
|
405
|
+
return _[t - W.npMinYear()][0][n];
|
|
406
406
|
}
|
|
407
407
|
static minSupportedDate() {
|
|
408
|
-
return
|
|
408
|
+
return w.fromEnglishDate(W.enMinYear(), 0, 1).getDateObject();
|
|
409
409
|
}
|
|
410
410
|
static maxSupportedDate() {
|
|
411
|
-
return
|
|
411
|
+
return w.fromEnglishDate(W.enMaxYear(), 11, 31).getDateObject();
|
|
412
412
|
}
|
|
413
413
|
static minSupportedNepaliDate() {
|
|
414
|
-
return new
|
|
414
|
+
return new w(W.npMinYear(), 0, 1);
|
|
415
415
|
}
|
|
416
416
|
static maxSupportedNepaliDate() {
|
|
417
|
-
const t =
|
|
418
|
-
return new
|
|
417
|
+
const t = W.npMaxYear();
|
|
418
|
+
return new w(t, 11, this.getDaysOfMonth(t, 11));
|
|
419
419
|
}
|
|
420
420
|
static minimum() {
|
|
421
421
|
return console.warn("`NepaliDate.minimum()` is deprecated and will be removed in a future version. Please use `NepaliDate.minSupportedDate()` instead."), this.minSupportedDate();
|
|
@@ -450,7 +450,7 @@ const y3 = [
|
|
|
450
450
|
"Magh",
|
|
451
451
|
"Falgun",
|
|
452
452
|
"Chaitra"
|
|
453
|
-
],
|
|
453
|
+
], f3 = [
|
|
454
454
|
"January",
|
|
455
455
|
"February",
|
|
456
456
|
"March",
|
|
@@ -463,7 +463,7 @@ const y3 = [
|
|
|
463
463
|
"October",
|
|
464
464
|
"November",
|
|
465
465
|
"December"
|
|
466
|
-
], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
466
|
+
], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], S3 = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], N3 = {
|
|
467
467
|
light: {
|
|
468
468
|
primary: "#3b82f6",
|
|
469
469
|
background: "#ffffff",
|
|
@@ -484,43 +484,43 @@ const y3 = [
|
|
|
484
484
|
today: "#1e40af",
|
|
485
485
|
disabled: "#6b7280"
|
|
486
486
|
}
|
|
487
|
-
},
|
|
487
|
+
}, U = (e) => e.toString().split("").map((t) => S3[parseInt(t)]).join(""), De = (e, t, n) => {
|
|
488
488
|
if (e === "BS")
|
|
489
489
|
try {
|
|
490
|
-
const a = n === 11 ? new
|
|
491
|
-
return new
|
|
490
|
+
const a = n === 11 ? new w(t + 1, 0, 1) : new w(t, n + 1, 1);
|
|
491
|
+
return new w(a.getTime() - 1440 * 60 * 1e3).getDate();
|
|
492
492
|
} catch {
|
|
493
493
|
return 30;
|
|
494
494
|
}
|
|
495
495
|
return new Date(t, n + 1, 0).getDate();
|
|
496
|
-
},
|
|
496
|
+
}, b3 = (e, t, n) => {
|
|
497
497
|
if (e === "BS")
|
|
498
498
|
try {
|
|
499
|
-
return new
|
|
499
|
+
return new w(t, n, 1).getDay() || 0;
|
|
500
500
|
} catch {
|
|
501
501
|
return 0;
|
|
502
502
|
}
|
|
503
503
|
return new Date(t, n, 1).getDay();
|
|
504
|
-
},
|
|
504
|
+
}, N = (e) => {
|
|
505
505
|
const t = /* @__PURE__ */ new Date();
|
|
506
506
|
if (e === "BS")
|
|
507
507
|
try {
|
|
508
|
-
const n =
|
|
508
|
+
const n = w.fromEnglishDate(t.getFullYear(), t.getMonth(), t.getDate());
|
|
509
509
|
return { year: n.getYear(), month: n.getMonth(), day: n.getDate() };
|
|
510
510
|
} catch {
|
|
511
511
|
return { year: 2081, month: 0, day: 1 };
|
|
512
512
|
}
|
|
513
513
|
return { year: t.getFullYear(), month: t.getMonth(), day: t.getDate() };
|
|
514
|
-
},
|
|
514
|
+
}, kt = (e, t, n, a, s) => {
|
|
515
515
|
if (e === "BS")
|
|
516
516
|
try {
|
|
517
|
-
const r = new
|
|
517
|
+
const r = new w(t, n, a), o = r.getEnglishYear(), i = r.getEnglishMonth(), u = r.getEnglishDate(), h = `${o}-${String(i + 1).padStart(2, "0")}-${String(u).padStart(2, "0")}`;
|
|
518
518
|
return {
|
|
519
519
|
bs: `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`,
|
|
520
520
|
ad: h,
|
|
521
521
|
formatted: {
|
|
522
522
|
bs: `${s[n]} ${a}, ${t}`,
|
|
523
|
-
ad: new Date(o,
|
|
523
|
+
ad: new Date(o, i, u).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
} catch {
|
|
@@ -537,17 +537,17 @@ const y3 = [
|
|
|
537
537
|
else {
|
|
538
538
|
const r = `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`, o = new Date(t, n, a);
|
|
539
539
|
try {
|
|
540
|
-
const
|
|
540
|
+
const i = w.fromEnglishDate(t, n, a), u = `${i.getYear()}-${String(i.getMonth() + 1).padStart(2, "0")}-${String(i.getDate()).padStart(2, "0")}`;
|
|
541
541
|
return {
|
|
542
542
|
ad: r,
|
|
543
|
-
bs:
|
|
543
|
+
bs: u,
|
|
544
544
|
formatted: {
|
|
545
545
|
ad: o.toLocaleDateString("en-US", {
|
|
546
546
|
year: "numeric",
|
|
547
547
|
month: "long",
|
|
548
548
|
day: "numeric"
|
|
549
549
|
}),
|
|
550
|
-
bs: `${me[
|
|
550
|
+
bs: `${me[i.getMonth()]} ${i.getDate()}, ${i.getYear()}`
|
|
551
551
|
}
|
|
552
552
|
};
|
|
553
553
|
} catch {
|
|
@@ -568,86 +568,87 @@ const y3 = [
|
|
|
568
568
|
}, H3 = (e, t, n) => {
|
|
569
569
|
const a = new Date(e.year, e.month, e.day).getTime(), s = new Date(t.year, t.month, t.day).getTime(), r = new Date(n.year, n.month, n.day).getTime();
|
|
570
570
|
return a >= s && a <= r;
|
|
571
|
-
},
|
|
571
|
+
}, Mt = (e) => {
|
|
572
572
|
try {
|
|
573
573
|
const [t, n, a] = e.split("-").map(Number);
|
|
574
574
|
return !t || !n || !a ? null : { year: t, month: n - 1, day: a };
|
|
575
575
|
} catch {
|
|
576
576
|
return null;
|
|
577
577
|
}
|
|
578
|
-
},
|
|
578
|
+
}, nt = (e, t, n) => {
|
|
579
579
|
if (!t && !n) return !1;
|
|
580
580
|
const a = new Date(e.year, e.month, e.day).getTime();
|
|
581
581
|
if (t) {
|
|
582
|
-
const s =
|
|
582
|
+
const s = Mt(t);
|
|
583
583
|
if (s) {
|
|
584
584
|
const r = new Date(s.year, s.month, s.day).getTime();
|
|
585
585
|
if (a < r) return !0;
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
if (n) {
|
|
589
|
-
const s =
|
|
589
|
+
const s = Mt(n);
|
|
590
590
|
if (s) {
|
|
591
591
|
const r = new Date(s.year, s.month, s.day).getTime();
|
|
592
592
|
if (a > r) return !0;
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
595
|
return !1;
|
|
596
|
-
}, E3 = (e = "AD") => {
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
596
|
+
}, E3 = (e = "AD", t) => {
|
|
597
|
+
const n = mt(() => N(e), [e]), a = mt(() => t ? Mt(t) : null, [t]), [s, r] = H(a?.year ?? n.year), [o, i] = H(a?.month ?? n.month), [u, h] = H(a), [c, f] = H(null), [l, $] = H(null);
|
|
598
|
+
Dt(() => {
|
|
599
|
+
const M = t ? Mt(t) : null;
|
|
600
|
+
M ? (r(M.year), i(M.month)) : (r(n.year), i(n.month));
|
|
601
|
+
}, [e]);
|
|
602
|
+
const D = mt(() => {
|
|
603
|
+
const M = De(e, s, o), B = b3(e, s, o), k = [];
|
|
604
|
+
for (let b = 0; b < B; b++)
|
|
605
|
+
k.push(null);
|
|
606
|
+
for (let b = 1; b <= M; b++)
|
|
607
|
+
k.push(b);
|
|
608
|
+
return k;
|
|
609
|
+
}, [s, o, e]);
|
|
609
610
|
return {
|
|
610
611
|
// State
|
|
611
|
-
currentYear:
|
|
612
|
-
currentMonth:
|
|
613
|
-
selectedDate:
|
|
614
|
-
rangeStart:
|
|
615
|
-
rangeEnd:
|
|
616
|
-
today:
|
|
617
|
-
calendarDays:
|
|
612
|
+
currentYear: s,
|
|
613
|
+
currentMonth: o,
|
|
614
|
+
selectedDate: u,
|
|
615
|
+
rangeStart: c,
|
|
616
|
+
rangeEnd: l,
|
|
617
|
+
today: n,
|
|
618
|
+
calendarDays: D,
|
|
618
619
|
// Actions
|
|
619
|
-
setCurrentYear:
|
|
620
|
-
setCurrentMonth:
|
|
621
|
-
setSelectedDate:
|
|
622
|
-
setRangeStart:
|
|
623
|
-
setRangeEnd:
|
|
624
|
-
navigateMonth: (
|
|
625
|
-
let
|
|
626
|
-
for (;
|
|
627
|
-
|
|
628
|
-
for (;
|
|
629
|
-
|
|
630
|
-
|
|
620
|
+
setCurrentYear: r,
|
|
621
|
+
setCurrentMonth: i,
|
|
622
|
+
setSelectedDate: h,
|
|
623
|
+
setRangeStart: f,
|
|
624
|
+
setRangeEnd: $,
|
|
625
|
+
navigateMonth: (M) => {
|
|
626
|
+
let k = o + M, b = s;
|
|
627
|
+
for (; k > 11; )
|
|
628
|
+
k -= 12, b += 1;
|
|
629
|
+
for (; k < 0; )
|
|
630
|
+
k += 12, b -= 1;
|
|
631
|
+
i(k), r(b);
|
|
631
632
|
},
|
|
632
633
|
// Helpers
|
|
633
|
-
isToday: (
|
|
634
|
-
isSelected: (
|
|
635
|
-
isInRange: (
|
|
636
|
-
if (!
|
|
637
|
-
const
|
|
638
|
-
return
|
|
634
|
+
isToday: (M) => s === n.year && o === n.month && M === n.day,
|
|
635
|
+
isSelected: (M, B = "single") => B === "range" ? !!(c && c.year === s && c.month === o && c.day === M) || !!(l && l.year === s && l.month === o && l.day === M) : !!(u && u.year === s && u.month === o && u.day === M),
|
|
636
|
+
isInRange: (M) => {
|
|
637
|
+
if (!c || !l) return !1;
|
|
638
|
+
const B = new Date(s, o, M).getTime(), k = new Date(c.year, c.month, c.day).getTime(), b = new Date(l.year, l.month, l.day).getTime();
|
|
639
|
+
return B >= k && B <= b;
|
|
639
640
|
}
|
|
640
641
|
};
|
|
641
|
-
},
|
|
642
|
+
}, Q = (e, t, n) => {
|
|
642
643
|
if (n === "BS")
|
|
643
644
|
try {
|
|
644
|
-
const a = new
|
|
645
|
+
const a = new w(e.year, e.month, e.day), s = new Date(
|
|
645
646
|
a.getEnglishYear(),
|
|
646
647
|
a.getEnglishMonth(),
|
|
647
648
|
a.getEnglishDate()
|
|
648
649
|
);
|
|
649
650
|
s.setDate(s.getDate() + t);
|
|
650
|
-
const r =
|
|
651
|
+
const r = w.fromEnglishDate(
|
|
651
652
|
s.getFullYear(),
|
|
652
653
|
s.getMonth(),
|
|
653
654
|
s.getDate()
|
|
@@ -660,7 +661,7 @@ const y3 = [
|
|
|
660
661
|
const a = new Date(e.year, e.month, e.day);
|
|
661
662
|
return a.setDate(a.getDate() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
|
|
662
663
|
}
|
|
663
|
-
},
|
|
664
|
+
}, ht = (e, t, n) => {
|
|
664
665
|
if (n === "BS")
|
|
665
666
|
try {
|
|
666
667
|
let a = e.year, s = e.month + t;
|
|
@@ -668,7 +669,7 @@ const y3 = [
|
|
|
668
669
|
a -= 1, s += 12;
|
|
669
670
|
for (; s >= 12; )
|
|
670
671
|
a += 1, s -= 12;
|
|
671
|
-
const r =
|
|
672
|
+
const r = De("BS", a, s), o = Math.min(e.day, r);
|
|
672
673
|
return { year: a, month: s, day: o };
|
|
673
674
|
} catch {
|
|
674
675
|
return e;
|
|
@@ -677,11 +678,11 @@ const y3 = [
|
|
|
677
678
|
const a = new Date(e.year, e.month, e.day);
|
|
678
679
|
return a.setMonth(a.getMonth() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
|
|
679
680
|
}
|
|
680
|
-
},
|
|
681
|
+
}, V = (e) => ({ year: e.year, month: e.month, day: 1 }), w3 = (e, t) => {
|
|
681
682
|
if (t === "BS")
|
|
682
683
|
try {
|
|
683
|
-
const a = new
|
|
684
|
-
return
|
|
684
|
+
const a = new w(e.year, e.month, e.day).getDay();
|
|
685
|
+
return Q(e, -a, "BS");
|
|
685
686
|
} catch {
|
|
686
687
|
return e;
|
|
687
688
|
}
|
|
@@ -708,7 +709,7 @@ const y3 = [
|
|
|
708
709
|
key: "today",
|
|
709
710
|
label: "Today",
|
|
710
711
|
getValue: (s) => {
|
|
711
|
-
const r =
|
|
712
|
+
const r = N(s);
|
|
712
713
|
return { start: r, end: r };
|
|
713
714
|
}
|
|
714
715
|
},
|
|
@@ -716,7 +717,7 @@ const y3 = [
|
|
|
716
717
|
key: "yesterday",
|
|
717
718
|
label: "Yesterday",
|
|
718
719
|
getValue: (s) => {
|
|
719
|
-
const r =
|
|
720
|
+
const r = N(s), o = Q(r, -1, s);
|
|
720
721
|
return { start: o, end: o };
|
|
721
722
|
}
|
|
722
723
|
},
|
|
@@ -724,7 +725,7 @@ const y3 = [
|
|
|
724
725
|
key: "thisWeek",
|
|
725
726
|
label: "This Week",
|
|
726
727
|
getValue: (s) => {
|
|
727
|
-
const r =
|
|
728
|
+
const r = N(s);
|
|
728
729
|
return { start: w3(r, s), end: r };
|
|
729
730
|
}
|
|
730
731
|
},
|
|
@@ -732,72 +733,72 @@ const y3 = [
|
|
|
732
733
|
key: "last7days",
|
|
733
734
|
label: "Last 7 Days",
|
|
734
735
|
getValue: (s) => {
|
|
735
|
-
const r =
|
|
736
|
-
return { start:
|
|
736
|
+
const r = N(s);
|
|
737
|
+
return { start: Q(r, -6, s), end: r };
|
|
737
738
|
}
|
|
738
739
|
},
|
|
739
740
|
{
|
|
740
741
|
key: "last30days",
|
|
741
742
|
label: "Last 30 Days",
|
|
742
743
|
getValue: (s) => {
|
|
743
|
-
const r =
|
|
744
|
-
return { start:
|
|
744
|
+
const r = N(s);
|
|
745
|
+
return { start: Q(r, -29, s), end: r };
|
|
745
746
|
}
|
|
746
747
|
},
|
|
747
748
|
{
|
|
748
749
|
key: "thisMonth",
|
|
749
750
|
label: "This Month",
|
|
750
751
|
getValue: (s) => {
|
|
751
|
-
const r =
|
|
752
|
-
return { start:
|
|
752
|
+
const r = N(s);
|
|
753
|
+
return { start: V(r), end: r };
|
|
753
754
|
}
|
|
754
755
|
},
|
|
755
756
|
{
|
|
756
757
|
key: "lastMonth",
|
|
757
758
|
label: "Last Month",
|
|
758
759
|
getValue: (s) => {
|
|
759
|
-
const r =
|
|
760
|
-
return { start:
|
|
760
|
+
const r = N(s), o = Q(V(r), -1, s);
|
|
761
|
+
return { start: V(o), end: o };
|
|
761
762
|
}
|
|
762
763
|
},
|
|
763
764
|
{
|
|
764
765
|
key: "last3months",
|
|
765
766
|
label: "Last 3 Months",
|
|
766
767
|
getValue: (s) => {
|
|
767
|
-
const r =
|
|
768
|
-
return { start:
|
|
768
|
+
const r = N(s), o = ht(r, -2, s);
|
|
769
|
+
return { start: V(o), end: r };
|
|
769
770
|
}
|
|
770
771
|
},
|
|
771
772
|
{
|
|
772
773
|
key: "last6months",
|
|
773
774
|
label: "Last 6 Months",
|
|
774
775
|
getValue: (s) => {
|
|
775
|
-
const r =
|
|
776
|
-
return { start:
|
|
776
|
+
const r = N(s), o = ht(r, -5, s);
|
|
777
|
+
return { start: V(o), end: r };
|
|
777
778
|
}
|
|
778
779
|
},
|
|
779
780
|
{
|
|
780
781
|
key: "last180days",
|
|
781
782
|
label: "Last 180 Days",
|
|
782
783
|
getValue: (s) => {
|
|
783
|
-
const r =
|
|
784
|
-
return { start:
|
|
784
|
+
const r = N(s);
|
|
785
|
+
return { start: Q(r, -179, s), end: r };
|
|
785
786
|
}
|
|
786
787
|
},
|
|
787
788
|
{
|
|
788
789
|
key: "last9months",
|
|
789
790
|
label: "Last 9 Months",
|
|
790
791
|
getValue: (s) => {
|
|
791
|
-
const r =
|
|
792
|
-
return { start:
|
|
792
|
+
const r = N(s), o = ht(r, -8, s);
|
|
793
|
+
return { start: V(o), end: r };
|
|
793
794
|
}
|
|
794
795
|
},
|
|
795
796
|
{
|
|
796
797
|
key: "lastYear",
|
|
797
798
|
label: "Last Year",
|
|
798
799
|
getValue: (s) => {
|
|
799
|
-
const r =
|
|
800
|
-
return { start:
|
|
800
|
+
const r = N(s), o = ht(r, -11, s);
|
|
801
|
+
return { start: V(o), end: r };
|
|
801
802
|
}
|
|
802
803
|
}
|
|
803
804
|
], a = e ? n.filter((s) => e.includes(s.key)) : n;
|
|
@@ -810,59 +811,59 @@ const y3 = [
|
|
|
810
811
|
onMonthChange: s,
|
|
811
812
|
onClose: r,
|
|
812
813
|
showNepaliNumbers: o = !1,
|
|
813
|
-
convertToNepaliNumber:
|
|
814
|
-
calendarType:
|
|
814
|
+
convertToNepaliNumber: i = (h) => h.toString(),
|
|
815
|
+
calendarType: u
|
|
815
816
|
}) => {
|
|
816
|
-
const [h, c] =
|
|
817
|
-
return /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
817
|
+
const [h, c] = H(Math.floor(e / 12) * 12), f = u === "BS" ? 2e3 : 1944, l = u === "BS" ? 2100 : 2043;
|
|
818
|
+
return /* @__PURE__ */ C("div", { className: "bsac-picker-inline", onClick: ($) => $.stopPropagation(), children: [
|
|
819
|
+
/* @__PURE__ */ C("div", { className: "bsac-picker-header", children: [
|
|
819
820
|
/* @__PURE__ */ g("h3", { children: "Select Month & Year" }),
|
|
820
821
|
/* @__PURE__ */ g("button", { className: "bsac-close-btn", onClick: r, children: "×" })
|
|
821
822
|
] }),
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ C("div", { className: "bsac-picker-body", children: [
|
|
824
|
+
/* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
|
|
825
|
+
/* @__PURE__ */ C("div", { className: "bsac-picker-section-header", children: [
|
|
825
826
|
/* @__PURE__ */ g("label", { children: "Year" }),
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ C("div", { className: "bsac-year-nav", children: [
|
|
827
828
|
/* @__PURE__ */ g("button", { onClick: () => c(Math.max(f, h - 12)), disabled: h <= f, children: "«" }),
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
o ?
|
|
829
|
+
/* @__PURE__ */ C("span", { children: [
|
|
830
|
+
o ? i(h) : h,
|
|
830
831
|
" – ",
|
|
831
|
-
o ?
|
|
832
|
+
o ? i(h + 11) : h + 11
|
|
832
833
|
] }),
|
|
833
|
-
/* @__PURE__ */ g("button", { onClick: () => c(Math.min(
|
|
834
|
+
/* @__PURE__ */ g("button", { onClick: () => c(Math.min(l - 11, h + 12)), disabled: h + 11 >= l, children: "»" })
|
|
834
835
|
] })
|
|
835
836
|
] }),
|
|
836
|
-
/* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, (
|
|
837
|
-
const
|
|
838
|
-
return
|
|
837
|
+
/* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, ($, D) => {
|
|
838
|
+
const F = h + D;
|
|
839
|
+
return F > l ? null : /* @__PURE__ */ g(
|
|
839
840
|
"button",
|
|
840
841
|
{
|
|
841
|
-
onClick: () => a(
|
|
842
|
-
className:
|
|
843
|
-
children: o ?
|
|
842
|
+
onClick: () => a(F),
|
|
843
|
+
className: F === e ? "bsac-selected" : "",
|
|
844
|
+
children: o ? i(F) : F
|
|
844
845
|
},
|
|
845
|
-
|
|
846
|
+
F
|
|
846
847
|
);
|
|
847
848
|
}) })
|
|
848
849
|
] }),
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
+
/* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
|
|
850
851
|
/* @__PURE__ */ g("label", { children: "Month" }),
|
|
851
|
-
/* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map((
|
|
852
|
+
/* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map(($, D) => /* @__PURE__ */ g(
|
|
852
853
|
"button",
|
|
853
854
|
{
|
|
854
855
|
onClick: () => {
|
|
855
|
-
s(
|
|
856
|
+
s(D), r();
|
|
856
857
|
},
|
|
857
|
-
className:
|
|
858
|
-
children:
|
|
858
|
+
className: D === t ? "bsac-selected" : "",
|
|
859
|
+
children: $
|
|
859
860
|
},
|
|
860
|
-
|
|
861
|
+
D
|
|
861
862
|
)) })
|
|
862
863
|
] })
|
|
863
864
|
] })
|
|
864
|
-
] })
|
|
865
|
-
},
|
|
865
|
+
] });
|
|
866
|
+
}, lt = ({
|
|
866
867
|
currentMonth: e,
|
|
867
868
|
currentYear: t,
|
|
868
869
|
months: n,
|
|
@@ -870,18 +871,18 @@ const y3 = [
|
|
|
870
871
|
onYearChange: s,
|
|
871
872
|
onMonthChange: r,
|
|
872
873
|
disabled: o = !1,
|
|
873
|
-
showNepaliNumbers:
|
|
874
|
-
convertToNepaliNumber:
|
|
874
|
+
showNepaliNumbers: i = !1,
|
|
875
|
+
convertToNepaliNumber: u,
|
|
875
876
|
calendarType: h
|
|
876
877
|
}) => {
|
|
877
|
-
const [c, f] =
|
|
878
|
-
return /* @__PURE__ */
|
|
878
|
+
const [c, f] = H(!1);
|
|
879
|
+
return /* @__PURE__ */ C("div", { className: "bsac-header", children: [
|
|
879
880
|
/* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-12), disabled: o, "aria-label": "Previous year", children: "«" }),
|
|
880
881
|
/* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-1), disabled: o, "aria-label": "Previous month", children: "‹" }),
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ C("button", { className: "bsac-month-year-btn", onClick: () => f(!0), disabled: o, children: [
|
|
882
883
|
n[e],
|
|
883
884
|
" ",
|
|
884
|
-
|
|
885
|
+
i ? u(t) : t
|
|
885
886
|
] }),
|
|
886
887
|
/* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(1), disabled: o, "aria-label": "Next month", children: "›" }),
|
|
887
888
|
/* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(12), disabled: o, "aria-label": "Next year", children: "»" }),
|
|
@@ -894,13 +895,13 @@ const y3 = [
|
|
|
894
895
|
onYearChange: s,
|
|
895
896
|
onMonthChange: r,
|
|
896
897
|
onClose: () => f(!1),
|
|
897
|
-
showNepaliNumbers:
|
|
898
|
-
convertToNepaliNumber:
|
|
898
|
+
showNepaliNumbers: i,
|
|
899
|
+
convertToNepaliNumber: u,
|
|
899
900
|
calendarType: h
|
|
900
901
|
}
|
|
901
902
|
)
|
|
902
903
|
] });
|
|
903
|
-
},
|
|
904
|
+
}, dt = ({
|
|
904
905
|
calendarDays: e,
|
|
905
906
|
days: t,
|
|
906
907
|
onDateSelect: n,
|
|
@@ -908,27 +909,27 @@ const y3 = [
|
|
|
908
909
|
isInRange: s,
|
|
909
910
|
isToday: r,
|
|
910
911
|
isDisabled: o,
|
|
911
|
-
disabled:
|
|
912
|
-
showNepaliNumbers:
|
|
912
|
+
disabled: i = !1,
|
|
913
|
+
showNepaliNumbers: u = !1,
|
|
913
914
|
convertToNepaliNumber: h
|
|
914
|
-
}) => /* @__PURE__ */
|
|
915
|
+
}) => /* @__PURE__ */ C("div", { className: "bsac-grid", children: [
|
|
915
916
|
t.map((c) => /* @__PURE__ */ g("div", { className: "bsac-day-header", children: c }, c)),
|
|
916
917
|
e.map((c, f) => {
|
|
917
|
-
const
|
|
918
|
+
const l = c ? o?.(c) || i : !1, $ = c ? a(c) : !1, D = c ? s(c) : !1, F = c ? r(c) : !1, I = [
|
|
918
919
|
"bsac-day",
|
|
919
|
-
c ?
|
|
920
|
+
c ? l ? "bsac-day-disabled" : $ ? "bsac-day-selected" : D ? "bsac-day-in-range" : F ? "bsac-day-today" : "" : "bsac-day-empty"
|
|
920
921
|
].filter(Boolean).join(" ");
|
|
921
922
|
return /* @__PURE__ */ g(
|
|
922
923
|
"div",
|
|
923
924
|
{
|
|
924
|
-
className:
|
|
925
|
-
onClick: () => c && !
|
|
926
|
-
children: c ?
|
|
925
|
+
className: I,
|
|
926
|
+
onClick: () => c && !l && n(c),
|
|
927
|
+
children: c ? u ? h(c) : c : ""
|
|
927
928
|
},
|
|
928
929
|
f
|
|
929
930
|
);
|
|
930
931
|
})
|
|
931
|
-
] }),
|
|
932
|
+
] }), gt = ({
|
|
932
933
|
presets: e,
|
|
933
934
|
calendarType: t,
|
|
934
935
|
onPresetSelect: n,
|
|
@@ -936,8 +937,8 @@ const y3 = [
|
|
|
936
937
|
position: s = "top"
|
|
937
938
|
}) => {
|
|
938
939
|
const r = (o) => {
|
|
939
|
-
const
|
|
940
|
-
n(o,
|
|
940
|
+
const i = o.getValue(t);
|
|
941
|
+
n(o, i);
|
|
941
942
|
};
|
|
942
943
|
return /* @__PURE__ */ g("div", { className: `bsac-presets bsac-presets--${s}`, children: e.map((o) => /* @__PURE__ */ g(
|
|
943
944
|
"button",
|
|
@@ -956,290 +957,290 @@ const y3 = [
|
|
|
956
957
|
showToday: s = !0,
|
|
957
958
|
disabled: r = !1,
|
|
958
959
|
outputFormat: o = "both",
|
|
959
|
-
onDateSelect:
|
|
960
|
-
mode:
|
|
960
|
+
onDateSelect: i,
|
|
961
|
+
mode: u = "single",
|
|
961
962
|
onRangeSelect: h,
|
|
962
963
|
showRangePresets: c = !1,
|
|
963
964
|
rangePresetsPosition: f = "top",
|
|
964
|
-
predefinedRanges:
|
|
965
|
-
presetKeys:
|
|
966
|
-
presetLabels:
|
|
967
|
-
onPresetSelect:
|
|
968
|
-
renderPresets:
|
|
969
|
-
showNepaliMonths:
|
|
970
|
-
showNepaliDays:
|
|
971
|
-
showNepaliNumbers:
|
|
972
|
-
theme:
|
|
973
|
-
colors:
|
|
974
|
-
minDate:
|
|
975
|
-
maxDate:
|
|
965
|
+
predefinedRanges: l,
|
|
966
|
+
presetKeys: $,
|
|
967
|
+
presetLabels: D,
|
|
968
|
+
onPresetSelect: F,
|
|
969
|
+
renderPresets: I,
|
|
970
|
+
showNepaliMonths: st = !1,
|
|
971
|
+
showNepaliDays: q = !1,
|
|
972
|
+
showNepaliNumbers: M = !1,
|
|
973
|
+
theme: B = "light",
|
|
974
|
+
colors: k,
|
|
975
|
+
minDate: b,
|
|
976
|
+
maxDate: J
|
|
976
977
|
}) => {
|
|
977
978
|
const {
|
|
978
|
-
currentYear:
|
|
979
|
-
currentMonth:
|
|
980
|
-
rangeStart:
|
|
981
|
-
rangeEnd:
|
|
982
|
-
calendarDays:
|
|
983
|
-
setSelectedDate:
|
|
984
|
-
setRangeStart:
|
|
985
|
-
setRangeEnd:
|
|
986
|
-
setCurrentYear:
|
|
987
|
-
setCurrentMonth:
|
|
988
|
-
navigateMonth:
|
|
989
|
-
isToday:
|
|
990
|
-
isSelected:
|
|
991
|
-
isInRange:
|
|
992
|
-
} = E3(e), [
|
|
993
|
-
start:
|
|
994
|
-
end:
|
|
995
|
-
}),
|
|
996
|
-
|
|
997
|
-
}, ye = (
|
|
998
|
-
|
|
999
|
-
},
|
|
979
|
+
currentYear: O,
|
|
980
|
+
currentMonth: v,
|
|
981
|
+
rangeStart: L,
|
|
982
|
+
rangeEnd: wt,
|
|
983
|
+
calendarDays: K,
|
|
984
|
+
setSelectedDate: Ft,
|
|
985
|
+
setRangeStart: m,
|
|
986
|
+
setRangeEnd: S,
|
|
987
|
+
setCurrentYear: A,
|
|
988
|
+
setCurrentMonth: y,
|
|
989
|
+
navigateMonth: E,
|
|
990
|
+
isToday: j,
|
|
991
|
+
isSelected: P,
|
|
992
|
+
isInRange: G
|
|
993
|
+
} = E3(e, t), [at, Yt] = H(), rt = l || Y3($, D), ot = (d, p) => ({
|
|
994
|
+
start: kt(e, d.year, d.month, d.day, z),
|
|
995
|
+
end: kt(e, p.year, p.month, p.day, z)
|
|
996
|
+
}), z = e === "BS" && st ? y3 : e === "BS" ? me : f3, it = e === "BS" && q ? M3 : p3, ut = (d, p) => {
|
|
997
|
+
p.start && p.end && (m(p.start), S(p.end), A(p.start.year), y(p.start.month), Yt(d.key), F?.(d, p), h?.(ot(p.start, p.end)));
|
|
998
|
+
}, ye = (d, p) => {
|
|
999
|
+
m(d), S(p), Yt(void 0), h?.(ot(d, p));
|
|
1000
|
+
}, ct = (d) => {
|
|
1000
1001
|
if (r) return;
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
if (
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
1002
|
+
const p = { year: O, month: v, day: d };
|
|
1003
|
+
if (nt(p, b, J)) return;
|
|
1004
|
+
if (u === "range") {
|
|
1005
|
+
if (Yt(void 0), !L || L && wt)
|
|
1006
|
+
m(p), S(null);
|
|
1006
1007
|
else {
|
|
1007
|
-
const
|
|
1008
|
-
new Date(
|
|
1008
|
+
const Z = new Date(L.year, L.month, L.day).getTime();
|
|
1009
|
+
new Date(p.year, p.month, p.day).getTime() < Z ? (m(p), S(L), h?.(ot(p, L))) : (S(p), h?.(ot(L, p)));
|
|
1009
1010
|
}
|
|
1010
1011
|
return;
|
|
1011
1012
|
}
|
|
1012
|
-
|
|
1013
|
-
const
|
|
1014
|
-
if (
|
|
1015
|
-
let
|
|
1013
|
+
Ft(p);
|
|
1014
|
+
const X = kt(e, O, v, d, z);
|
|
1015
|
+
if (i?.(X), n) {
|
|
1016
|
+
let Z;
|
|
1016
1017
|
switch (o) {
|
|
1017
1018
|
case "iso":
|
|
1018
|
-
|
|
1019
|
+
Z = X.ad;
|
|
1019
1020
|
break;
|
|
1020
1021
|
case "object":
|
|
1021
|
-
|
|
1022
|
+
Z = JSON.stringify(X);
|
|
1022
1023
|
break;
|
|
1023
1024
|
default:
|
|
1024
|
-
|
|
1025
|
+
Z = JSON.stringify(X);
|
|
1025
1026
|
break;
|
|
1026
1027
|
}
|
|
1027
|
-
n(
|
|
1028
|
+
n(Z);
|
|
1028
1029
|
}
|
|
1029
|
-
},
|
|
1030
|
+
}, fe = (d) => {
|
|
1030
1031
|
if (!r) {
|
|
1031
|
-
switch (
|
|
1032
|
+
switch (d.key) {
|
|
1032
1033
|
case "ArrowLeft":
|
|
1033
|
-
|
|
1034
|
+
E(-1);
|
|
1034
1035
|
break;
|
|
1035
1036
|
case "ArrowRight":
|
|
1036
|
-
|
|
1037
|
+
E(1);
|
|
1037
1038
|
break;
|
|
1038
1039
|
case "ArrowUp":
|
|
1039
|
-
|
|
1040
|
+
E(-12);
|
|
1040
1041
|
break;
|
|
1041
1042
|
case "ArrowDown":
|
|
1042
|
-
|
|
1043
|
+
E(12);
|
|
1043
1044
|
break;
|
|
1044
1045
|
case "PageUp":
|
|
1045
|
-
|
|
1046
|
+
d.shiftKey ? E(-12) : E(-1);
|
|
1046
1047
|
break;
|
|
1047
1048
|
case "PageDown":
|
|
1048
|
-
|
|
1049
|
+
d.shiftKey ? E(12) : E(1);
|
|
1049
1050
|
break;
|
|
1050
1051
|
default:
|
|
1051
1052
|
return;
|
|
1052
1053
|
}
|
|
1053
|
-
|
|
1054
|
+
d.preventDefault();
|
|
1054
1055
|
}
|
|
1055
1056
|
}, Me = {
|
|
1056
|
-
...
|
|
1057
|
-
(
|
|
1057
|
+
...k ? Object.entries(k).reduce(
|
|
1058
|
+
(d, [p, X]) => (d[`--calendar-${p}`] = X, d),
|
|
1058
1059
|
{}
|
|
1059
1060
|
) : {}
|
|
1060
1061
|
};
|
|
1061
|
-
return /* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ C(
|
|
1062
1063
|
"div",
|
|
1063
1064
|
{
|
|
1064
1065
|
className: `bsac-calendar ${a}`,
|
|
1065
1066
|
style: Me,
|
|
1066
|
-
"data-theme":
|
|
1067
|
-
onKeyDown:
|
|
1067
|
+
"data-theme": B,
|
|
1068
|
+
onKeyDown: fe,
|
|
1068
1069
|
tabIndex: 0,
|
|
1069
1070
|
role: "application",
|
|
1070
1071
|
"aria-label": "Calendar",
|
|
1071
1072
|
children: [
|
|
1072
|
-
|
|
1073
|
-
/* @__PURE__ */ g("div", { children:
|
|
1074
|
-
/* @__PURE__ */
|
|
1073
|
+
u === "range" && I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px" }, children: [
|
|
1074
|
+
/* @__PURE__ */ g("div", { children: I({ onRangeChange: ye }) }),
|
|
1075
|
+
/* @__PURE__ */ C("div", { style: { flex: 1 }, children: [
|
|
1075
1076
|
/* @__PURE__ */ g(
|
|
1076
|
-
|
|
1077
|
+
lt,
|
|
1077
1078
|
{
|
|
1078
|
-
currentMonth:
|
|
1079
|
-
currentYear:
|
|
1080
|
-
months:
|
|
1081
|
-
onNavigateMonth:
|
|
1082
|
-
onYearChange:
|
|
1083
|
-
onMonthChange:
|
|
1079
|
+
currentMonth: v,
|
|
1080
|
+
currentYear: O,
|
|
1081
|
+
months: z,
|
|
1082
|
+
onNavigateMonth: E,
|
|
1083
|
+
onYearChange: A,
|
|
1084
|
+
onMonthChange: y,
|
|
1084
1085
|
disabled: r,
|
|
1085
|
-
showNepaliNumbers:
|
|
1086
|
-
convertToNepaliNumber:
|
|
1086
|
+
showNepaliNumbers: M,
|
|
1087
|
+
convertToNepaliNumber: U,
|
|
1087
1088
|
calendarType: e
|
|
1088
1089
|
}
|
|
1089
1090
|
),
|
|
1090
1091
|
/* @__PURE__ */ g(
|
|
1091
|
-
|
|
1092
|
+
dt,
|
|
1092
1093
|
{
|
|
1093
|
-
calendarDays:
|
|
1094
|
-
days:
|
|
1095
|
-
onDateSelect:
|
|
1096
|
-
isSelected: (
|
|
1097
|
-
isInRange:
|
|
1098
|
-
isToday: (
|
|
1099
|
-
isDisabled: (
|
|
1094
|
+
calendarDays: K,
|
|
1095
|
+
days: it,
|
|
1096
|
+
onDateSelect: ct,
|
|
1097
|
+
isSelected: (d) => P(d, u),
|
|
1098
|
+
isInRange: G,
|
|
1099
|
+
isToday: (d) => s && j(d),
|
|
1100
|
+
isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
|
|
1100
1101
|
disabled: r,
|
|
1101
|
-
showNepaliNumbers:
|
|
1102
|
-
convertToNepaliNumber:
|
|
1102
|
+
showNepaliNumbers: M,
|
|
1103
|
+
convertToNepaliNumber: U
|
|
1103
1104
|
}
|
|
1104
1105
|
)
|
|
1105
1106
|
] })
|
|
1106
1107
|
] }),
|
|
1107
|
-
|
|
1108
|
+
u === "range" && c && f === "left" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
|
|
1108
1109
|
/* @__PURE__ */ g(
|
|
1109
|
-
|
|
1110
|
+
gt,
|
|
1110
1111
|
{
|
|
1111
|
-
presets:
|
|
1112
|
+
presets: rt,
|
|
1112
1113
|
calendarType: e,
|
|
1113
|
-
onPresetSelect:
|
|
1114
|
-
activePreset:
|
|
1114
|
+
onPresetSelect: ut,
|
|
1115
|
+
activePreset: at,
|
|
1115
1116
|
position: "left"
|
|
1116
1117
|
}
|
|
1117
1118
|
),
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ C("div", { children: [
|
|
1119
1120
|
/* @__PURE__ */ g(
|
|
1120
|
-
|
|
1121
|
+
lt,
|
|
1121
1122
|
{
|
|
1122
|
-
currentMonth:
|
|
1123
|
-
currentYear:
|
|
1124
|
-
months:
|
|
1125
|
-
onNavigateMonth:
|
|
1126
|
-
onYearChange:
|
|
1127
|
-
onMonthChange:
|
|
1123
|
+
currentMonth: v,
|
|
1124
|
+
currentYear: O,
|
|
1125
|
+
months: z,
|
|
1126
|
+
onNavigateMonth: E,
|
|
1127
|
+
onYearChange: A,
|
|
1128
|
+
onMonthChange: y,
|
|
1128
1129
|
disabled: r,
|
|
1129
|
-
showNepaliNumbers:
|
|
1130
|
-
convertToNepaliNumber:
|
|
1130
|
+
showNepaliNumbers: M,
|
|
1131
|
+
convertToNepaliNumber: U,
|
|
1131
1132
|
calendarType: e
|
|
1132
1133
|
}
|
|
1133
1134
|
),
|
|
1134
1135
|
/* @__PURE__ */ g(
|
|
1135
|
-
|
|
1136
|
+
dt,
|
|
1136
1137
|
{
|
|
1137
|
-
calendarDays:
|
|
1138
|
-
days:
|
|
1139
|
-
onDateSelect:
|
|
1140
|
-
isSelected: (
|
|
1141
|
-
isInRange:
|
|
1142
|
-
isToday: (
|
|
1143
|
-
isDisabled: (
|
|
1138
|
+
calendarDays: K,
|
|
1139
|
+
days: it,
|
|
1140
|
+
onDateSelect: ct,
|
|
1141
|
+
isSelected: (d) => P(d, u),
|
|
1142
|
+
isInRange: G,
|
|
1143
|
+
isToday: (d) => s && j(d),
|
|
1144
|
+
isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
|
|
1144
1145
|
disabled: r,
|
|
1145
|
-
showNepaliNumbers:
|
|
1146
|
-
convertToNepaliNumber:
|
|
1146
|
+
showNepaliNumbers: M,
|
|
1147
|
+
convertToNepaliNumber: U
|
|
1147
1148
|
}
|
|
1148
1149
|
)
|
|
1149
1150
|
] })
|
|
1150
1151
|
] }),
|
|
1151
|
-
|
|
1152
|
-
/* @__PURE__ */
|
|
1152
|
+
u === "range" && c && f === "right" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
|
|
1153
|
+
/* @__PURE__ */ C("div", { children: [
|
|
1153
1154
|
/* @__PURE__ */ g(
|
|
1154
|
-
|
|
1155
|
+
lt,
|
|
1155
1156
|
{
|
|
1156
|
-
currentMonth:
|
|
1157
|
-
currentYear:
|
|
1158
|
-
months:
|
|
1159
|
-
onNavigateMonth:
|
|
1160
|
-
onYearChange:
|
|
1161
|
-
onMonthChange:
|
|
1157
|
+
currentMonth: v,
|
|
1158
|
+
currentYear: O,
|
|
1159
|
+
months: z,
|
|
1160
|
+
onNavigateMonth: E,
|
|
1161
|
+
onYearChange: A,
|
|
1162
|
+
onMonthChange: y,
|
|
1162
1163
|
disabled: r,
|
|
1163
|
-
showNepaliNumbers:
|
|
1164
|
-
convertToNepaliNumber:
|
|
1164
|
+
showNepaliNumbers: M,
|
|
1165
|
+
convertToNepaliNumber: U,
|
|
1165
1166
|
calendarType: e
|
|
1166
1167
|
}
|
|
1167
1168
|
),
|
|
1168
1169
|
/* @__PURE__ */ g(
|
|
1169
|
-
|
|
1170
|
+
dt,
|
|
1170
1171
|
{
|
|
1171
|
-
calendarDays:
|
|
1172
|
-
days:
|
|
1173
|
-
onDateSelect:
|
|
1174
|
-
isSelected: (
|
|
1175
|
-
isInRange:
|
|
1176
|
-
isToday: (
|
|
1177
|
-
isDisabled: (
|
|
1172
|
+
calendarDays: K,
|
|
1173
|
+
days: it,
|
|
1174
|
+
onDateSelect: ct,
|
|
1175
|
+
isSelected: (d) => P(d, u),
|
|
1176
|
+
isInRange: G,
|
|
1177
|
+
isToday: (d) => s && j(d),
|
|
1178
|
+
isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
|
|
1178
1179
|
disabled: r,
|
|
1179
|
-
showNepaliNumbers:
|
|
1180
|
-
convertToNepaliNumber:
|
|
1180
|
+
showNepaliNumbers: M,
|
|
1181
|
+
convertToNepaliNumber: U
|
|
1181
1182
|
}
|
|
1182
1183
|
)
|
|
1183
1184
|
] }),
|
|
1184
1185
|
/* @__PURE__ */ g(
|
|
1185
|
-
|
|
1186
|
+
gt,
|
|
1186
1187
|
{
|
|
1187
|
-
presets:
|
|
1188
|
+
presets: rt,
|
|
1188
1189
|
calendarType: e,
|
|
1189
|
-
onPresetSelect:
|
|
1190
|
-
activePreset:
|
|
1190
|
+
onPresetSelect: ut,
|
|
1191
|
+
activePreset: at,
|
|
1191
1192
|
position: "right"
|
|
1192
1193
|
}
|
|
1193
1194
|
)
|
|
1194
1195
|
] }),
|
|
1195
|
-
(!
|
|
1196
|
-
|
|
1197
|
-
|
|
1196
|
+
(!u || u === "single" || !c && !I || f === "top" || f === "bottom") && /* @__PURE__ */ C(pe, { children: [
|
|
1197
|
+
u === "range" && c && f === "top" && /* @__PURE__ */ g(
|
|
1198
|
+
gt,
|
|
1198
1199
|
{
|
|
1199
|
-
presets:
|
|
1200
|
+
presets: rt,
|
|
1200
1201
|
calendarType: e,
|
|
1201
|
-
onPresetSelect:
|
|
1202
|
-
activePreset:
|
|
1202
|
+
onPresetSelect: ut,
|
|
1203
|
+
activePreset: at,
|
|
1203
1204
|
position: "top"
|
|
1204
1205
|
}
|
|
1205
1206
|
),
|
|
1206
1207
|
/* @__PURE__ */ g(
|
|
1207
|
-
|
|
1208
|
+
lt,
|
|
1208
1209
|
{
|
|
1209
|
-
currentMonth:
|
|
1210
|
-
currentYear:
|
|
1211
|
-
months:
|
|
1212
|
-
onNavigateMonth:
|
|
1213
|
-
onYearChange:
|
|
1214
|
-
onMonthChange:
|
|
1210
|
+
currentMonth: v,
|
|
1211
|
+
currentYear: O,
|
|
1212
|
+
months: z,
|
|
1213
|
+
onNavigateMonth: E,
|
|
1214
|
+
onYearChange: A,
|
|
1215
|
+
onMonthChange: y,
|
|
1215
1216
|
disabled: r,
|
|
1216
|
-
showNepaliNumbers:
|
|
1217
|
-
convertToNepaliNumber:
|
|
1217
|
+
showNepaliNumbers: M,
|
|
1218
|
+
convertToNepaliNumber: U,
|
|
1218
1219
|
calendarType: e
|
|
1219
1220
|
}
|
|
1220
1221
|
),
|
|
1221
1222
|
/* @__PURE__ */ g(
|
|
1222
|
-
|
|
1223
|
+
dt,
|
|
1223
1224
|
{
|
|
1224
|
-
calendarDays:
|
|
1225
|
-
days:
|
|
1226
|
-
onDateSelect:
|
|
1227
|
-
isSelected: (
|
|
1228
|
-
isInRange:
|
|
1229
|
-
isToday: (
|
|
1230
|
-
isDisabled: (
|
|
1225
|
+
calendarDays: K,
|
|
1226
|
+
days: it,
|
|
1227
|
+
onDateSelect: ct,
|
|
1228
|
+
isSelected: (d) => P(d, u),
|
|
1229
|
+
isInRange: G,
|
|
1230
|
+
isToday: (d) => s && j(d),
|
|
1231
|
+
isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
|
|
1231
1232
|
disabled: r,
|
|
1232
|
-
showNepaliNumbers:
|
|
1233
|
-
convertToNepaliNumber:
|
|
1233
|
+
showNepaliNumbers: M,
|
|
1234
|
+
convertToNepaliNumber: U
|
|
1234
1235
|
}
|
|
1235
1236
|
),
|
|
1236
|
-
|
|
1237
|
-
|
|
1237
|
+
u === "range" && c && f === "bottom" && /* @__PURE__ */ g(
|
|
1238
|
+
gt,
|
|
1238
1239
|
{
|
|
1239
|
-
presets:
|
|
1240
|
+
presets: rt,
|
|
1240
1241
|
calendarType: e,
|
|
1241
|
-
onPresetSelect:
|
|
1242
|
-
activePreset:
|
|
1242
|
+
onPresetSelect: ut,
|
|
1243
|
+
activePreset: at,
|
|
1243
1244
|
position: "bottom"
|
|
1244
1245
|
}
|
|
1245
1246
|
)
|
|
@@ -1247,7 +1248,7 @@ const y3 = [
|
|
|
1247
1248
|
]
|
|
1248
1249
|
}
|
|
1249
1250
|
);
|
|
1250
|
-
},
|
|
1251
|
+
}, B3 = ({
|
|
1251
1252
|
placeholder: e = "Select date",
|
|
1252
1253
|
format: t = "YYYY-MM-DD",
|
|
1253
1254
|
defaultValue: n,
|
|
@@ -1255,93 +1256,117 @@ const y3 = [
|
|
|
1255
1256
|
inputClassName: s = "",
|
|
1256
1257
|
popupClassName: r = "",
|
|
1257
1258
|
style: o,
|
|
1258
|
-
inputStyle:
|
|
1259
|
-
icon:
|
|
1259
|
+
inputStyle: i,
|
|
1260
|
+
icon: u,
|
|
1260
1261
|
showIcon: h = !0,
|
|
1261
1262
|
calendarType: c = "AD",
|
|
1262
1263
|
...f
|
|
1263
1264
|
}) => {
|
|
1264
|
-
const [
|
|
1265
|
+
const [l, $] = H(!1), [D, F] = H(null), [I, st] = H(void 0), [q, M] = H(() => {
|
|
1265
1266
|
if (!n) return "";
|
|
1266
1267
|
if (c === "BS")
|
|
1267
1268
|
try {
|
|
1268
|
-
const [
|
|
1269
|
-
return `${
|
|
1269
|
+
const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
|
|
1270
|
+
return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
|
|
1270
1271
|
} catch {
|
|
1271
1272
|
return n;
|
|
1272
1273
|
}
|
|
1273
1274
|
return n;
|
|
1274
|
-
})
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1275
|
+
});
|
|
1276
|
+
Dt(() => {
|
|
1277
|
+
if (n)
|
|
1278
|
+
if (c === "BS")
|
|
1279
|
+
try {
|
|
1280
|
+
const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
|
|
1281
|
+
M(`${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`);
|
|
1282
|
+
} catch {
|
|
1283
|
+
M(n);
|
|
1284
|
+
}
|
|
1285
|
+
else
|
|
1286
|
+
M(n);
|
|
1287
|
+
}, [n, c]);
|
|
1288
|
+
const B = mt(() => {
|
|
1289
|
+
if (n) {
|
|
1290
|
+
if (c === "BS")
|
|
1291
|
+
try {
|
|
1292
|
+
const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
|
|
1293
|
+
return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
|
|
1294
|
+
} catch {
|
|
1295
|
+
return n;
|
|
1296
|
+
}
|
|
1297
|
+
return n;
|
|
1298
|
+
}
|
|
1299
|
+
}, [n, c]), k = xt(null), b = xt(null), [J, O] = H({ visibility: "hidden" }), v = () => {
|
|
1300
|
+
if (!k.current) return;
|
|
1301
|
+
const m = k.current.getBoundingClientRect(), S = b.current?.offsetHeight || 360, A = b.current?.offsetWidth || 280, y = window.innerHeight - m.bottom, E = window.innerWidth - m.left, j = y >= S + 8 ? m.bottom + 8 : Math.max(8, m.top - S - 8), P = E >= A ? m.left : Math.max(8, m.right - A);
|
|
1302
|
+
O({ top: j, left: P, visibility: "visible" });
|
|
1278
1303
|
};
|
|
1279
|
-
|
|
1280
|
-
window.removeEventListener("scroll",
|
|
1281
|
-
}), [
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1304
|
+
Dt(() => (l && (requestAnimationFrame(v), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v)), () => {
|
|
1305
|
+
window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
|
|
1306
|
+
}), [l]), Dt(() => {
|
|
1307
|
+
const m = (S) => {
|
|
1308
|
+
k.current && !k.current.contains(S.target) && $(!1);
|
|
1284
1309
|
};
|
|
1285
|
-
return
|
|
1286
|
-
}, [
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1290
|
-
const
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1310
|
+
return l && document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
1311
|
+
}, [l]);
|
|
1312
|
+
const L = (m) => {
|
|
1313
|
+
F(m), st(c === "BS" ? m.bs : m.ad), M(c === "BS" ? m.bs : m.ad), $(!1), a?.(m);
|
|
1314
|
+
}, wt = (m) => {
|
|
1315
|
+
const S = m.target.value;
|
|
1316
|
+
if (S === "") {
|
|
1317
|
+
M("");
|
|
1293
1318
|
return;
|
|
1294
1319
|
}
|
|
1295
|
-
if ((
|
|
1296
|
-
const
|
|
1297
|
-
let
|
|
1298
|
-
|
|
1320
|
+
if ((m.target.selectionStart || 0) === S.length && S.length > q.length) {
|
|
1321
|
+
const y = S.replace(/[^0-9]/g, "");
|
|
1322
|
+
let E = y;
|
|
1323
|
+
y.length > 4 && y.length <= 6 ? E = y.slice(0, 4) + "-" + y.slice(4) : y.length > 6 && (E = y.slice(0, 4) + "-" + y.slice(4, 6) + "-" + y.slice(6, 8)), M(E);
|
|
1299
1324
|
} else {
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1325
|
+
const y = S.replace(/[^0-9-]/g, "");
|
|
1326
|
+
y.length <= 10 && M(y);
|
|
1302
1327
|
}
|
|
1303
|
-
},
|
|
1304
|
-
const
|
|
1305
|
-
if (!
|
|
1306
|
-
|
|
1328
|
+
}, K = () => {
|
|
1329
|
+
const m = q.trim();
|
|
1330
|
+
if (!m) {
|
|
1331
|
+
F(null);
|
|
1307
1332
|
return;
|
|
1308
1333
|
}
|
|
1309
|
-
const
|
|
1310
|
-
if (
|
|
1311
|
-
const [,
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1334
|
+
const S = m.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
1335
|
+
if (S) {
|
|
1336
|
+
const [, A, y, E] = S, j = parseInt(y), P = parseInt(E);
|
|
1337
|
+
if (j < 1 || j > 12 || P < 1 || P > 32) {
|
|
1338
|
+
M(D ? c === "BS" ? D.bs : D.ad : "");
|
|
1314
1339
|
return;
|
|
1315
1340
|
}
|
|
1316
|
-
const
|
|
1317
|
-
bs: c === "BS" ? `${
|
|
1318
|
-
ad: c === "AD" ? `${
|
|
1341
|
+
const G = {
|
|
1342
|
+
bs: c === "BS" ? `${A}-${y}-${E}` : "",
|
|
1343
|
+
ad: c === "AD" ? `${A}-${y}-${E}` : "",
|
|
1319
1344
|
formatted: {
|
|
1320
|
-
bs: c === "BS" ?
|
|
1321
|
-
ad: c === "AD" ?
|
|
1345
|
+
bs: c === "BS" ? m : "",
|
|
1346
|
+
ad: c === "AD" ? m : ""
|
|
1322
1347
|
}
|
|
1323
1348
|
};
|
|
1324
|
-
if (
|
|
1325
|
-
a?.(
|
|
1326
|
-
} else
|
|
1349
|
+
if (F(G), D === null) return;
|
|
1350
|
+
a?.(G);
|
|
1351
|
+
} else m.length < 10 && M(D ? c === "BS" ? D.bs : D.ad : "");
|
|
1327
1352
|
};
|
|
1328
|
-
return /* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ C("div", { className: "bsac-datepicker", ref: k, style: o, children: [
|
|
1329
1354
|
/* @__PURE__ */ g(
|
|
1330
1355
|
"input",
|
|
1331
1356
|
{
|
|
1332
1357
|
type: "text",
|
|
1333
|
-
value:
|
|
1358
|
+
value: q,
|
|
1334
1359
|
placeholder: e,
|
|
1335
|
-
onChange:
|
|
1336
|
-
onBlur:
|
|
1337
|
-
onKeyDown: (
|
|
1338
|
-
|
|
1360
|
+
onChange: wt,
|
|
1361
|
+
onBlur: K,
|
|
1362
|
+
onKeyDown: (m) => {
|
|
1363
|
+
m.key === "Enter" ? (K(), $(!1)) : m.key === "Escape" && $(!1);
|
|
1339
1364
|
},
|
|
1340
1365
|
className: `bsac-input ${s}`,
|
|
1341
|
-
style:
|
|
1366
|
+
style: i,
|
|
1342
1367
|
"aria-label": "Date picker input",
|
|
1343
1368
|
"aria-haspopup": "dialog",
|
|
1344
|
-
"aria-expanded":
|
|
1369
|
+
"aria-expanded": l,
|
|
1345
1370
|
maxLength: 10
|
|
1346
1371
|
}
|
|
1347
1372
|
),
|
|
@@ -1350,10 +1375,10 @@ const y3 = [
|
|
|
1350
1375
|
{
|
|
1351
1376
|
type: "button",
|
|
1352
1377
|
className: "bsac-icon-btn",
|
|
1353
|
-
onClick: () =>
|
|
1378
|
+
onClick: () => $(!l),
|
|
1354
1379
|
"aria-label": "Toggle calendar",
|
|
1355
1380
|
style: { display: h ? "flex" : "none" },
|
|
1356
|
-
children:
|
|
1381
|
+
children: u || /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1357
1382
|
/* @__PURE__ */ g("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1358
1383
|
/* @__PURE__ */ g("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
1359
1384
|
/* @__PURE__ */ g("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
@@ -1361,27 +1386,27 @@ const y3 = [
|
|
|
1361
1386
|
] })
|
|
1362
1387
|
}
|
|
1363
1388
|
),
|
|
1364
|
-
|
|
1389
|
+
/* @__PURE__ */ g("div", { ref: b, className: `bsac-popup ${r}`, style: { ...J, display: l ? void 0 : "none" }, children: /* @__PURE__ */ g(C3, { calendarType: c, onDateSelect: L, value: I ?? B, ...f }) })
|
|
1365
1390
|
] });
|
|
1366
1391
|
};
|
|
1367
1392
|
export {
|
|
1368
1393
|
C3 as Calendar,
|
|
1369
|
-
|
|
1394
|
+
B3 as CalendarInput,
|
|
1370
1395
|
N3 as DEFAULT_COLORS,
|
|
1371
|
-
|
|
1396
|
+
B3 as DatePicker,
|
|
1372
1397
|
p3 as ENGLISH_DAYS,
|
|
1373
|
-
|
|
1398
|
+
f3 as ENGLISH_MONTHS_AD,
|
|
1374
1399
|
me as ENGLISH_MONTHS_BS,
|
|
1375
1400
|
M3 as NEPALI_DAYS,
|
|
1376
|
-
|
|
1401
|
+
S3 as NEPALI_DIGITS,
|
|
1377
1402
|
y3 as NEPALI_MONTHS,
|
|
1378
1403
|
O3 as PRESET_KEYS,
|
|
1379
|
-
|
|
1380
|
-
|
|
1404
|
+
U as convertToNepaliNumber,
|
|
1405
|
+
kt as createDateOutput,
|
|
1381
1406
|
Y3 as createPredefinedRanges,
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1407
|
+
De as getDaysInMonth,
|
|
1408
|
+
b3 as getFirstDayOfMonth,
|
|
1409
|
+
N as getTodayDate,
|
|
1385
1410
|
H3 as isDateInRange,
|
|
1386
1411
|
E3 as useCalendar
|
|
1387
1412
|
};
|