esday 0.4.1 → 0.6.2
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 +43 -0
- package/LICENSE +21 -0
- package/README.md +63 -33
- package/chunks/AyQQ6US-.js +84 -0
- package/chunks/BkjWOpMU.js +68 -0
- package/chunks/C5qDMHT5.d.ts +6 -0
- package/chunks/CODi8AFH.d.ts +231 -0
- package/chunks/CXWzCl3n.js +481 -0
- package/chunks/CdvTtmWL.js +56 -0
- package/chunks/Shk32pTP.js +9 -0
- package/chunks/v_QBn7Xm.js +25 -0
- package/chunks/xt8C2lbv.js +38 -0
- package/index.d.mts +3 -0
- package/index.mjs +3 -0
- package/locales/af.d.mts +6 -0
- package/locales/af.mjs +108 -0
- package/locales/am.d.mts +6 -0
- package/locales/am.mjs +108 -0
- package/locales/ar-dz.d.mts +9 -0
- package/locales/ar-dz.mjs +30 -0
- package/locales/ar-iq.d.mts +9 -0
- package/locales/ar-iq.mjs +12 -0
- package/locales/ar-kw.d.mts +9 -0
- package/locales/ar-kw.mjs +26 -0
- package/locales/ar-ly.d.mts +9 -0
- package/locales/ar-ly.mjs +12 -0
- package/locales/ar-ma.d.mts +9 -0
- package/locales/ar-ma.mjs +27 -0
- package/locales/ar-sa.d.mts +9 -0
- package/locales/ar-sa.mjs +27 -0
- package/locales/ar-tn.d.mts +9 -0
- package/locales/ar-tn.mjs +27 -0
- package/locales/ar.d.mts +6 -0
- package/locales/ar.mjs +198 -0
- package/locales/az.d.mts +6 -0
- package/locales/az.mjs +108 -0
- package/locales/be.d.mts +6 -0
- package/locales/be.mjs +136 -0
- package/locales/bg.d.mts +6 -0
- package/locales/bg.mjs +127 -0
- package/locales/bi.d.mts +6 -0
- package/locales/bi.mjs +108 -0
- package/locales/bm.d.mts +6 -0
- package/locales/bm.mjs +108 -0
- package/locales/bn-bd.d.mts +9 -0
- package/locales/bn-bd.mjs +22 -0
- package/locales/bn.d.mts +6 -0
- package/locales/bn.mjs +137 -0
- package/locales/bo.d.mts +6 -0
- package/locales/bo.mjs +108 -0
- package/locales/br.d.mts +6 -0
- package/locales/br.mjs +180 -0
- package/locales/bs.d.mts +6 -0
- package/locales/bs.mjs +130 -0
- package/locales/ca.d.mts +6 -0
- package/locales/ca.mjs +142 -0
- package/locales/cs.d.mts +6 -0
- package/locales/cs.mjs +186 -0
- package/locales/cv.d.mts +6 -0
- package/locales/cv.mjs +108 -0
- package/locales/cy.d.mts +6 -0
- package/locales/cy.mjs +108 -0
- package/locales/da.d.mts +6 -0
- package/locales/da.mjs +108 -0
- package/locales/de-at.d.mts +9 -0
- package/locales/de-at.mjs +42 -0
- package/locales/de-ch.d.mts +9 -0
- package/locales/de-ch.mjs +12 -0
- package/locales/de.d.mts +6 -0
- package/locales/de.mjs +131 -0
- package/locales/dv.d.mts +6 -0
- package/locales/dv.mjs +108 -0
- package/locales/el.d.mts +6 -0
- package/locales/el.mjs +117 -0
- package/locales/en-au.d.mts +9 -0
- package/locales/en-au.mjs +26 -0
- package/locales/en-ca.d.mts +9 -0
- package/locales/en-ca.mjs +26 -0
- package/locales/en-gb.d.mts +11 -0
- package/locales/en-gb.mjs +29 -0
- package/locales/en-ie.d.mts +9 -0
- package/locales/en-ie.mjs +25 -0
- package/locales/en-il.d.mts +9 -0
- package/locales/en-il.mjs +27 -0
- package/locales/en-in.d.mts +9 -0
- package/locales/en-in.mjs +25 -0
- package/locales/en-nz.d.mts +9 -0
- package/locales/en-nz.mjs +27 -0
- package/locales/en-sg.d.mts +9 -0
- package/locales/en-sg.mjs +27 -0
- package/locales/en-tt.d.mts +9 -0
- package/locales/en-tt.mjs +27 -0
- package/locales/en-us.d.mts +9 -0
- package/locales/en-us.mjs +12 -0
- package/locales/en.d.mts +6 -0
- package/locales/en.mjs +117 -0
- package/locales/eo.d.mts +6 -0
- package/locales/eo.mjs +108 -0
- package/locales/es-do.d.mts +9 -0
- package/locales/es-do.mjs +25 -0
- package/locales/es-mx.d.mts +9 -0
- package/locales/es-mx.mjs +13 -0
- package/locales/es-pr.d.mts +9 -0
- package/locales/es-pr.mjs +16 -0
- package/locales/es-us.d.mts +9 -0
- package/locales/es-us.mjs +12 -0
- package/locales/es.d.mts +6 -0
- package/locales/es.mjs +118 -0
- package/locales/et.d.mts +6 -0
- package/locales/et.mjs +146 -0
- package/locales/eu.d.mts +6 -0
- package/locales/eu.mjs +108 -0
- package/locales/fa.d.mts +6 -0
- package/locales/fa.mjs +108 -0
- package/locales/fi.d.mts +6 -0
- package/locales/fi.mjs +171 -0
- package/locales/fil.d.mts +6 -0
- package/locales/fil.mjs +108 -0
- package/locales/fo.d.mts +6 -0
- package/locales/fo.mjs +108 -0
- package/locales/fr-ca.d.mts +9 -0
- package/locales/fr-ca.mjs +16 -0
- package/locales/fr-ch.d.mts +9 -0
- package/locales/fr-ch.mjs +16 -0
- package/locales/fr.d.mts +6 -0
- package/locales/fr.mjs +110 -0
- package/locales/fy.d.mts +6 -0
- package/locales/fy.mjs +108 -0
- package/locales/ga.d.mts +6 -0
- package/locales/ga.mjs +108 -0
- package/locales/gd.d.mts +6 -0
- package/locales/gd.mjs +108 -0
- package/locales/gl.d.mts +6 -0
- package/locales/gl.mjs +118 -0
- package/locales/gom-deva.d.mts +6 -0
- package/locales/gom-deva.mjs +148 -0
- package/locales/gom-latn.d.mts +6 -0
- package/locales/gom-latn.mjs +148 -0
- package/locales/gu.d.mts +6 -0
- package/locales/gu.mjs +108 -0
- package/locales/he.d.mts +6 -0
- package/locales/he.mjs +132 -0
- package/locales/hi.d.mts +6 -0
- package/locales/hi.mjs +124 -0
- package/locales/hr.d.mts +6 -0
- package/locales/hr.mjs +195 -0
- package/locales/ht.d.mts +6 -0
- package/locales/ht.mjs +108 -0
- package/locales/hu.d.mts +6 -0
- package/locales/hu.mjs +144 -0
- package/locales/hy-am.d.mts +6 -0
- package/locales/hy-am.mjs +126 -0
- package/locales/id.d.mts +6 -0
- package/locales/id.mjs +108 -0
- package/locales/is.d.mts +6 -0
- package/locales/is.mjs +167 -0
- package/locales/it-ch.d.mts +9 -0
- package/locales/it-ch.mjs +27 -0
- package/locales/it.d.mts +6 -0
- package/locales/it.mjs +121 -0
- package/locales/ja.d.mts +12 -0
- package/locales/ja.mjs +111 -0
- package/locales/jv.d.mts +6 -0
- package/locales/jv.mjs +108 -0
- package/locales/ka.d.mts +6 -0
- package/locales/ka.mjs +125 -0
- package/locales/kk.d.mts +6 -0
- package/locales/kk.mjs +108 -0
- package/locales/km.d.mts +6 -0
- package/locales/km.mjs +108 -0
- package/locales/kn.d.mts +6 -0
- package/locales/kn.mjs +108 -0
- package/locales/ko.d.mts +6 -0
- package/locales/ko.mjs +107 -0
- package/locales/ku.d.mts +6 -0
- package/locales/ku.mjs +121 -0
- package/locales/ky.d.mts +6 -0
- package/locales/ky.mjs +108 -0
- package/locales/lb.d.mts +6 -0
- package/locales/lb.mjs +169 -0
- package/locales/lo.d.mts +6 -0
- package/locales/lo.mjs +107 -0
- package/locales/lt.d.mts +6 -0
- package/locales/lt.mjs +108 -0
- package/locales/lv.d.mts +6 -0
- package/locales/lv.mjs +108 -0
- package/locales/me.d.mts +6 -0
- package/locales/me.mjs +129 -0
- package/locales/mi.d.mts +6 -0
- package/locales/mi.mjs +108 -0
- package/locales/mk.d.mts +6 -0
- package/locales/mk.mjs +119 -0
- package/locales/ml.d.mts +6 -0
- package/locales/ml.mjs +111 -0
- package/locales/mn.d.mts +6 -0
- package/locales/mn.mjs +127 -0
- package/locales/mr.d.mts +6 -0
- package/locales/mr.mjs +229 -0
- package/locales/ms-my.d.mts +9 -0
- package/locales/ms-my.mjs +12 -0
- package/locales/ms.d.mts +6 -0
- package/locales/ms.mjs +108 -0
- package/locales/mt.d.mts +6 -0
- package/locales/mt.mjs +108 -0
- package/locales/my.d.mts +6 -0
- package/locales/my.mjs +134 -0
- package/locales/nb.d.mts +6 -0
- package/locales/nb.mjs +108 -0
- package/locales/ne.d.mts +6 -0
- package/locales/ne.mjs +108 -0
- package/locales/nl-be.d.mts +9 -0
- package/locales/nl-be.mjs +16 -0
- package/locales/nl.d.mts +6 -0
- package/locales/nl.mjs +108 -0
- package/locales/nn.d.mts +6 -0
- package/locales/nn.mjs +108 -0
- package/locales/oc-lnc.d.mts +6 -0
- package/locales/oc-lnc.mjs +125 -0
- package/locales/pa-in.d.mts +6 -0
- package/locales/pa-in.mjs +125 -0
- package/locales/pl.d.mts +6 -0
- package/locales/pl.mjs +162 -0
- package/locales/pt-br.d.mts +9 -0
- package/locales/pt-br.mjs +51 -0
- package/locales/pt.d.mts +6 -0
- package/locales/pt.mjs +110 -0
- package/locales/rn.d.mts +6 -0
- package/locales/rn.mjs +108 -0
- package/locales/ro.d.mts +6 -0
- package/locales/ro.mjs +108 -0
- package/locales/ru.d.mts +12 -0
- package/locales/ru.mjs +237 -0
- package/locales/rw.d.mts +6 -0
- package/locales/rw.mjs +108 -0
- package/locales/sd.d.mts +6 -0
- package/locales/sd.mjs +108 -0
- package/locales/se.d.mts +6 -0
- package/locales/se.mjs +108 -0
- package/locales/si.d.mts +6 -0
- package/locales/si.mjs +108 -0
- package/locales/sk.d.mts +6 -0
- package/locales/sk.mjs +168 -0
- package/locales/sl.d.mts +6 -0
- package/locales/sl.mjs +177 -0
- package/locales/sq.d.mts +6 -0
- package/locales/sq.mjs +108 -0
- package/locales/sr-cyrl.d.mts +9 -0
- package/locales/sr-cyrl.mjs +174 -0
- package/locales/sr.d.mts +6 -0
- package/locales/sr.mjs +186 -0
- package/locales/ss.d.mts +6 -0
- package/locales/ss.mjs +110 -0
- package/locales/sv-fi.d.mts +9 -0
- package/locales/sv-fi.mjs +25 -0
- package/locales/sv.d.mts +6 -0
- package/locales/sv.mjs +111 -0
- package/locales/sw.d.mts +6 -0
- package/locales/sw.mjs +108 -0
- package/locales/ta.d.mts +6 -0
- package/locales/ta.mjs +139 -0
- package/locales/te.d.mts +6 -0
- package/locales/te.mjs +111 -0
- package/locales/tet.d.mts +6 -0
- package/locales/tet.mjs +111 -0
- package/locales/tg.d.mts +6 -0
- package/locales/tg.mjs +127 -0
- package/locales/th.d.mts +6 -0
- package/locales/th.mjs +108 -0
- package/locales/tk.d.mts +6 -0
- package/locales/tk.mjs +135 -0
- package/locales/tl-ph.d.mts +6 -0
- package/locales/tl-ph.mjs +108 -0
- package/locales/tlh.d.mts +6 -0
- package/locales/tlh.mjs +155 -0
- package/locales/tr.d.mts +6 -0
- package/locales/tr.mjs +135 -0
- package/locales/tzl.d.mts +6 -0
- package/locales/tzl.mjs +125 -0
- package/locales/tzm-latn.d.mts +9 -0
- package/locales/tzm-latn.mjs +68 -0
- package/locales/tzm.d.mts +6 -0
- package/locales/tzm.mjs +108 -0
- package/locales/ug-cn.d.mts +6 -0
- package/locales/ug-cn.mjs +113 -0
- package/locales/uk.d.mts +6 -0
- package/locales/uk.mjs +199 -0
- package/locales/ur.d.mts +6 -0
- package/locales/ur.mjs +110 -0
- package/locales/uz-latn.d.mts +9 -0
- package/locales/uz-latn.mjs +68 -0
- package/locales/uz.d.mts +6 -0
- package/locales/uz.mjs +108 -0
- package/locales/vi.d.mts +6 -0
- package/locales/vi.mjs +108 -0
- package/locales/x-pseudo.d.mts +6 -0
- package/locales/x-pseudo.mjs +111 -0
- package/locales/yo.d.mts +6 -0
- package/locales/yo.mjs +108 -0
- package/locales/zh-cn.d.mts +9 -0
- package/locales/zh-cn.mjs +12 -0
- package/locales/zh-hk.d.mts +9 -0
- package/locales/zh-hk.mjs +21 -0
- package/locales/zh-mo.d.mts +9 -0
- package/locales/zh-mo.mjs +21 -0
- package/locales/zh-tw.d.mts +9 -0
- package/locales/zh-tw.mjs +21 -0
- package/locales/zh.d.mts +12 -0
- package/locales/zh.mjs +129 -0
- package/package.json +61 -29
- package/plugins/advancedFormat/index.d.mts +6 -0
- package/plugins/advancedFormat/index.mjs +18 -0
- package/plugins/advancedParse/index.d.mts +6 -0
- package/plugins/advancedParse/index.mjs +407 -0
- package/plugins/calendar/index.d.mts +12 -0
- package/plugins/calendar/index.mjs +32 -0
- package/plugins/dayOfYear/index.d.mts +12 -0
- package/plugins/dayOfYear/index.mjs +11 -0
- package/plugins/duration/index.d.mts +78 -0
- package/plugins/duration/index.mjs +477 -0
- package/plugins/isBetween/index.d.mts +22 -0
- package/plugins/isBetween/index.mjs +15 -0
- package/plugins/isLeapYear/index.d.mts +11 -0
- package/plugins/isLeapYear/index.mjs +10 -0
- package/plugins/isSameOrAfter/index.d.mts +11 -0
- package/plugins/isSameOrAfter/index.mjs +9 -0
- package/plugins/isSameOrBefore/index.d.mts +11 -0
- package/plugins/isSameOrBefore/index.mjs +9 -0
- package/plugins/isToday/index.d.mts +11 -0
- package/plugins/isToday/index.mjs +11 -0
- package/plugins/isTomorrow/index.d.mts +11 -0
- package/plugins/isTomorrow/index.mjs +13 -0
- package/plugins/isYesterday/index.d.mts +11 -0
- package/plugins/isYesterday/index.mjs +13 -0
- package/plugins/isoWeek/index.d.mts +19 -0
- package/plugins/isoWeek/index.mjs +228 -0
- package/plugins/locale/index.d.mts +104 -0
- package/plugins/locale/index.mjs +141 -0
- package/plugins/localeData/index.d.mts +6 -0
- package/plugins/localeData/index.mjs +155 -0
- package/plugins/localizedFormat/index.d.mts +6 -0
- package/plugins/localizedFormat/index.mjs +83 -0
- package/plugins/localizedParse/index.d.mts +6 -0
- package/plugins/localizedParse/index.mjs +217 -0
- package/plugins/minMax/index.d.mts +12 -0
- package/plugins/minMax/index.mjs +21 -0
- package/plugins/objectSupport/index.d.mts +6 -0
- package/plugins/objectSupport/index.mjs +99 -0
- package/plugins/pluralGetSet/index.d.mts +18 -0
- package/plugins/pluralGetSet/index.mjs +15 -0
- package/plugins/quarterOfYear/index.d.mts +14 -0
- package/plugins/quarterOfYear/index.mjs +51 -0
- package/plugins/relativeTime/index.d.mts +47 -0
- package/plugins/relativeTime/index.mjs +187 -0
- package/plugins/timezone/index.d.mts +6 -0
- package/plugins/timezone/index.mjs +456 -0
- package/plugins/toArray/index.d.mts +11 -0
- package/plugins/toArray/index.mjs +17 -0
- package/plugins/toObject/index.d.mts +19 -0
- package/plugins/toObject/index.mjs +17 -0
- package/plugins/utc/index.d.mts +18 -0
- package/plugins/utc/index.mjs +192 -0
- package/plugins/week/index.d.mts +19 -0
- package/plugins/week/index.mjs +350 -0
- package/EsDay-KXQgnL1r.d.ts +0 -89
- package/chunk-MLKGABMK.js +0 -7
- package/chunk-NUV73YDM.js +0 -60
- package/chunk-SQBPUYUY.js +0 -140
- package/index.d.ts +0 -6
- package/index.js +0 -310
- package/locales/en.d.ts +0 -6
- package/locales/en.js +0 -1
- package/locales/zh.d.ts +0 -6
- package/locales/zh.js +0 -64
- package/plugins/customParseFormat/index.d.ts +0 -5
- package/plugins/customParseFormat/index.js +0 -159
- package/plugins/isToday/index.d.ts +0 -10
- package/plugins/isToday/index.js +0 -8
- package/plugins/locale/index.d.ts +0 -75
- package/plugins/locale/index.js +0 -70
- package/plugins/utc/index.d.ts +0 -22
- package/plugins/utc/index.js +0 -40
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { isString } from '../../chunk-SQBPUYUY.js';
|
|
2
|
-
|
|
3
|
-
// src/plugins/customParseFormat/index.ts
|
|
4
|
-
var formattingTokens = /(\[[^[]*\])|([-_:/.,()\s]+)|([AaQz]|YYYY|YY?|ww?|MM?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|ZZ?)/g;
|
|
5
|
-
var match1 = /\d/;
|
|
6
|
-
var match2 = /\d{2}/;
|
|
7
|
-
var match3 = /\d{3}/;
|
|
8
|
-
var match4 = /\d{4}/;
|
|
9
|
-
var match1to2 = /\d\d?/;
|
|
10
|
-
var matchSigned = /[+-]?\d+/;
|
|
11
|
-
var matchOffset = /[+-]\d\d:?(\d\d)?|Z/;
|
|
12
|
-
function parseTwoDigitYear(input) {
|
|
13
|
-
const year = +input;
|
|
14
|
-
return year + (year > 68 ? 1900 : 2e3);
|
|
15
|
-
}
|
|
16
|
-
function offsetFromString(offset) {
|
|
17
|
-
if (!offset)
|
|
18
|
-
return 0;
|
|
19
|
-
if (offset === "Z")
|
|
20
|
-
return 0;
|
|
21
|
-
const parts = offset.match(/([+-]|\d\d)/g);
|
|
22
|
-
if (!parts)
|
|
23
|
-
return 0;
|
|
24
|
-
const minutes = +parts[1] * 60 + (+parts[2] || 0);
|
|
25
|
-
return parts[0] === "+" ? -minutes : minutes;
|
|
26
|
-
}
|
|
27
|
-
function addInput(property) {
|
|
28
|
-
return function(input) {
|
|
29
|
-
this[property] = +input;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
var expressions = {
|
|
33
|
-
A: [match1, function() {
|
|
34
|
-
this.afternoon = true;
|
|
35
|
-
}],
|
|
36
|
-
a: [match1, function() {
|
|
37
|
-
this.afternoon = true;
|
|
38
|
-
}],
|
|
39
|
-
Q: [match1, function(input) {
|
|
40
|
-
this.month = (Number.parseInt(input, 10) - 1) * 3 + 1;
|
|
41
|
-
}],
|
|
42
|
-
S: [match1, function(input) {
|
|
43
|
-
this.milliseconds = +input * 100;
|
|
44
|
-
}],
|
|
45
|
-
SS: [match2, function(input) {
|
|
46
|
-
this.milliseconds = +input * 10;
|
|
47
|
-
}],
|
|
48
|
-
SSS: [match3, function(input) {
|
|
49
|
-
this.milliseconds = +input;
|
|
50
|
-
}],
|
|
51
|
-
s: [match1to2, addInput("seconds")],
|
|
52
|
-
ss: [match1to2, addInput("seconds")],
|
|
53
|
-
m: [match1to2, addInput("minutes")],
|
|
54
|
-
mm: [match1to2, addInput("minutes")],
|
|
55
|
-
H: [match1to2, addInput("hours")],
|
|
56
|
-
h: [match1to2, addInput("hours")],
|
|
57
|
-
HH: [match1to2, addInput("hours")],
|
|
58
|
-
hh: [match1to2, addInput("hours")],
|
|
59
|
-
D: [match1to2, addInput("day")],
|
|
60
|
-
DD: [match2, addInput("day")],
|
|
61
|
-
Do: [match1to2, function(input) {
|
|
62
|
-
this.day = Number.parseInt(input.match(/\d+/)?.[0] || "0", 10);
|
|
63
|
-
}],
|
|
64
|
-
w: [match1to2, addInput("week")],
|
|
65
|
-
ww: [match2, addInput("week")],
|
|
66
|
-
M: [match1to2, addInput("month")],
|
|
67
|
-
MM: [match2, addInput("month")],
|
|
68
|
-
Y: [matchSigned, addInput("year")],
|
|
69
|
-
YY: [match2, function(input) {
|
|
70
|
-
this.year = parseTwoDigitYear(input);
|
|
71
|
-
}],
|
|
72
|
-
YYYY: [match4, addInput("year")],
|
|
73
|
-
Z: [matchOffset, function(input) {
|
|
74
|
-
this.zone = { offset: offsetFromString(input) };
|
|
75
|
-
}],
|
|
76
|
-
ZZ: [matchOffset, function(input) {
|
|
77
|
-
this.zone = { offset: offsetFromString(input) };
|
|
78
|
-
}]
|
|
79
|
-
};
|
|
80
|
-
function correctHours(time) {
|
|
81
|
-
if (time.afternoon !== void 0) {
|
|
82
|
-
if (time.hours !== void 0) {
|
|
83
|
-
if (time.afternoon) {
|
|
84
|
-
if (time.hours < 12)
|
|
85
|
-
time.hours += 12;
|
|
86
|
-
} else if (time.hours === 12) {
|
|
87
|
-
time.hours = 0;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
delete time.afternoon;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function makeParser(format) {
|
|
94
|
-
const array = format.match(formattingTokens) || [];
|
|
95
|
-
const { length } = array;
|
|
96
|
-
for (let i = 0; i < length; i += 1) {
|
|
97
|
-
const token = array[i];
|
|
98
|
-
const parseTo = expressions[token];
|
|
99
|
-
const regex = parseTo && parseTo[0];
|
|
100
|
-
const parser = parseTo && parseTo[1];
|
|
101
|
-
if (parser) {
|
|
102
|
-
array[i] = { regex, parser };
|
|
103
|
-
} else {
|
|
104
|
-
array[i] = token.replace(/^\[|\]$/g, "");
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return function(input) {
|
|
108
|
-
const time = {};
|
|
109
|
-
for (let i = 0, start = 0; i < length; i += 1) {
|
|
110
|
-
const token = array[i];
|
|
111
|
-
if (typeof token === "string") {
|
|
112
|
-
start += token.length;
|
|
113
|
-
} else {
|
|
114
|
-
const { regex, parser } = token;
|
|
115
|
-
const part = input.slice(start);
|
|
116
|
-
const match = regex.exec(part);
|
|
117
|
-
const value = match[0];
|
|
118
|
-
parser.call(time, value);
|
|
119
|
-
input = input.replace(value, "");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
correctHours(time);
|
|
123
|
-
return time;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function parseFormattedInput(input, format, utc) {
|
|
127
|
-
try {
|
|
128
|
-
const parser = makeParser(format);
|
|
129
|
-
const { year, month, day, hours, minutes, seconds, milliseconds, zone } = parser(input);
|
|
130
|
-
if (utc) {
|
|
131
|
-
return new Date(Date.UTC(year || 0, (month || 1) - 1, day || 1, hours || 0, minutes || 0, seconds || 0, milliseconds || 0));
|
|
132
|
-
}
|
|
133
|
-
if (zone) {
|
|
134
|
-
const offsetMs = (zone.offset || 0) * 6e4;
|
|
135
|
-
return new Date(Date.UTC(year || 0, (month || 1) - 1, day || 1, hours || 0, minutes || 0, seconds || 0, milliseconds || 0) - offsetMs);
|
|
136
|
-
}
|
|
137
|
-
return new Date(year || 0, (month || 1) - 1, day || 1, hours || 0, minutes || 0, seconds || 0, milliseconds || 0);
|
|
138
|
-
} catch {
|
|
139
|
-
return new Date(Number.NaN);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
var customParseFormatPlugin = (_, dayTsClass) => {
|
|
143
|
-
const oldParse = dayTsClass.prototype["parse"];
|
|
144
|
-
dayTsClass.prototype["parse"] = function(d) {
|
|
145
|
-
const format = this["$conf"].args_1;
|
|
146
|
-
if (isString(d) && isString(format)) {
|
|
147
|
-
const date = parseFormattedInput(d, format, !!this["$conf"].utc);
|
|
148
|
-
if (Number.isNaN(date.getTime())) {
|
|
149
|
-
this["$d"] = /* @__PURE__ */ new Date("");
|
|
150
|
-
} else {
|
|
151
|
-
this["$d"] = date;
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
oldParse.call(this, d);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export { customParseFormatPlugin };
|
package/plugins/isToday/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { d as EsDayPlugin } from '../../EsDay-KXQgnL1r.js';
|
|
2
|
-
|
|
3
|
-
type ReadonlyTuple<T, N extends number, R extends readonly T[] = []> = R['length'] extends N ? R : ReadonlyTuple<T, N, readonly [T, ...R]>;
|
|
4
|
-
declare module 'esday' {
|
|
5
|
-
interface EsDay {
|
|
6
|
-
locale: (localeName: string) => EsDay;
|
|
7
|
-
}
|
|
8
|
-
interface EsDayFactory {
|
|
9
|
-
/**
|
|
10
|
-
* use locale as global
|
|
11
|
-
*/
|
|
12
|
-
locale: (localeName: string) => EsDayFactory;
|
|
13
|
-
/**
|
|
14
|
-
* register locale
|
|
15
|
-
*/
|
|
16
|
-
registerLocale: (locale: Locale, newName?: string) => EsDayFactory;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
type DayNames<T = string> = ReadonlyTuple<T, 7>;
|
|
20
|
-
type MonthNames<T = string> = ReadonlyTuple<T, 12>;
|
|
21
|
-
interface MonthNamesFunction<T = MonthNames<string>> {
|
|
22
|
-
(format: string): string;
|
|
23
|
-
standalone: T;
|
|
24
|
-
format: T;
|
|
25
|
-
}
|
|
26
|
-
type RelativeTimeElementFunction = (timeValue: string | number, withoutSuffix: boolean, range: string) => string;
|
|
27
|
-
type Format = 'LT' | 'LTS' | 'L' | 'LL' | 'LLL' | 'LLLL' | 'l' | 'll' | 'lll' | 'llll';
|
|
28
|
-
type Relative = 'future' | 'past' | 's' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'M' | 'MM' | 'y' | 'yy';
|
|
29
|
-
interface Locale {
|
|
30
|
-
/**
|
|
31
|
-
* Name of the locale
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* Array of full day names
|
|
36
|
-
* @example ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
37
|
-
*/
|
|
38
|
-
weekdays: DayNames;
|
|
39
|
-
/**
|
|
40
|
-
* Array of short versions of day names
|
|
41
|
-
* @example ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|
42
|
-
*/
|
|
43
|
-
weekdaysShort?: DayNames;
|
|
44
|
-
weekdaysMin?: DayNames;
|
|
45
|
-
months: MonthNames | MonthNamesFunction;
|
|
46
|
-
monthsShort?: MonthNames | MonthNamesFunction;
|
|
47
|
-
ordinal?: (number: number, period?: 'W') => string;
|
|
48
|
-
weekStart?: number;
|
|
49
|
-
yearStart?: number;
|
|
50
|
-
formats?: Partial<Record<Format, string>>;
|
|
51
|
-
relativeTime?: Record<Relative, string | RelativeTimeElementFunction>;
|
|
52
|
-
meridiem?: (hour: number, minute: number, isLowercase: boolean) => string;
|
|
53
|
-
invalidDate?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
declare function getLocale(name: string): Locale;
|
|
57
|
-
declare function registerLocale(locale: Locale, rename?: string): void;
|
|
58
|
-
declare module 'esday' {
|
|
59
|
-
interface EsDay {
|
|
60
|
-
locale: (localeName: string) => EsDay;
|
|
61
|
-
}
|
|
62
|
-
interface EsDayFactory {
|
|
63
|
-
/**
|
|
64
|
-
* use locale as global
|
|
65
|
-
*/
|
|
66
|
-
locale: (localeName: string) => EsDayFactory;
|
|
67
|
-
/**
|
|
68
|
-
* register locale
|
|
69
|
-
*/
|
|
70
|
-
registerLocale: (locale: Locale, newName?: string) => EsDayFactory;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
declare const localePlugin: EsDayPlugin<{}>;
|
|
74
|
-
|
|
75
|
-
export { type DayNames, type Locale, type MonthNames, type MonthNamesFunction, type RelativeTimeElementFunction, getLocale, localePlugin, registerLocale };
|
package/plugins/locale/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { en_default } from '../../chunk-NUV73YDM.js';
|
|
2
|
-
import { prettyUnit, constant_exports, undefinedOr } from '../../chunk-SQBPUYUY.js';
|
|
3
|
-
|
|
4
|
-
// src/plugins/locale/index.ts
|
|
5
|
-
var LocaleStore = /* @__PURE__ */ new Map();
|
|
6
|
-
var $localeGlobal = "en";
|
|
7
|
-
function getLocale(name) {
|
|
8
|
-
return LocaleStore.get(name) || en_default;
|
|
9
|
-
}
|
|
10
|
-
function registerLocale(locale, rename) {
|
|
11
|
-
LocaleStore.set(rename || locale.name, locale);
|
|
12
|
-
}
|
|
13
|
-
function getSetPrivateLocaleName(inst, newLocaleName) {
|
|
14
|
-
if (newLocaleName) {
|
|
15
|
-
inst["$locale_name"] = newLocaleName;
|
|
16
|
-
}
|
|
17
|
-
return inst["$locale_name"] || $localeGlobal;
|
|
18
|
-
}
|
|
19
|
-
var localePlugin = (_, dayClass, dayFactory) => {
|
|
20
|
-
dayClass.prototype.$locale = function() {
|
|
21
|
-
return getLocale(getSetPrivateLocaleName(this));
|
|
22
|
-
};
|
|
23
|
-
dayClass.prototype.locale = function(localeName) {
|
|
24
|
-
const inst = this.clone();
|
|
25
|
-
getSetPrivateLocaleName(inst, localeName);
|
|
26
|
-
return inst;
|
|
27
|
-
};
|
|
28
|
-
const oldClone = dayClass.prototype["clone"];
|
|
29
|
-
dayClass.prototype["clone"] = function() {
|
|
30
|
-
const inst = oldClone.call(this);
|
|
31
|
-
getSetPrivateLocaleName(inst, getSetPrivateLocaleName(this));
|
|
32
|
-
return inst;
|
|
33
|
-
};
|
|
34
|
-
const oldParse = dayClass.prototype["parse"];
|
|
35
|
-
dayClass.prototype["parse"] = function(d) {
|
|
36
|
-
oldParse.call(this, d);
|
|
37
|
-
getSetPrivateLocaleName(this, $localeGlobal);
|
|
38
|
-
};
|
|
39
|
-
const oldStartOf = dayClass.prototype["startOf"];
|
|
40
|
-
const oldEndOf = dayClass.prototype["endOf"];
|
|
41
|
-
const fixDiff = (inst, unit) => {
|
|
42
|
-
if (prettyUnit(unit) === constant_exports.WEEK) {
|
|
43
|
-
const defaultStartOfWeek = constant_exports.INDEX_MONDAY;
|
|
44
|
-
const weekStart = undefinedOr(inst.$locale().weekStart, defaultStartOfWeek);
|
|
45
|
-
const diffToDefault = weekStart - defaultStartOfWeek;
|
|
46
|
-
if (diffToDefault !== 0) {
|
|
47
|
-
return inst.add(diffToDefault, constant_exports.DAY);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return inst;
|
|
51
|
-
};
|
|
52
|
-
dayClass.prototype["startOf"] = function(unit) {
|
|
53
|
-
const inst = oldStartOf.call(this, unit);
|
|
54
|
-
return fixDiff(inst, unit);
|
|
55
|
-
};
|
|
56
|
-
dayClass.prototype["endOf"] = function(unit) {
|
|
57
|
-
const inst = oldEndOf.call(this, unit);
|
|
58
|
-
return fixDiff(inst, unit);
|
|
59
|
-
};
|
|
60
|
-
dayFactory.locale = function(localeName) {
|
|
61
|
-
$localeGlobal = localeName;
|
|
62
|
-
return dayFactory;
|
|
63
|
-
};
|
|
64
|
-
dayFactory.registerLocale = function(locale, newName) {
|
|
65
|
-
registerLocale(locale, newName);
|
|
66
|
-
return dayFactory;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export { getLocale, localePlugin, registerLocale };
|
package/plugins/utc/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { D as DateType, d as EsDayPlugin } from '../../EsDay-KXQgnL1r.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* utc plugin
|
|
5
|
-
*
|
|
6
|
-
* when utc mode is enabled, get and set methods will use UTC time
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
declare module 'esday' {
|
|
11
|
-
interface EsDay {
|
|
12
|
-
utc: () => EsDay;
|
|
13
|
-
local: () => EsDay;
|
|
14
|
-
isUTC: () => boolean;
|
|
15
|
-
}
|
|
16
|
-
interface EsDayFactory {
|
|
17
|
-
utc: (date?: DateType, ...others: any[]) => EsDay;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
declare const utcPlugin: EsDayPlugin<{}>;
|
|
21
|
-
|
|
22
|
-
export { utcPlugin };
|
package/plugins/utc/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getUnitInDate, undefinedOr } from '../../chunk-SQBPUYUY.js';
|
|
2
|
-
|
|
3
|
-
// src/plugins/utc/index.ts
|
|
4
|
-
var utcPlugin = (_, dayClass, dayFactory) => {
|
|
5
|
-
dayFactory.utc = (d, ...others) => {
|
|
6
|
-
const inst = dayFactory(d, ...others, { utc: true });
|
|
7
|
-
return inst;
|
|
8
|
-
};
|
|
9
|
-
dayClass.prototype.utc = function() {
|
|
10
|
-
const inst = this.clone();
|
|
11
|
-
inst["$conf"].utc = true;
|
|
12
|
-
return inst;
|
|
13
|
-
};
|
|
14
|
-
dayClass.prototype.local = function() {
|
|
15
|
-
const inst = this.clone();
|
|
16
|
-
inst["$conf"].utc = false;
|
|
17
|
-
return inst;
|
|
18
|
-
};
|
|
19
|
-
dayClass.prototype.isUTC = function() {
|
|
20
|
-
return !!this["$conf"].utc;
|
|
21
|
-
};
|
|
22
|
-
const oldFormat = dayClass.prototype.format;
|
|
23
|
-
dayClass.prototype.format = function(formatStr) {
|
|
24
|
-
const UTC_FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ss[Z]";
|
|
25
|
-
const str = formatStr || (this["$conf"].utc ? UTC_FORMAT_DEFAULT : "");
|
|
26
|
-
return oldFormat.call(this, str);
|
|
27
|
-
};
|
|
28
|
-
dayClass.prototype["parse"] = function(date) {
|
|
29
|
-
this["$d"] = this["$parseDate"](date, !!this["$conf"].utc);
|
|
30
|
-
};
|
|
31
|
-
dayClass.prototype["get"] = function(unit) {
|
|
32
|
-
return getUnitInDate(this["$d"], unit, !!this["$conf"].utc);
|
|
33
|
-
};
|
|
34
|
-
const old$set = dayClass.prototype["$set"];
|
|
35
|
-
dayClass.prototype["$set"] = function(unit, value, utc) {
|
|
36
|
-
return old$set.call(this, unit, value, undefinedOr(utc, !!this["$conf"].utc));
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { utcPlugin };
|