esday 0.5.0 → 0.6.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/CHANGELOG.md +37 -0
- package/LICENSE +21 -21
- package/README.md +63 -51
- package/chunks/AyQQ6US-.js +84 -0
- package/chunks/{Y32qdU_5.js → BkjWOpMU.js} +7 -1
- package/chunks/{MtjcOKi-.d.ts → C5qDMHT5.d.ts} +2 -2
- package/chunks/{DqhiVwLi.d.ts → CODi8AFH.d.ts} +63 -35
- package/chunks/CXWzCl3n.js +481 -0
- package/chunks/{BRRrAbUl.js → CdvTtmWL.js} +2 -2
- package/chunks/{DXHbH1CI.js → Shk32pTP.js} +1 -1
- package/chunks/{Cb5SvF6r.js → v_QBn7Xm.js} +1 -1
- package/chunks/xt8C2lbv.js +38 -0
- package/index.d.ts +3 -3
- package/index.js +1 -571
- package/locales/af.d.ts +1 -3
- package/locales/af.js +4 -2
- package/locales/am.d.ts +1 -3
- package/locales/am.js +4 -2
- package/locales/ar-dz.d.ts +1 -3
- package/locales/ar-dz.js +7 -9
- package/locales/ar-iq.d.ts +1 -3
- package/locales/ar-iq.js +7 -9
- package/locales/ar-kw.d.ts +1 -3
- package/locales/ar-kw.js +7 -9
- package/locales/ar-ly.d.ts +1 -3
- package/locales/ar-ly.js +7 -9
- package/locales/ar-ma.d.ts +1 -3
- package/locales/ar-ma.js +7 -9
- package/locales/ar-sa.d.ts +1 -3
- package/locales/ar-sa.js +7 -9
- package/locales/ar-tn.d.ts +1 -3
- package/locales/ar-tn.js +7 -9
- package/locales/ar.d.ts +1 -3
- package/locales/ar.js +197 -2
- package/locales/az.d.ts +1 -3
- package/locales/az.js +4 -2
- package/locales/be.d.ts +1 -3
- package/locales/be.js +55 -59
- package/locales/bg.d.ts +1 -3
- package/locales/bg.js +4 -2
- package/locales/bi.d.ts +1 -3
- package/locales/bi.js +4 -2
- package/locales/bm.d.ts +1 -3
- package/locales/bm.js +4 -2
- package/locales/bn-bd.d.ts +1 -3
- package/locales/bn-bd.js +7 -9
- package/locales/bn.d.ts +1 -3
- package/locales/bn.js +136 -2
- package/locales/bo.d.ts +1 -3
- package/locales/bo.js +4 -2
- package/locales/br.d.ts +1 -3
- package/locales/br.js +10 -9
- package/locales/bs.d.ts +1 -3
- package/locales/bs.js +4 -2
- package/locales/ca.d.ts +1 -3
- package/locales/ca.js +35 -36
- package/locales/cs.d.ts +1 -3
- package/locales/cs.js +38 -34
- package/locales/cv.d.ts +1 -3
- package/locales/cv.js +4 -2
- package/locales/cy.d.ts +1 -3
- package/locales/cy.js +4 -2
- package/locales/da.d.ts +1 -3
- package/locales/da.js +4 -2
- package/locales/de-at.d.ts +1 -3
- package/locales/de-at.js +7 -9
- package/locales/de-ch.d.ts +1 -3
- package/locales/de-ch.js +7 -9
- package/locales/de.d.ts +1 -3
- package/locales/de.js +130 -2
- package/locales/dv.d.ts +1 -3
- package/locales/dv.js +4 -2
- package/locales/el.d.ts +1 -3
- package/locales/el.js +4 -2
- package/locales/en-au.d.ts +1 -3
- package/locales/en-au.js +7 -8
- package/locales/en-ca.d.ts +1 -3
- package/locales/en-ca.js +7 -8
- package/locales/en-gb.d.ts +1 -3
- package/locales/en-gb.js +9 -8
- package/locales/en-ie.d.ts +1 -3
- package/locales/en-ie.js +7 -8
- package/locales/en-il.d.ts +1 -3
- package/locales/en-il.js +7 -8
- package/locales/en-in.d.ts +1 -3
- package/locales/en-in.js +7 -8
- package/locales/en-nz.d.ts +1 -3
- package/locales/en-nz.js +7 -8
- package/locales/en-sg.d.ts +1 -3
- package/locales/en-sg.js +7 -8
- package/locales/en-tt.d.ts +1 -3
- package/locales/en-tt.js +7 -8
- package/locales/en-us.d.ts +1 -3
- package/locales/en-us.js +7 -8
- package/locales/en.d.ts +1 -3
- package/locales/en.js +116 -2
- package/locales/eo.d.ts +1 -3
- package/locales/eo.js +4 -2
- package/locales/es-do.d.ts +1 -3
- package/locales/es-do.js +7 -9
- package/locales/es-mx.d.ts +1 -3
- package/locales/es-mx.js +7 -9
- package/locales/es-pr.d.ts +1 -3
- package/locales/es-pr.js +7 -9
- package/locales/es-us.d.ts +1 -3
- package/locales/es-us.js +7 -9
- package/locales/es.d.ts +1 -3
- package/locales/es.js +117 -2
- package/locales/et.d.ts +1 -3
- package/locales/et.js +6 -2
- package/locales/eu.d.ts +1 -3
- package/locales/eu.js +4 -2
- package/locales/fa.d.ts +1 -3
- package/locales/fa.js +4 -2
- package/locales/fi.d.ts +1 -3
- package/locales/fi.js +8 -2
- package/locales/fil.d.ts +1 -3
- package/locales/fil.js +4 -2
- package/locales/fo.d.ts +1 -3
- package/locales/fo.js +4 -2
- package/locales/fr-ca.d.ts +1 -3
- package/locales/fr-ca.js +7 -9
- package/locales/fr-ch.d.ts +1 -3
- package/locales/fr-ch.js +7 -9
- package/locales/fr.d.ts +1 -3
- package/locales/fr.js +109 -2
- package/locales/fy.d.ts +1 -3
- package/locales/fy.js +4 -2
- package/locales/ga.d.ts +1 -3
- package/locales/ga.js +4 -2
- package/locales/gd.d.ts +1 -3
- package/locales/gd.js +4 -2
- package/locales/gl.d.ts +1 -3
- package/locales/gl.js +4 -2
- package/locales/gom-deva.d.ts +1 -3
- package/locales/gom-deva.js +34 -32
- package/locales/gom-latn.d.ts +1 -3
- package/locales/gom-latn.js +34 -32
- package/locales/gu.d.ts +1 -3
- package/locales/gu.js +4 -2
- package/locales/he.d.ts +1 -3
- package/locales/he.js +8 -5
- package/locales/hi.d.ts +1 -3
- package/locales/hi.js +34 -35
- package/locales/hr.d.ts +1 -3
- package/locales/hr.js +10 -4
- package/locales/ht.d.ts +1 -3
- package/locales/ht.js +4 -2
- package/locales/hu.d.ts +1 -3
- package/locales/hu.js +6 -2
- package/locales/hy-am.d.ts +1 -3
- package/locales/hy-am.js +34 -35
- package/locales/id.d.ts +1 -3
- package/locales/id.js +4 -2
- package/locales/is.d.ts +1 -3
- package/locales/is.js +14 -2
- package/locales/it-ch.d.ts +1 -3
- package/locales/it-ch.js +4 -9
- package/locales/it.d.ts +1 -3
- package/locales/it.js +120 -2
- package/locales/ja.d.ts +1 -4
- package/locales/ja.js +4 -2
- package/locales/jv.d.ts +1 -3
- package/locales/jv.js +4 -2
- package/locales/ka.d.ts +1 -3
- package/locales/ka.js +25 -26
- package/locales/kk.d.ts +1 -3
- package/locales/kk.js +4 -2
- package/locales/km.d.ts +1 -3
- package/locales/km.js +4 -2
- package/locales/kn.d.ts +1 -3
- package/locales/kn.js +4 -2
- package/locales/ko.d.ts +1 -3
- package/locales/ko.js +5 -3
- package/locales/ku.d.ts +1 -3
- package/locales/ku.js +4 -2
- package/locales/ky.d.ts +1 -3
- package/locales/ky.js +4 -2
- package/locales/lb.d.ts +1 -3
- package/locales/lb.js +5 -2
- package/locales/lo.d.ts +1 -3
- package/locales/lo.js +4 -2
- package/locales/lt.d.ts +1 -3
- package/locales/lt.js +4 -2
- package/locales/lv.d.ts +1 -3
- package/locales/lv.js +4 -2
- package/locales/me.d.ts +1 -3
- package/locales/me.js +33 -33
- package/locales/mi.d.ts +1 -3
- package/locales/mi.js +4 -2
- package/locales/mk.d.ts +1 -3
- package/locales/mk.js +4 -2
- package/locales/ml.d.ts +1 -3
- package/locales/ml.js +4 -2
- package/locales/mn.d.ts +1 -3
- package/locales/mn.js +37 -16
- package/locales/mr.d.ts +1 -3
- package/locales/mr.js +16 -2
- package/locales/ms-my.d.ts +1 -3
- package/locales/ms-my.js +7 -9
- package/locales/ms.d.ts +1 -3
- package/locales/ms.js +107 -2
- package/locales/mt.d.ts +1 -3
- package/locales/mt.js +4 -2
- package/locales/my.d.ts +1 -3
- package/locales/my.js +4 -2
- package/locales/nb.d.ts +1 -3
- package/locales/nb.js +4 -2
- package/locales/ne.d.ts +1 -3
- package/locales/ne.js +4 -2
- package/locales/nl-be.d.ts +1 -3
- package/locales/nl-be.js +7 -9
- package/locales/nl.d.ts +1 -3
- package/locales/nl.js +107 -2
- package/locales/nn.d.ts +1 -3
- package/locales/nn.js +4 -2
- package/locales/oc-lnc.d.ts +1 -3
- package/locales/oc-lnc.js +35 -36
- package/locales/pa-in.d.ts +1 -3
- package/locales/pa-in.js +4 -2
- package/locales/pl.d.ts +1 -3
- package/locales/pl.js +5 -2
- package/locales/pt-br.d.ts +1 -3
- package/locales/pt-br.js +7 -9
- package/locales/pt.d.ts +1 -3
- package/locales/pt.js +109 -2
- package/locales/rn.d.ts +1 -3
- package/locales/rn.js +4 -2
- package/locales/ro.d.ts +1 -3
- package/locales/ro.js +4 -2
- package/locales/ru.d.ts +1 -4
- package/locales/ru.js +83 -82
- package/locales/rw.d.ts +1 -3
- package/locales/rw.js +4 -2
- package/locales/sd.d.ts +1 -3
- package/locales/sd.js +4 -2
- package/locales/se.d.ts +1 -3
- package/locales/se.js +4 -2
- package/locales/si.d.ts +1 -3
- package/locales/si.js +4 -2
- package/locales/sk.d.ts +1 -3
- package/locales/sk.js +8 -2
- package/locales/sl.d.ts +1 -3
- package/locales/sl.js +8 -2
- package/locales/sq.d.ts +1 -3
- package/locales/sq.js +4 -2
- package/locales/sr-cyrl.d.ts +1 -3
- package/locales/sr-cyrl.js +16 -15
- package/locales/sr.d.ts +1 -3
- package/locales/sr.js +185 -2
- package/locales/ss.d.ts +1 -3
- package/locales/ss.js +4 -2
- package/locales/sv-fi.d.ts +1 -3
- package/locales/sv-fi.js +7 -9
- package/locales/sv.d.ts +1 -3
- package/locales/sv.js +110 -2
- package/locales/sw.d.ts +1 -3
- package/locales/sw.js +4 -2
- package/locales/ta.d.ts +1 -3
- package/locales/ta.js +4 -2
- package/locales/te.d.ts +1 -3
- package/locales/te.js +4 -2
- package/locales/tet.d.ts +1 -3
- package/locales/tet.js +5 -4
- package/locales/tg.d.ts +1 -3
- package/locales/tg.js +34 -35
- package/locales/th.d.ts +1 -3
- package/locales/th.js +4 -2
- package/locales/tk.d.ts +1 -3
- package/locales/tk.js +5 -4
- package/locales/tl-ph.d.ts +1 -3
- package/locales/tl-ph.js +4 -2
- package/locales/tlh.d.ts +1 -3
- package/locales/tlh.js +5 -2
- package/locales/tr.d.ts +1 -3
- package/locales/tr.js +5 -4
- package/locales/tzl.d.ts +1 -3
- package/locales/tzl.js +4 -2
- package/locales/tzm-latn.d.ts +1 -3
- package/locales/tzm-latn.js +9 -9
- package/locales/tzm.d.ts +1 -3
- package/locales/tzm.js +107 -2
- package/locales/ug-cn.d.ts +1 -3
- package/locales/ug-cn.js +4 -2
- package/locales/uk.d.ts +1 -3
- package/locales/uk.js +37 -32
- package/locales/ur.d.ts +1 -3
- package/locales/ur.js +4 -2
- package/locales/uz-latn.d.ts +1 -3
- package/locales/uz-latn.js +9 -9
- package/locales/uz.d.ts +1 -3
- package/locales/uz.js +107 -2
- package/locales/vi.d.ts +1 -3
- package/locales/vi.js +4 -2
- package/locales/x-pseudo.d.ts +1 -3
- package/locales/x-pseudo.js +5 -4
- package/locales/yo.d.ts +1 -3
- package/locales/yo.js +4 -2
- package/locales/zh-cn.d.ts +1 -3
- package/locales/zh-cn.js +7 -9
- package/locales/zh-hk.d.ts +1 -3
- package/locales/zh-hk.js +7 -9
- package/locales/zh-mo.d.ts +1 -3
- package/locales/zh-mo.js +7 -9
- package/locales/zh-tw.d.ts +1 -3
- package/locales/zh-tw.js +7 -9
- package/locales/zh.d.ts +1 -4
- package/locales/zh.js +128 -2
- package/package.json +29 -23
- package/plugins/advancedFormat/index.d.ts +1 -3
- package/plugins/advancedFormat/index.js +4 -6
- package/plugins/advancedParse/index.d.ts +1 -3
- package/plugins/advancedParse/index.js +21 -20
- package/plugins/calendar/index.d.ts +2 -4
- package/plugins/calendar/index.js +1 -2
- package/plugins/dayOfYear/index.d.ts +1 -2
- package/plugins/dayOfYear/index.js +1 -2
- package/plugins/duration/index.d.ts +78 -0
- package/plugins/duration/index.js +477 -0
- package/plugins/isBetween/index.d.ts +1 -2
- package/plugins/isBetween/index.js +2 -3
- package/plugins/isLeapYear/index.d.ts +1 -2
- package/plugins/isLeapYear/index.js +1 -2
- package/plugins/isSameOrAfter/index.d.ts +1 -2
- package/plugins/isSameOrAfter/index.js +1 -2
- package/plugins/isSameOrBefore/index.d.ts +1 -2
- package/plugins/isSameOrBefore/index.js +1 -2
- package/plugins/isToday/index.d.ts +1 -2
- package/plugins/isToday/index.js +2 -3
- package/plugins/isTomorrow/index.d.ts +1 -2
- package/plugins/isTomorrow/index.js +2 -3
- package/plugins/isYesterday/index.d.ts +1 -2
- package/plugins/isYesterday/index.js +2 -3
- package/plugins/isoWeek/index.d.ts +1 -3
- package/plugins/isoWeek/index.js +13 -25
- package/plugins/locale/index.d.ts +103 -3
- package/plugins/locale/index.js +140 -6
- package/plugins/localeData/index.d.ts +1 -3
- package/plugins/localeData/index.js +18 -11
- package/plugins/localizedFormat/index.d.ts +1 -3
- package/plugins/localizedFormat/index.js +5 -10
- package/plugins/localizedParse/index.d.ts +1 -3
- package/plugins/localizedParse/index.js +40 -22
- package/plugins/minMax/index.d.ts +1 -2
- package/plugins/minMax/index.js +2 -3
- package/plugins/objectSupport/index.d.ts +1 -3
- package/plugins/objectSupport/index.js +33 -38
- package/plugins/pluralGetSet/index.d.ts +1 -3
- package/plugins/pluralGetSet/index.js +1 -2
- package/plugins/quarterOfYear/index.d.ts +1 -3
- package/plugins/quarterOfYear/index.js +11 -18
- package/plugins/relativeTime/index.d.ts +32 -44
- package/plugins/relativeTime/index.js +124 -91
- package/plugins/timezone/index.d.ts +6 -0
- package/plugins/timezone/index.js +456 -0
- package/plugins/toArray/index.d.ts +1 -2
- package/plugins/toArray/index.js +1 -2
- package/plugins/toObject/index.d.ts +1 -2
- package/plugins/toObject/index.js +1 -2
- package/plugins/utc/index.d.ts +1 -2
- package/plugins/utc/index.js +37 -39
- package/plugins/week/index.d.ts +1 -3
- package/plugins/week/index.js +17 -27
- package/chunks/B5f9poqo.js +0 -120
- package/chunks/BDssPbM_.js +0 -106
- package/chunks/BXRGSAJG.js +0 -128
- package/chunks/BeVgU2nj.js +0 -188
- package/chunks/BtmEtAW3.js +0 -43
- package/chunks/CQ57zhVp.js +0 -106
- package/chunks/CQJ0-ZuR.js +0 -106
- package/chunks/CWqzr5E5.js +0 -108
- package/chunks/Cg4ZI9v8.js +0 -180
- package/chunks/CoBtJ4c1.js +0 -144
- package/chunks/D009Z-ld.js +0 -109
- package/chunks/DMtTiWuY.js +0 -127
- package/chunks/Dixb5KKs.js +0 -116
- package/chunks/DjY7KvwG.js +0 -28
- package/chunks/GjKpN6U-.js +0 -135
- package/chunks/St35qgL0.d.ts +0 -103
- package/chunks/br7kModF.js +0 -110
- package/chunks/l2Rxo2H0.js +0 -106
- package/chunks/tfkJ5D3p.js +0 -115
package/locales/zh.js
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locales/zh.ts
|
|
2
|
+
const localeZh = {
|
|
3
|
+
name: "zh",
|
|
4
|
+
weekdays: [
|
|
5
|
+
"星期日",
|
|
6
|
+
"星期一",
|
|
7
|
+
"星期二",
|
|
8
|
+
"星期三",
|
|
9
|
+
"星期四",
|
|
10
|
+
"星期五",
|
|
11
|
+
"星期六"
|
|
12
|
+
],
|
|
13
|
+
weekdaysShort: [
|
|
14
|
+
"周日",
|
|
15
|
+
"周一",
|
|
16
|
+
"周二",
|
|
17
|
+
"周三",
|
|
18
|
+
"周四",
|
|
19
|
+
"周五",
|
|
20
|
+
"周六"
|
|
21
|
+
],
|
|
22
|
+
weekdaysMin: [
|
|
23
|
+
"日",
|
|
24
|
+
"一",
|
|
25
|
+
"二",
|
|
26
|
+
"三",
|
|
27
|
+
"四",
|
|
28
|
+
"五",
|
|
29
|
+
"六"
|
|
30
|
+
],
|
|
31
|
+
months: [
|
|
32
|
+
"一月",
|
|
33
|
+
"二月",
|
|
34
|
+
"三月",
|
|
35
|
+
"四月",
|
|
36
|
+
"五月",
|
|
37
|
+
"六月",
|
|
38
|
+
"七月",
|
|
39
|
+
"八月",
|
|
40
|
+
"九月",
|
|
41
|
+
"十月",
|
|
42
|
+
"十一月",
|
|
43
|
+
"十二月"
|
|
44
|
+
],
|
|
45
|
+
monthsShort: [
|
|
46
|
+
"1月",
|
|
47
|
+
"2月",
|
|
48
|
+
"3月",
|
|
49
|
+
"4月",
|
|
50
|
+
"5月",
|
|
51
|
+
"6月",
|
|
52
|
+
"7月",
|
|
53
|
+
"8月",
|
|
54
|
+
"9月",
|
|
55
|
+
"10月",
|
|
56
|
+
"11月",
|
|
57
|
+
"12月"
|
|
58
|
+
],
|
|
59
|
+
dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
|
|
60
|
+
ordinal: (number, period) => {
|
|
61
|
+
switch (period ?? "") {
|
|
62
|
+
case "d":
|
|
63
|
+
case "D":
|
|
64
|
+
case "DDD": return `${number}日`;
|
|
65
|
+
case "M": return `${number}月`;
|
|
66
|
+
case "w":
|
|
67
|
+
case "W": return `${number}周`;
|
|
68
|
+
default: return number.toString();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
weekStart: 1,
|
|
72
|
+
yearStart: 4,
|
|
73
|
+
formats: {
|
|
74
|
+
LT: "HH:mm",
|
|
75
|
+
LTS: "HH:mm:ss",
|
|
76
|
+
L: "YYYY/MM/DD",
|
|
77
|
+
LL: "YYYY年M月D日",
|
|
78
|
+
LLL: "YYYY年M月D日Ah点mm分",
|
|
79
|
+
LLLL: "YYYY年M月D日ddddAh点mm分",
|
|
80
|
+
l: "YYYY/M/D",
|
|
81
|
+
ll: "YYYY年M月D日",
|
|
82
|
+
lll: "YYYY年M月D日 HH:mm",
|
|
83
|
+
llll: "YYYY年M月D日dddd HH:mm"
|
|
84
|
+
},
|
|
85
|
+
calendar: {
|
|
86
|
+
sameDay: "[今天]LT",
|
|
87
|
+
nextDay: "[明天]LT",
|
|
88
|
+
nextWeek(refDate) {
|
|
89
|
+
if (refDate?.week?.() !== this.week?.()) return "[下]dddLT";
|
|
90
|
+
return "[本]dddLT";
|
|
91
|
+
},
|
|
92
|
+
lastDay: "[昨天]LT",
|
|
93
|
+
lastWeek(refDate) {
|
|
94
|
+
if (this.week?.() !== refDate?.week?.()) return "[上]dddLT";
|
|
95
|
+
return "[本]dddLT";
|
|
96
|
+
},
|
|
97
|
+
sameElse: "L"
|
|
98
|
+
},
|
|
99
|
+
relativeTime: {
|
|
100
|
+
future: "%s后",
|
|
101
|
+
past: "%s前",
|
|
102
|
+
s: "几秒",
|
|
103
|
+
ss: "%d 秒",
|
|
104
|
+
m: "1 分钟",
|
|
105
|
+
mm: "%d 分钟",
|
|
106
|
+
h: "1 小时",
|
|
107
|
+
hh: "%d 小时",
|
|
108
|
+
d: "1 天",
|
|
109
|
+
dd: "%d 天",
|
|
110
|
+
w: "1 周",
|
|
111
|
+
ww: "%d 周",
|
|
112
|
+
M: "1 个月",
|
|
113
|
+
MM: "%d 个月",
|
|
114
|
+
y: "1 年",
|
|
115
|
+
yy: "%d 年"
|
|
116
|
+
},
|
|
117
|
+
meridiem: (hour, minute) => {
|
|
118
|
+
const hm = hour * 100 + minute;
|
|
119
|
+
if (hm < 600) return "凌晨";
|
|
120
|
+
if (hm < 900) return "早上";
|
|
121
|
+
if (hm < 1100) return "上午";
|
|
122
|
+
if (hm < 1300) return "中午";
|
|
123
|
+
if (hm < 1800) return "下午";
|
|
124
|
+
return "晚上";
|
|
125
|
+
}
|
|
126
|
+
};
|
|
2
127
|
|
|
3
|
-
|
|
128
|
+
//#endregion
|
|
129
|
+
export { localeZh as default };
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esday",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"description": "A simple date library fully written in TypeScript",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/
|
|
7
|
+
"homepage": "https://github.com/BePo65/esday",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/BePo65/esday"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/BePo65/esday/issues"
|
|
14
14
|
},
|
|
15
|
+
"author": "BePo65 (https://github.com/BePo65)",
|
|
16
|
+
"contributors": [
|
|
17
|
+
"g-mero (https://github.com/g-mero)",
|
|
18
|
+
"Olexandr88 <radole1203@gmail.com> (https://github.com/Olexandr88)"
|
|
19
|
+
],
|
|
15
20
|
"keywords": [
|
|
16
21
|
"dayjs",
|
|
17
22
|
"date",
|
|
@@ -47,27 +52,28 @@
|
|
|
47
52
|
"*"
|
|
48
53
|
],
|
|
49
54
|
"devDependencies": {
|
|
50
|
-
"@biomejs/biome": "2.
|
|
51
|
-
"@commitlint/cli": "^
|
|
52
|
-
"@commitlint/config-conventional": "^
|
|
53
|
-
"@playwright/test": "~1.
|
|
54
|
-
"@types/node": "^
|
|
55
|
-
"@vitest/browser": "
|
|
56
|
-
"@vitest/coverage-v8": "
|
|
57
|
-
"@vitest/ui": "
|
|
58
|
-
"commit-and-tag-version": "^12.
|
|
59
|
-
"cpy-cli": "^
|
|
60
|
-
"dompurify": "^3.
|
|
55
|
+
"@biomejs/biome": "2.4.4",
|
|
56
|
+
"@commitlint/cli": "^20.4.2",
|
|
57
|
+
"@commitlint/config-conventional": "^20.4.2",
|
|
58
|
+
"@playwright/test": "~1.58.2",
|
|
59
|
+
"@types/node": "^25.3.0",
|
|
60
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
61
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
62
|
+
"@vitest/ui": "4.0.18",
|
|
63
|
+
"commit-and-tag-version": "^12.6.1",
|
|
64
|
+
"cpy-cli": "^7.0.0",
|
|
65
|
+
"dompurify": "^3.3.1",
|
|
61
66
|
"husky": "^9.1.7",
|
|
62
|
-
"jsdom": "^
|
|
63
|
-
"marked": "^
|
|
67
|
+
"jsdom": "^28.1.0",
|
|
68
|
+
"marked": "^17.0.3",
|
|
69
|
+
"moment-timezone": "^0.6.0",
|
|
64
70
|
"moment": "^2.30.1",
|
|
65
|
-
"playwright": "~1.
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"typescript": "^5.9.
|
|
68
|
-
"ultracite": "
|
|
69
|
-
"vite": "^7.
|
|
70
|
-
"vitest": "
|
|
71
|
+
"playwright": "~1.58.2",
|
|
72
|
+
"tsdown": "^0.20.3",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"ultracite": "7.2.3",
|
|
75
|
+
"vite": "^7.3.1",
|
|
76
|
+
"vitest": "4.0.18"
|
|
71
77
|
},
|
|
72
78
|
"commit-and-tag-version": {
|
|
73
79
|
"packageFiles": [
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { EsDayPlugin } from "../../chunks/
|
|
2
|
-
import "../../chunks/MtjcOKi-.js";
|
|
1
|
+
import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
|
|
3
2
|
|
|
4
3
|
//#region src/plugins/advancedFormat/index.d.ts
|
|
5
|
-
|
|
6
4
|
declare const advancedFormatPlugin: EsDayPlugin<{}>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { advancedFormatPlugin as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { padStart, padZoneStr } from "../../chunks/
|
|
1
|
+
import { n as padStart, r as padZoneStr } from "../../chunks/CdvTtmWL.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/advancedFormat/index.ts
|
|
4
4
|
const advancedFormatPlugin = (_, _dayClass, dayFactory) => {
|
|
5
|
-
|
|
5
|
+
dayFactory.addFormatTokenDefinitions({
|
|
6
6
|
d: (sourceDate) => sourceDate.day().toString(),
|
|
7
7
|
S: (sourceDate) => padStart(sourceDate.millisecond(), 3, "0").slice(0, 1),
|
|
8
8
|
SS: (sourceDate) => padStart(sourceDate.millisecond(), 3, "0").slice(0, 2),
|
|
@@ -11,10 +11,8 @@ const advancedFormatPlugin = (_, _dayClass, dayFactory) => {
|
|
|
11
11
|
x: (sourceDate) => sourceDate.valueOf().toString(),
|
|
12
12
|
k: (sourceDate) => (sourceDate.hour() !== 0 ? sourceDate.hour() : 24).toString(),
|
|
13
13
|
kk: (sourceDate) => padStart(sourceDate.hour() !== 0 ? sourceDate.hour() : 24, 2, "0")
|
|
14
|
-
};
|
|
15
|
-
dayFactory.addFormatTokenDefinitions(additionalTokens);
|
|
14
|
+
});
|
|
16
15
|
};
|
|
17
|
-
var advancedFormat_default = advancedFormatPlugin;
|
|
18
16
|
|
|
19
17
|
//#endregion
|
|
20
|
-
export {
|
|
18
|
+
export { advancedFormatPlugin as default };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { EsDayPlugin } from "../../chunks/
|
|
2
|
-
import "../../chunks/MtjcOKi-.js";
|
|
1
|
+
import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
|
|
3
2
|
|
|
4
3
|
//#region src/plugins/advancedParse/index.d.ts
|
|
5
|
-
|
|
6
4
|
declare const advancedParsePlugin: EsDayPlugin<{}>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { advancedParsePlugin as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { constants_default } from "../../chunks/
|
|
2
|
-
import {
|
|
1
|
+
import { p as constants_default } from "../../chunks/BkjWOpMU.js";
|
|
2
|
+
import { a as isUndefined, i as isString, o as isValidDate, t as isArray } from "../../chunks/v_QBn7Xm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/advancedParse/index.ts
|
|
5
5
|
/**
|
|
@@ -30,8 +30,7 @@ const parseTokensDefinitions = {};
|
|
|
30
30
|
* @returns converted 4-digit year
|
|
31
31
|
*/
|
|
32
32
|
function parseTwoDigitYear(input) {
|
|
33
|
-
const
|
|
34
|
-
const year = +inputLimited;
|
|
33
|
+
const year = +input.slice(0, 2);
|
|
35
34
|
return year + (year > 68 ? 1900 : 2e3);
|
|
36
35
|
}
|
|
37
36
|
function parseFourDigitYear(input) {
|
|
@@ -57,7 +56,7 @@ function offsetFromString(offset) {
|
|
|
57
56
|
*/
|
|
58
57
|
function addInput(property) {
|
|
59
58
|
return (parsedElements, input) => {
|
|
60
|
-
|
|
59
|
+
parsedElements[property] = +input;
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
@@ -129,7 +128,7 @@ function makeParser(format, isStrict) {
|
|
|
129
128
|
const postParseHandler = parseTo?.[3];
|
|
130
129
|
if (postParseHandler !== void 0 && !postParseHandlers.includes(postParseHandler)) postParseHandlers.push(postParseHandler);
|
|
131
130
|
}
|
|
132
|
-
const parser = (input, isStrict
|
|
131
|
+
const parser = (input, isStrict, parseOptions) => {
|
|
133
132
|
let unusedTokens = 0;
|
|
134
133
|
let separatorsMatch = true;
|
|
135
134
|
const parsedDateElements = {};
|
|
@@ -141,7 +140,7 @@ function makeParser(format, isStrict) {
|
|
|
141
140
|
const token = parsingDefinitions[i];
|
|
142
141
|
if (isString(token)) {
|
|
143
142
|
const separatorLength = token.length;
|
|
144
|
-
if (isStrict
|
|
143
|
+
if (isStrict && separatorsMatch) separatorsMatch && (separatorsMatch = input.substring(0, separatorLength) === token);
|
|
145
144
|
input = input.slice(separatorLength);
|
|
146
145
|
} else {
|
|
147
146
|
const { regex, updater } = token;
|
|
@@ -154,13 +153,12 @@ function makeParser(format, isStrict) {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
|
|
156
|
+
return {
|
|
158
157
|
dateElements: parsedDateElements,
|
|
159
158
|
charsLeftOver: input.length,
|
|
160
159
|
unusedTokens,
|
|
161
160
|
separatorsMatch
|
|
162
161
|
};
|
|
163
|
-
return result;
|
|
164
162
|
};
|
|
165
163
|
function postParser(parsedDate, parsedElements, parseOptions) {
|
|
166
164
|
let modifiedParsedDate = parsedDate;
|
|
@@ -230,7 +228,7 @@ const advancedParsePlugin = (_, dayClass, dayFactory) => {
|
|
|
230
228
|
* value to an object containing all the date&time elements (year,
|
|
231
229
|
* month, day, ...).
|
|
232
230
|
*/
|
|
233
|
-
const parseTokensDefinitions
|
|
231
|
+
const parseTokensDefinitions = {
|
|
234
232
|
Q: [
|
|
235
233
|
match1,
|
|
236
234
|
match1,
|
|
@@ -353,7 +351,7 @@ const advancedParsePlugin = (_, dayClass, dayFactory) => {
|
|
|
353
351
|
}
|
|
354
352
|
]
|
|
355
353
|
};
|
|
356
|
-
dayFactory.addParseTokenDefinitions(parseTokensDefinitions
|
|
354
|
+
dayFactory.addParseTokenDefinitions(parseTokensDefinitions);
|
|
357
355
|
const oldParse = proto["$parse"];
|
|
358
356
|
proto["$parse"] = function(d) {
|
|
359
357
|
var _this$$conf;
|
|
@@ -368,8 +366,8 @@ const advancedParsePlugin = (_, dayClass, dayFactory) => {
|
|
|
368
366
|
if (isString(d) && !isUndefined(format)) {
|
|
369
367
|
if (isString(format)) {
|
|
370
368
|
const parsingResult = parseFormattedInput.call(this, d, format, isStrict, parseOptions);
|
|
371
|
-
this
|
|
372
|
-
if (isStrict && (parsingResult.charsLeftOver > 0 || parsingResult.unusedTokens > 0 || !parsingResult.separatorsMatch)) this
|
|
369
|
+
this.$d = parsingResult.date;
|
|
370
|
+
if (isStrict && (parsingResult.charsLeftOver > 0 || parsingResult.unusedTokens > 0 || !parsingResult.separatorsMatch)) this.$d = invalidDate;
|
|
373
371
|
} else if (isArray(format)) {
|
|
374
372
|
let bestDate = invalidDate;
|
|
375
373
|
let scoreToBeat = 0;
|
|
@@ -384,23 +382,26 @@ const advancedParsePlugin = (_, dayClass, dayFactory) => {
|
|
|
384
382
|
currentScore += parsingResult.charsLeftOver;
|
|
385
383
|
currentScore += parsingResult.unusedTokens * 10;
|
|
386
384
|
if (bestFormatIsValid) {
|
|
387
|
-
if (validFormatFound &&
|
|
385
|
+
if (validFormatFound && currentScore < scoreToBeat) {
|
|
388
386
|
scoreToBeat = currentScore;
|
|
389
387
|
bestDate = parsingResult.date;
|
|
390
388
|
}
|
|
391
|
-
} else if (
|
|
389
|
+
} else if (validFormatFound) {
|
|
392
390
|
scoreToBeat = currentScore;
|
|
393
391
|
bestDate = parsingResult.date;
|
|
394
|
-
|
|
392
|
+
bestFormatIsValid = true;
|
|
395
393
|
}
|
|
396
394
|
}
|
|
397
|
-
this
|
|
395
|
+
this.$d = bestDate;
|
|
396
|
+
if (Object.keys(this["$conf"].parseOptions).length) delete this["$conf"].parseOptions;
|
|
398
397
|
}
|
|
399
|
-
} else
|
|
398
|
+
} else {
|
|
399
|
+
oldParse.call(this, d);
|
|
400
|
+
if (Object.keys(this["$conf"].parseOptions).length) delete this["$conf"].parseOptions;
|
|
401
|
+
}
|
|
400
402
|
};
|
|
401
403
|
dateFromDateComponents = proto["dateFromDateComponents"];
|
|
402
404
|
};
|
|
403
|
-
var advancedParse_default = advancedParsePlugin;
|
|
404
405
|
|
|
405
406
|
//#endregion
|
|
406
|
-
export {
|
|
407
|
+
export { advancedParsePlugin as default };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { EsDayPlugin } from "../../chunks/
|
|
2
|
-
import "
|
|
3
|
-
import { CalendarPartial } from "../../chunks/St35qgL0.js";
|
|
1
|
+
import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
|
|
2
|
+
import { CalendarPartial } from "../locale/index.js";
|
|
4
3
|
|
|
5
4
|
//#region src/plugins/calendar/index.d.ts
|
|
6
|
-
|
|
7
5
|
declare module 'esday' {
|
|
8
6
|
interface EsDay {
|
|
9
7
|
calendar(referenceDate?: EsDay | null, formats?: CalendarPartial): string;
|
|
@@ -6,7 +6,6 @@ const dayOfYearPlugin = (_, dayClass, dayFactory) => {
|
|
|
6
6
|
return input === void 0 ? dayOfYear : this.add(input - dayOfYear, "day");
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
var dayOfYear_default = dayOfYearPlugin;
|
|
10
9
|
|
|
11
10
|
//#endregion
|
|
12
|
-
export {
|
|
11
|
+
export { dayOfYearPlugin as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { E as UnitIsoWeeks, I as UnitTypePlurals, S as UnitDates, o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
|
|
2
|
+
import { Locale } from "../locale/index.js";
|
|
3
|
+
import { ThresholdRelativeTime } from "../relativeTime/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/plugins/duration/index.d.ts
|
|
6
|
+
declare module 'esday' {
|
|
7
|
+
interface EsDayFactory {
|
|
8
|
+
duration(): Duration;
|
|
9
|
+
duration(input: string): Duration;
|
|
10
|
+
duration(input: string, unit: UnitTypeDuration): Duration;
|
|
11
|
+
duration(input: number): Duration;
|
|
12
|
+
duration(input: number, unit: UnitTypeDuration): Duration;
|
|
13
|
+
duration(input: Duration): Duration;
|
|
14
|
+
duration(input: object): Duration;
|
|
15
|
+
duration(input: string | number | object | Duration | null, unit?: UnitTypeDuration): Duration;
|
|
16
|
+
isDuration(d?: any): d is Duration;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
type UnitTypeDuration = Exclude<UnitTypePlurals, UnitIsoWeeks | UnitDates>;
|
|
20
|
+
type UnitsObjectTypeDuration = {
|
|
21
|
+
years?: number | string;
|
|
22
|
+
quarters?: number | string;
|
|
23
|
+
months?: number | string;
|
|
24
|
+
weeks?: number | string;
|
|
25
|
+
days?: number | string;
|
|
26
|
+
hours?: number | string;
|
|
27
|
+
minutes?: number | string;
|
|
28
|
+
seconds?: number | string;
|
|
29
|
+
milliseconds?: number | string;
|
|
30
|
+
};
|
|
31
|
+
type DurationBase = {
|
|
32
|
+
milliseconds: number;
|
|
33
|
+
days: number;
|
|
34
|
+
months: number;
|
|
35
|
+
};
|
|
36
|
+
interface Duration {
|
|
37
|
+
clone(): Duration;
|
|
38
|
+
humanize(): string;
|
|
39
|
+
humanize(withSuffix: boolean): string;
|
|
40
|
+
humanize(thresholds: ThresholdRelativeTime): string;
|
|
41
|
+
humanize(withSuffix: boolean, thresholds: ThresholdRelativeTime): string;
|
|
42
|
+
as(unit: UnitTypeDuration): number;
|
|
43
|
+
get(unit: UnitTypeDuration): number;
|
|
44
|
+
milliseconds(): number;
|
|
45
|
+
asMilliseconds(): number;
|
|
46
|
+
seconds(): number;
|
|
47
|
+
asSeconds(): number;
|
|
48
|
+
minutes(): number;
|
|
49
|
+
asMinutes(): number;
|
|
50
|
+
hours(): number;
|
|
51
|
+
asHours(): number;
|
|
52
|
+
days(): number;
|
|
53
|
+
asDays(): number;
|
|
54
|
+
weeks(): number;
|
|
55
|
+
asWeeks(): number;
|
|
56
|
+
months(): number;
|
|
57
|
+
asMonths(): number;
|
|
58
|
+
quarters(): number;
|
|
59
|
+
asQuarters(): number;
|
|
60
|
+
years(): number;
|
|
61
|
+
asYears(): number;
|
|
62
|
+
add(input: number | UnitsObjectTypeDuration | Duration, unit?: UnitTypeDuration): Duration;
|
|
63
|
+
subtract(input: number | UnitsObjectTypeDuration | Duration, unit?: UnitTypeDuration): Duration;
|
|
64
|
+
locale(): string;
|
|
65
|
+
locale(locale: string): Duration;
|
|
66
|
+
localeObject(): Locale;
|
|
67
|
+
valueOf(): number;
|
|
68
|
+
durationBase(): DurationBase;
|
|
69
|
+
format(formatStr?: string): string;
|
|
70
|
+
toString(): string;
|
|
71
|
+
toISOString(): string;
|
|
72
|
+
toJSON(): string;
|
|
73
|
+
asStringifiedJSON(): string;
|
|
74
|
+
isValid(): boolean;
|
|
75
|
+
}
|
|
76
|
+
declare const durationPlugin: EsDayPlugin<{}>;
|
|
77
|
+
//#endregion
|
|
78
|
+
export { Duration, DurationBase, UnitTypeDuration, UnitsObjectTypeDuration, durationPlugin as default };
|