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/plugins/minMax/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray } from "../../chunks/
|
|
1
|
+
import { t as isArray } from "../../chunks/v_QBn7Xm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/minMax/index.ts
|
|
4
4
|
const minMaxPlugin = (_, _dayClass, dayFactory) => {
|
|
@@ -16,7 +16,6 @@ const minMaxPlugin = (_, _dayClass, dayFactory) => {
|
|
|
16
16
|
dayFactory.max = (...dates) => sortBy("isAfter", dates);
|
|
17
17
|
dayFactory.min = (...dates) => sortBy("isBefore", dates);
|
|
18
18
|
};
|
|
19
|
-
var minMax_default = minMaxPlugin;
|
|
20
19
|
|
|
21
20
|
//#endregion
|
|
22
|
-
export {
|
|
21
|
+
export { minMaxPlugin 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/objectSupport/index.d.ts
|
|
5
|
-
|
|
6
4
|
declare const objectSupportPlugin: EsDayPlugin<{}>;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { objectSupportPlugin as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { constants_default } from "../../chunks/
|
|
2
|
-
import { isEmptyObject, isObject } from "../../chunks/
|
|
3
|
-
import { normalizeUnitWithPlurals } from "../../chunks/
|
|
4
|
-
import { createInstanceFromExist } from "../../chunks/
|
|
1
|
+
import { p as constants_default } from "../../chunks/BkjWOpMU.js";
|
|
2
|
+
import { n as isEmptyObject, r as isObject } from "../../chunks/v_QBn7Xm.js";
|
|
3
|
+
import { n as normalizeUnitWithPlurals } from "../../chunks/AyQQ6US-.js";
|
|
4
|
+
import { t as createInstanceFromExist } from "../../chunks/Shk32pTP.js";
|
|
5
5
|
|
|
6
6
|
//#region src/plugins/objectSupport/index.ts
|
|
7
7
|
const objectSupportPlugin = (_, dayClass, _dayFactory) => {
|
|
@@ -22,36 +22,32 @@ const objectSupportPlugin = (_, dayClass, _dayFactory) => {
|
|
|
22
22
|
];
|
|
23
23
|
const dateIncludesYear = dateKeys.includes("y") || dateKeys.includes(constants_default.YEAR) || dateKeys.includes(`${constants_default.YEAR}s`);
|
|
24
24
|
const dateIncludesMonth = dateKeys.includes("M") || dateKeys.includes(constants_default.MONTH) || dateKeys.includes(`${constants_default.MONTH}s`);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
case constants_default.MS:
|
|
50
|
-
dateArrayTuple[6] = Number(date[stringKey]);
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
25
|
+
if ((dateKeys.includes("D") || dateKeys.includes(constants_default.DAY_OF_MONTH) || dateKeys.includes(`${constants_default.DAY_OF_MONTH}s`) || dateKeys.includes("d") || dateKeys.includes(constants_default.DAY) || dateKeys.includes(`${constants_default.DAY}s`)) && !dateIncludesMonth && !dateIncludesYear) dateArrayTuple[1] = now.month() + 1;
|
|
26
|
+
for (const stringKey of dateKeys) switch (normalizeUnitWithPlurals(stringKey)) {
|
|
27
|
+
case constants_default.YEAR:
|
|
28
|
+
dateArrayTuple[0] = Number(date[stringKey]);
|
|
29
|
+
break;
|
|
30
|
+
case constants_default.MONTH:
|
|
31
|
+
dateArrayTuple[1] = Number(date[stringKey]) + 1;
|
|
32
|
+
break;
|
|
33
|
+
case constants_default.DAY:
|
|
34
|
+
case constants_default.DAY_OF_MONTH:
|
|
35
|
+
dateArrayTuple[2] = Number(date[stringKey]);
|
|
36
|
+
break;
|
|
37
|
+
case constants_default.HOUR:
|
|
38
|
+
dateArrayTuple[3] = Number(date[stringKey]);
|
|
39
|
+
break;
|
|
40
|
+
case constants_default.MIN:
|
|
41
|
+
dateArrayTuple[4] = Number(date[stringKey]);
|
|
42
|
+
break;
|
|
43
|
+
case constants_default.SECOND:
|
|
44
|
+
dateArrayTuple[5] = Number(date[stringKey]);
|
|
45
|
+
break;
|
|
46
|
+
case constants_default.MS:
|
|
47
|
+
dateArrayTuple[6] = Number(date[stringKey]);
|
|
48
|
+
break;
|
|
53
49
|
}
|
|
54
|
-
this
|
|
50
|
+
this.$d = this.dateFromDateComponents(...dateArrayTuple);
|
|
55
51
|
} else oldParse.call(this, date);
|
|
56
52
|
};
|
|
57
53
|
const old$set = proto["$set"];
|
|
@@ -63,7 +59,7 @@ const objectSupportPlugin = (_, dayClass, _dayFactory) => {
|
|
|
63
59
|
for (const stringKey of keys) {
|
|
64
60
|
const key = stringKey;
|
|
65
61
|
const valueToSet = valuesToSet[key];
|
|
66
|
-
result =
|
|
62
|
+
if (valueToSet !== void 0) result = result.set(key, valueToSet);
|
|
67
63
|
}
|
|
68
64
|
return result;
|
|
69
65
|
}
|
|
@@ -77,7 +73,7 @@ const objectSupportPlugin = (_, dayClass, _dayFactory) => {
|
|
|
77
73
|
for (const stringKey of keys) {
|
|
78
74
|
const key = stringKey;
|
|
79
75
|
const valueToAdd = value[key];
|
|
80
|
-
result =
|
|
76
|
+
if (valueToAdd !== void 0) result = result.add(valueToAdd, key);
|
|
81
77
|
}
|
|
82
78
|
return result;
|
|
83
79
|
}
|
|
@@ -91,14 +87,13 @@ const objectSupportPlugin = (_, dayClass, _dayFactory) => {
|
|
|
91
87
|
for (const stringKey of keys) {
|
|
92
88
|
const key = stringKey;
|
|
93
89
|
const valueToSubtract = value[key];
|
|
94
|
-
result =
|
|
90
|
+
if (valueToSubtract !== void 0) result = result.subtract(valueToSubtract, key);
|
|
95
91
|
}
|
|
96
92
|
return result;
|
|
97
93
|
}
|
|
98
94
|
return oldSubtract.call(this, value, unit);
|
|
99
95
|
};
|
|
100
96
|
};
|
|
101
|
-
var objectSupport_default = objectSupportPlugin;
|
|
102
97
|
|
|
103
98
|
//#endregion
|
|
104
|
-
export {
|
|
99
|
+
export { objectSupportPlugin 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/pluralGetSet/index.d.ts
|
|
5
|
-
|
|
6
4
|
declare module 'esday' {
|
|
7
5
|
interface EsDay {
|
|
8
6
|
years: (() => number) & ((year: number, month?: number, date?: number) => EsDay);
|
|
@@ -10,7 +10,6 @@ const pluralGetSetPlugin = (_, dayClass, _dayFactory) => {
|
|
|
10
10
|
proto.seconds = proto.second;
|
|
11
11
|
proto.milliseconds = proto.millisecond;
|
|
12
12
|
};
|
|
13
|
-
var pluralGetSet_default = pluralGetSetPlugin;
|
|
14
13
|
|
|
15
14
|
//#endregion
|
|
16
|
-
export {
|
|
15
|
+
export { pluralGetSetPlugin 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/quarterOfYear/index.d.ts
|
|
5
|
-
|
|
6
4
|
declare module 'esday' {
|
|
7
5
|
interface EsDay {
|
|
8
6
|
quarter(): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { constants_default } from "../../chunks/
|
|
2
|
-
import { isObject } from "../../chunks/
|
|
3
|
-
import { normalizeUnitWithPlurals } from "../../chunks/
|
|
1
|
+
import { p as constants_default } from "../../chunks/BkjWOpMU.js";
|
|
2
|
+
import { r as isObject } from "../../chunks/v_QBn7Xm.js";
|
|
3
|
+
import { n as normalizeUnitWithPlurals } from "../../chunks/AyQQ6US-.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/quarterOfYear/index.ts
|
|
6
6
|
const quarterOfYearPlugin = (_, dayClass, dayFactory) => {
|
|
@@ -13,15 +13,13 @@ const quarterOfYearPlugin = (_, dayClass, dayFactory) => {
|
|
|
13
13
|
const oldAdd = proto.add;
|
|
14
14
|
proto.add = function(value, unit) {
|
|
15
15
|
if (!isObject(value) && unit !== void 0) {
|
|
16
|
-
|
|
17
|
-
if (unitLong === constants_default.QUARTER) return this.add(value * 3, constants_default.MONTH);
|
|
16
|
+
if (normalizeUnitWithPlurals(unit) === constants_default.QUARTER) return this.add(value * 3, constants_default.MONTH);
|
|
18
17
|
}
|
|
19
18
|
return oldAdd.call(this, value, unit);
|
|
20
19
|
};
|
|
21
20
|
const oldStartOf = proto.startOf;
|
|
22
21
|
proto.startOf = function(units) {
|
|
23
|
-
|
|
24
|
-
if (unit === constants_default.QUARTER) {
|
|
22
|
+
if (normalizeUnitWithPlurals(units) === constants_default.QUARTER) {
|
|
25
23
|
const quarter = this.quarter() - 1;
|
|
26
24
|
return this.month(quarter * 3).startOf(constants_default.MONTH).startOf(constants_default.DAY);
|
|
27
25
|
}
|
|
@@ -29,8 +27,7 @@ const quarterOfYearPlugin = (_, dayClass, dayFactory) => {
|
|
|
29
27
|
};
|
|
30
28
|
const oldEndOf = proto.endOf;
|
|
31
29
|
proto.endOf = function(units) {
|
|
32
|
-
|
|
33
|
-
if (unit === constants_default.QUARTER) {
|
|
30
|
+
if (normalizeUnitWithPlurals(units) === constants_default.QUARTER) {
|
|
34
31
|
const quarter = this.quarter() - 1;
|
|
35
32
|
return this.month(quarter * 3 + 2).endOf(constants_default.MONTH).endOf(constants_default.DAY);
|
|
36
33
|
}
|
|
@@ -38,21 +35,17 @@ const quarterOfYearPlugin = (_, dayClass, dayFactory) => {
|
|
|
38
35
|
};
|
|
39
36
|
const oldGet = proto.get;
|
|
40
37
|
proto.get = function(unit) {
|
|
41
|
-
|
|
42
|
-
if (normalizedUnit === constants_default.QUARTER) return this.quarter();
|
|
38
|
+
if (normalizeUnitWithPlurals(unit) === constants_default.QUARTER) return this.quarter();
|
|
43
39
|
return oldGet.call(this, unit);
|
|
44
40
|
};
|
|
45
41
|
const old$set = proto["$set"];
|
|
46
42
|
proto["$set"] = function(unit, values) {
|
|
47
|
-
if (isObject(unit)) return this
|
|
48
|
-
|
|
49
|
-
if (normalizedUnit === constants_default.QUARTER) return this.quarter(values[0]);
|
|
43
|
+
if (isObject(unit)) return this;
|
|
44
|
+
if (normalizeUnitWithPlurals(unit) === constants_default.QUARTER) return this.quarter(values[0]);
|
|
50
45
|
return old$set.call(this, unit, values);
|
|
51
46
|
};
|
|
52
|
-
|
|
53
|
-
dayFactory.addFormatTokenDefinitions(additionalTokens);
|
|
47
|
+
dayFactory.addFormatTokenDefinitions({ Q: (sourceDate) => sourceDate.quarter().toString() });
|
|
54
48
|
};
|
|
55
|
-
var quarterOfYear_default = quarterOfYearPlugin;
|
|
56
49
|
|
|
57
50
|
//#endregion
|
|
58
|
-
export {
|
|
51
|
+
export { quarterOfYearPlugin as default };
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { RelativeTimeKeys } from "../../chunks/St35qgL0.js";
|
|
1
|
+
import { o as EsDayPlugin, r as DateType } from "../../chunks/CODi8AFH.js";
|
|
2
|
+
import { Locale } from "../locale/index.js";
|
|
4
3
|
|
|
5
|
-
//#region src/common/constants.d.ts
|
|
6
|
-
|
|
7
|
-
declare const _default: {
|
|
8
|
-
SECONDS_A_MINUTE: number;
|
|
9
|
-
SECONDS_A_HOUR: number;
|
|
10
|
-
SECONDS_A_DAY: number;
|
|
11
|
-
SECONDS_A_WEEK: number;
|
|
12
|
-
MILLISECONDS_A_SECOND: number;
|
|
13
|
-
MILLISECONDS_A_MINUTE: number;
|
|
14
|
-
MILLISECONDS_A_HOUR: number;
|
|
15
|
-
MILLISECONDS_A_DAY: number;
|
|
16
|
-
MILLISECONDS_A_WEEK: number;
|
|
17
|
-
INDEX_SUNDAY: number;
|
|
18
|
-
INDEX_MONDAY: number;
|
|
19
|
-
INDEX_WEDNESDAY: number;
|
|
20
|
-
INDEX_THURSDAY: number;
|
|
21
|
-
MS: "millisecond";
|
|
22
|
-
SECOND: "second";
|
|
23
|
-
MIN: "minute";
|
|
24
|
-
HOUR: "hour";
|
|
25
|
-
DAY: "day";
|
|
26
|
-
WEEK: "week";
|
|
27
|
-
ISOWEEK: "isoWeek";
|
|
28
|
-
MONTH: "month";
|
|
29
|
-
QUARTER: "quarter";
|
|
30
|
-
YEAR: "year";
|
|
31
|
-
DAY_OF_MONTH: "date";
|
|
32
|
-
FORMAT_DEFAULT: string;
|
|
33
|
-
INVALID_DATE: Date;
|
|
34
|
-
INVALID_DATE_STRING: string;
|
|
35
|
-
REGEX_PARSE_DEFAULT: RegExp;
|
|
36
|
-
};
|
|
37
|
-
//#endregion
|
|
38
4
|
//#region src/plugins/relativeTime/index.d.ts
|
|
39
|
-
|
|
40
5
|
declare module 'esday' {
|
|
41
6
|
interface EsDay {
|
|
42
7
|
to: (referenceDate: DateType, withoutSuffix?: boolean) => string;
|
|
@@ -44,16 +9,39 @@ declare module 'esday' {
|
|
|
44
9
|
toNow: (withoutSuffix?: boolean) => string;
|
|
45
10
|
fromNow: (withoutSuffix?: boolean) => string;
|
|
46
11
|
}
|
|
12
|
+
interface EsDayFactory {
|
|
13
|
+
relativeTimeThreshold(unit: ThresholdRelativeTimeKeys): boolean | number | null;
|
|
14
|
+
relativeTimeThreshold(unit: ThresholdRelativeTimeKeys, limit: number | null): boolean;
|
|
15
|
+
relativeTimeRounding(): RelativeTimeRound;
|
|
16
|
+
relativeTimeRounding(roundingFunction: RelativeTimeRound): boolean;
|
|
17
|
+
formatDifference: (diffAsUnits: DiffAsUnit, withoutSuffix: boolean, locale: Locale, thresholds?: ThresholdRelativeTime) => string;
|
|
18
|
+
defaultThresholds: () => ThresholdRelativeTime;
|
|
19
|
+
globalThresholds: () => ThresholdRelativeTime;
|
|
20
|
+
}
|
|
47
21
|
}
|
|
48
|
-
type
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
22
|
+
type ThresholdRelativeTime = {
|
|
23
|
+
ss?: number | null;
|
|
24
|
+
s?: number | null;
|
|
25
|
+
m?: number | null;
|
|
26
|
+
h?: number | null;
|
|
27
|
+
d?: number | null;
|
|
28
|
+
w?: number | null;
|
|
29
|
+
M?: number | null;
|
|
30
|
+
};
|
|
31
|
+
type DiffAsUnit = {
|
|
32
|
+
s: number;
|
|
33
|
+
m: number;
|
|
34
|
+
h: number;
|
|
35
|
+
d: number;
|
|
36
|
+
w: number;
|
|
37
|
+
M: number;
|
|
38
|
+
y: number;
|
|
53
39
|
};
|
|
40
|
+
type ThresholdRelativeTimeKeys = keyof ThresholdRelativeTime;
|
|
41
|
+
type RelativeTimeRound = (value: number) => number;
|
|
54
42
|
declare const relativeTimePlugin: EsDayPlugin<{
|
|
55
|
-
thresholds?:
|
|
43
|
+
thresholds?: ThresholdRelativeTime;
|
|
56
44
|
rounding?: (valueToRound: number) => number;
|
|
57
45
|
}>;
|
|
58
46
|
//#endregion
|
|
59
|
-
export {
|
|
47
|
+
export { DiffAsUnit, RelativeTimeRound, ThresholdRelativeTime, ThresholdRelativeTimeKeys, relativeTimePlugin as default };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { constants_default } from "../../chunks/
|
|
2
|
-
import { createInstanceFromExist } from "../../chunks/
|
|
1
|
+
import { p as constants_default } from "../../chunks/BkjWOpMU.js";
|
|
2
|
+
import { t as createInstanceFromExist } from "../../chunks/Shk32pTP.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/relativeTime/index.ts
|
|
5
5
|
const relativeTimePlugin = (options, dayClass, dayFactory) => {
|
|
6
|
-
const proto = dayClass.prototype;
|
|
7
6
|
const defaultRelativeTimeDef = {
|
|
8
7
|
future: "in %s",
|
|
9
8
|
past: "%s ago",
|
|
@@ -15,73 +14,124 @@ const relativeTimePlugin = (options, dayClass, dayFactory) => {
|
|
|
15
14
|
hh: "%d hours",
|
|
16
15
|
d: "a day",
|
|
17
16
|
dd: "%d days",
|
|
17
|
+
w: "a week",
|
|
18
|
+
ww: "%d weeks",
|
|
18
19
|
M: "a month",
|
|
19
20
|
MM: "%d months",
|
|
20
21
|
y: "a year",
|
|
21
22
|
yy: "%d years"
|
|
22
23
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
key
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
key
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
24
|
+
const defaultThresholds = {
|
|
25
|
+
ss: 44,
|
|
26
|
+
s: 45,
|
|
27
|
+
m: 45,
|
|
28
|
+
h: 22,
|
|
29
|
+
d: 26,
|
|
30
|
+
w: null,
|
|
31
|
+
M: 11
|
|
32
|
+
};
|
|
33
|
+
dayFactory.defaultThresholds = () => structuredClone(defaultThresholds);
|
|
34
|
+
const thresholds = options.thresholds ?? defaultThresholds;
|
|
35
|
+
dayFactory.globalThresholds = () => structuredClone(thresholds);
|
|
36
|
+
/**
|
|
37
|
+
* Format object containing a time difference as human readable length of time.
|
|
38
|
+
* @param diffAsUnits - object containing the time difference calculated for different units
|
|
39
|
+
* @param withoutSuffix - format without 'in ---' or '... ago'
|
|
40
|
+
* @param locale - locale to use to get format definitions for relativeTime
|
|
41
|
+
* @param thresholds - thresholds, which define when a unit is considered a minute, an hour and so on
|
|
42
|
+
* @returns difference formatted as human string (e.g. 5 days ago)
|
|
43
|
+
*/
|
|
44
|
+
function formatDifference(diffAsUnits, withoutSuffix, locale, thresholds = defaultThresholds) {
|
|
45
|
+
const isFuture = diffAsUnits.s > 0;
|
|
46
|
+
const relativeTimeDef = locale?.relativeTime ?? defaultRelativeTimeDef;
|
|
47
|
+
let out = "";
|
|
48
|
+
let selectedKeyAndValue = {
|
|
49
|
+
key: "",
|
|
50
|
+
value: 0
|
|
51
|
+
};
|
|
52
|
+
if (rounding(abs(diffAsUnits.s)) <= (thresholds.ss ?? 0)) {
|
|
53
|
+
selectedKeyAndValue.key = "s";
|
|
54
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.s));
|
|
55
|
+
} else if (rounding(abs(diffAsUnits.s)) < (thresholds.s ?? -1)) {
|
|
56
|
+
selectedKeyAndValue.key = "ss";
|
|
57
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.s));
|
|
58
|
+
} else if (rounding(abs(diffAsUnits.m)) <= 1) {
|
|
59
|
+
selectedKeyAndValue.key = "m";
|
|
60
|
+
selectedKeyAndValue.value = void 0;
|
|
61
|
+
} else if (rounding(abs(diffAsUnits.m)) < (thresholds.m ?? -1)) {
|
|
62
|
+
selectedKeyAndValue.key = "mm";
|
|
63
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.m));
|
|
64
|
+
} else if (rounding(abs(diffAsUnits.h)) <= 1) {
|
|
65
|
+
selectedKeyAndValue.key = "h";
|
|
66
|
+
selectedKeyAndValue.value = void 0;
|
|
67
|
+
} else if (rounding(abs(diffAsUnits.h)) < (thresholds.h ?? -1)) {
|
|
68
|
+
selectedKeyAndValue.key = "hh";
|
|
69
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.h));
|
|
70
|
+
} else if (rounding(abs(diffAsUnits.d)) <= 1) {
|
|
71
|
+
selectedKeyAndValue.key = "d";
|
|
72
|
+
selectedKeyAndValue.value = void 0;
|
|
73
|
+
} else if (rounding(abs(diffAsUnits.d)) < (thresholds.d ?? -1)) {
|
|
74
|
+
selectedKeyAndValue.key = "dd";
|
|
75
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.d));
|
|
76
|
+
} else if (thresholds.w !== null && rounding(abs(diffAsUnits.w)) <= 1) {
|
|
77
|
+
selectedKeyAndValue.key = "w";
|
|
78
|
+
selectedKeyAndValue.value = void 0;
|
|
79
|
+
} else if (thresholds.w !== null && rounding(abs(diffAsUnits.w)) < (thresholds.w ?? -1)) {
|
|
80
|
+
selectedKeyAndValue.key = "ww";
|
|
81
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.w));
|
|
82
|
+
} else if (rounding(abs(diffAsUnits.M)) <= 1) {
|
|
83
|
+
selectedKeyAndValue.key = "M";
|
|
84
|
+
selectedKeyAndValue.value = void 0;
|
|
85
|
+
} else if (rounding(abs(diffAsUnits.M)) < (thresholds.M ?? -1)) {
|
|
86
|
+
selectedKeyAndValue.key = "MM";
|
|
87
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.M));
|
|
88
|
+
} else if (rounding(abs(diffAsUnits.y)) <= 1) {
|
|
89
|
+
selectedKeyAndValue.key = "y";
|
|
90
|
+
selectedKeyAndValue.value = void 0;
|
|
91
|
+
} else {
|
|
92
|
+
selectedKeyAndValue.key = "yy";
|
|
93
|
+
selectedKeyAndValue.value = rounding(abs(diffAsUnits.y));
|
|
94
|
+
}
|
|
95
|
+
const format = relativeTimeDef[selectedKeyAndValue.key];
|
|
96
|
+
const outputDiffAbs = rounding(abs(selectedKeyAndValue.value ?? 1));
|
|
97
|
+
out = typeof format === "string" ? format.replace("%d", `${outputDiffAbs}`) : format(outputDiffAbs, withoutSuffix, selectedKeyAndValue.key, isFuture);
|
|
98
|
+
const postFormat = locale?.postFormat;
|
|
99
|
+
if (postFormat) out = postFormat(out);
|
|
100
|
+
if (withoutSuffix) return out;
|
|
101
|
+
const suffix = isFuture ? relativeTimeDef.future : relativeTimeDef.past;
|
|
102
|
+
return typeof suffix === "function" ? suffix(out, withoutSuffix, isFuture ? "future" : "past", isFuture) : suffix.replace("%s", out);
|
|
103
|
+
}
|
|
104
|
+
dayFactory.formatDifference = formatDifference;
|
|
105
|
+
const proto = dayClass.prototype;
|
|
106
|
+
const abs = Math.abs;
|
|
107
|
+
let rounding = options.rounding ?? Math.round;
|
|
108
|
+
/**
|
|
109
|
+
* Set a threshold for relative time strings
|
|
110
|
+
* @param unit - unit of threshold to get / set (ss,s,m,h,d,w,M)
|
|
111
|
+
* @param limit - new threshold value
|
|
112
|
+
* @returns false=unknown unit; true=threshold successfully set; current threshold (number | null)
|
|
113
|
+
*/
|
|
114
|
+
dayFactory.relativeTimeThreshold = (unit, limit) => {
|
|
115
|
+
if (thresholds[unit] === void 0) return false;
|
|
116
|
+
if (limit === void 0) return thresholds[unit];
|
|
117
|
+
thresholds[unit] = limit;
|
|
118
|
+
if (unit === "s") if (limit !== null) thresholds.ss = limit - 1;
|
|
119
|
+
else thresholds.ss = null;
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Gets or sets the rounding function for relative time strings
|
|
124
|
+
* @param roundingFunction - rounding function
|
|
125
|
+
* @returns - the rounding function (getter) or true=rounding function successfully set
|
|
126
|
+
*/
|
|
127
|
+
dayFactory.relativeTimeRounding = (roundingFunction) => {
|
|
128
|
+
if (roundingFunction === void 0) return rounding;
|
|
129
|
+
if (typeof roundingFunction === "function") {
|
|
130
|
+
rounding = roundingFunction;
|
|
131
|
+
return true;
|
|
82
132
|
}
|
|
83
|
-
|
|
84
|
-
|
|
133
|
+
return false;
|
|
134
|
+
};
|
|
85
135
|
/**
|
|
86
136
|
* Calculate the difference between instance and referenceDate in given units
|
|
87
137
|
* as fractional value for 'from' and 'to'
|
|
@@ -107,31 +157,15 @@ const relativeTimePlugin = (options, dayClass, dayFactory) => {
|
|
|
107
157
|
const referenceDate = dayFactory(reference);
|
|
108
158
|
if (!(this.isValid() && referenceDate.isValid())) return constants_default.INVALID_DATE_STRING;
|
|
109
159
|
const locale = this.localeObject?.();
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
isFuture = diffAsUnit > 0;
|
|
120
|
-
if (absoluteDiff <= (threshold.thresholdValue ?? Number.POSITIVE_INFINITY)) {
|
|
121
|
-
const thresholdKey = threshold.key;
|
|
122
|
-
const formatUnit = thresholdKey.slice(0, 1);
|
|
123
|
-
const outputDiff = differenceInUnits(this, referenceDate, formatUnit, isFrom);
|
|
124
|
-
const outputDiffAbs = rounding(Math.abs(outputDiff));
|
|
125
|
-
const format = relativeTimeDef[thresholdKey];
|
|
126
|
-
out = typeof format === "string" ? format.replace("%d", `${outputDiffAbs}`) : format(outputDiffAbs, withoutSuffix, thresholdKey, isFuture);
|
|
127
|
-
const postFormat = locale?.postFormat;
|
|
128
|
-
if (postFormat) out = postFormat(out);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (withoutSuffix) return out;
|
|
133
|
-
const suffix = isFuture ? relativeTimeDef.future : relativeTimeDef.past;
|
|
134
|
-
return typeof suffix === "function" ? suffix(out, withoutSuffix, isFuture ? "future" : "past", isFuture) : suffix.replace("%s", out);
|
|
160
|
+
return formatDifference({
|
|
161
|
+
s: differenceInUnits(this, referenceDate, "s", isFrom),
|
|
162
|
+
m: differenceInUnits(this, referenceDate, "m", isFrom),
|
|
163
|
+
h: differenceInUnits(this, referenceDate, "h", isFrom),
|
|
164
|
+
d: differenceInUnits(this, referenceDate, "d", isFrom),
|
|
165
|
+
w: differenceInUnits(this, referenceDate, "w", isFrom),
|
|
166
|
+
M: differenceInUnits(this, referenceDate, "M", isFrom),
|
|
167
|
+
y: differenceInUnits(this, referenceDate, "y", isFrom)
|
|
168
|
+
}, withoutSuffix, locale, thresholds);
|
|
135
169
|
}
|
|
136
170
|
proto.to = function(referenceDate, withoutSuffix) {
|
|
137
171
|
return fromToBase.call(this, referenceDate, withoutSuffix ?? false, true);
|
|
@@ -148,7 +182,6 @@ const relativeTimePlugin = (options, dayClass, dayFactory) => {
|
|
|
148
182
|
return this.from(now, withoutSuffix);
|
|
149
183
|
};
|
|
150
184
|
};
|
|
151
|
-
var relativeTime_default = relativeTimePlugin;
|
|
152
185
|
|
|
153
186
|
//#endregion
|
|
154
|
-
export {
|
|
187
|
+
export { relativeTimePlugin as default };
|