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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## [0.6.2](https://github.com/BePo65/esday/compare/v0.6.1...v0.6.2) (2026-03-03)
|
|
6
|
+
|
|
7
|
+
## [0.6.1](https://github.com/BePo65/esday/compare/v0.6.0...v0.6.1) (2026-03-03)
|
|
8
|
+
|
|
9
|
+
## [0.6.0](https://github.com/BePo65/esday/compare/v0.5.0...v0.6.0) (2026-03-03)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add copy button to esday documentation web site pages ([d697518](https://github.com/BePo65/esday/commit/d69751857351e505c8ce870cdac4f171859b62a5))
|
|
15
|
+
* add methods to relativeTime plugin to get or set the thresholds and the rounding function used ([#143](https://github.com/BePo65/esday/issues/143)) ([0dfe619](https://github.com/BePo65/esday/commit/0dfe619a90d64f259085a126b7ba7b671768ddd5))
|
|
16
|
+
* add plugin duration ([#142](https://github.com/BePo65/esday/issues/142)) ([730a88f](https://github.com/BePo65/esday/commit/730a88f3dccb22e329291d033d74c1615834e41f))
|
|
17
|
+
* clamp day when setting year+month or month without day-of-month ([576a06a](https://github.com/BePo65/esday/commit/576a06ade7ac21928f7ea9e10b9347e13ff7cd1a))
|
|
18
|
+
* plugin timezone ([1479a3f](https://github.com/BePo65/esday/commit/1479a3f7abf28a0bc55df139cfde70b1d8f9dd86))
|
|
19
|
+
* utc - clamp day setting year+month or month without day-of-month ([8e96a02](https://github.com/BePo65/esday/commit/8e96a02bca48b9bf1ce97ad2db593ea5464d4766))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* add more tests for parsing and fix error when parsing leading spaces ([e92e088](https://github.com/BePo65/esday/commit/e92e08855091b2c09b75d6e3e02eb21fdfb298f6))
|
|
25
|
+
* fix error in plugin utc when handling object input parameters ([52a211f](https://github.com/BePo65/esday/commit/52a211ffdfb8a68071479e3ea80d1ed4adbd2105))
|
|
26
|
+
* fix format utcOffset containing seconds (see 'iamkun/dayjs[#2016](https://github.com/BePo65/esday/issues/2016)') ([b501025](https://github.com/BePo65/esday/commit/b501025738c36114255720b356e554695c4f01f5))
|
|
27
|
+
* make dayOfMonthOrdinalParse a RegExp only (the only used type) ([7efeeb8](https://github.com/BePo65/esday/commit/7efeeb80201201af71670ab0c4b15e23a77e847f))
|
|
28
|
+
* make overflow / work in dateFromDateComponents like moment.js ([8c6e732](https://github.com/BePo65/esday/commit/8c6e7325158a27340dc7cdc8b2504e93d7a2ab20))
|
|
29
|
+
* make plugin ObjectSupport call complete chain of dependencies ([fc469f2](https://github.com/BePo65/esday/commit/fc469f2514371796c5674c3cf49e073604fa5cc4))
|
|
30
|
+
* minor problems in .add and with seconds in utcOffset ([8b53242](https://github.com/BePo65/esday/commit/8b532420942ec2ee206fe8ddd7e0273c3f22e2d9)), closes [#160](https://github.com/BePo65/esday/issues/160)
|
|
31
|
+
* more small errors ([575424b](https://github.com/BePo65/esday/commit/575424bbbdafce717c5c6cc5e27d1a9bc04a0fa6)), closes [#162](https://github.com/BePo65/esday/issues/162)
|
|
32
|
+
* parse day-of-month as localized ordinal number ([#147](https://github.com/BePo65/esday/issues/147)) ([2504808](https://github.com/BePo65/esday/commit/2504808e7b9b04a5db10c10b0ca1d42a622863ee))
|
|
33
|
+
* parsing date-time string with spaces or with unlimited milliseconds (differs in webkit only) ([d23dd97](https://github.com/BePo65/esday/commit/d23dd975c4a36355a137902bfb848334501fb2cb)), closes [#155](https://github.com/BePo65/esday/issues/155)
|
|
34
|
+
* parsing locale date string with ordinal number ([c265cc6](https://github.com/BePo65/esday/commit/c265cc672287f2a22aaba6894a9d492d90450c04))
|
|
35
|
+
* parsing with unlimited milliseconds in webkit ([78db735](https://github.com/BePo65/esday/commit/78db73521a0217d7ada1e15a8b3cec5c8eaf234b))
|
|
36
|
+
* results of plugin relative time differ from moment.js ([#141](https://github.com/BePo65/esday/issues/141)) ([8618b68](https://github.com/BePo65/esday/commit/8618b687066d22cf56df806a6f401cbcf231a2fc))
|
|
37
|
+
* the new version of vitest threw new warnings ([cb025c4](https://github.com/BePo65/esday/commit/cb025c41c2ff29a1c13520292583ae307033cd75))
|
|
38
|
+
* update packages to latest versions and fix findings ([b20d97c](https://github.com/BePo65/esday/commit/b20d97c6e5797f9e653fbafededdd8a0a807689d)), closes [#163](https://github.com/BePo65/esday/issues/163)
|
|
39
|
+
|
|
40
|
+
## [0.5.0] (2025-08-09)
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- Initial release of the project.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 gmero
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,33 +1,63 @@
|
|
|
1
|
-
##
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
1
|
+
## EsDay
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/esday)
|
|
4
|
+
[](https://github.com/kessler/license-report/blob/master/LICENSE)
|
|
5
|
+
[](https://github.com/BePo65/esday?tab=readme-ov-file#contribute)
|
|
6
|
+
|
|
7
|
+
# Repository changing ownership
|
|
8
|
+
|
|
9
|
+
On the 6th of January 2026 this repository changed the ownership to one of it's maintainers, [BePo65](https://github.com/BePo65) to reduce the workload on [g-mero](https://github.com/g-mero).
|
|
10
|
+
|
|
11
|
+
> EsDay is a JavaScript library inspired by [Day.js](https://github.com/iamkun/dayjs), esday has a largely similar API to Day.js (v1.11.13), but it is written in TypeScript and fully supports es modules. Being compatible to Day.js, EsDay is also a good replacement for Moment.js.
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { esday } from 'esday'
|
|
15
|
+
import { isTodayPlugin } from 'esday/plugins/isToday'
|
|
16
|
+
|
|
17
|
+
esday.extend(isTodayPlugin)
|
|
18
|
+
|
|
19
|
+
esday('2024-12-10').set('year', 2025).add(1, 'month').isToday()
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For detailed information see the [full documentation](https://bepo65.github.io/esday/).
|
|
23
|
+
|
|
24
|
+
## Concepts
|
|
25
|
+
|
|
26
|
+
- **Modern API**: Provides the same API as Day.js, with some features moved to plugins for a simpler core.
|
|
27
|
+
- **Immutable**: esday is immutable, which means that all operations will return a new instance of esday.
|
|
28
|
+
|
|
29
|
+
## Differences to Day.js
|
|
30
|
+
|
|
31
|
+
- **Locale is a Plugin**: no default locale!
|
|
32
|
+
- **default value for 'Start of Week' is 1 (as in ISO 8601)**: 'Start of Week' is 1 ('Monday').
|
|
33
|
+
- **default value for 'Start of Year' is 4 (as in ISO 8601)**: 'Start of Year' is 4.
|
|
34
|
+
- **clamping month on set**: when changing the month and the new month does not have enough days to keep the current day of month, esday behaves like moment.js and clamps to the end of the target month
|
|
35
|
+
- **Invalid Date**: conforms to Moment.js and uses `Invalid date` instead of `Invalid Date`.
|
|
36
|
+
- **plugin AdvancedParse** got replaced by CustomParseFormat.
|
|
37
|
+
- **plugin ArraySupport**: functionality is part of esday core.
|
|
38
|
+
- **plugin IsoWeeksInYear**: functionality is part of plugin IsoWeek.
|
|
39
|
+
- **plugin PreParsePostFormat**: functionality is part of esday core.
|
|
40
|
+
- **plugin UpdateLocale**: functionality is part of plugin Locale.
|
|
41
|
+
- **plugin weekOfYear**: functionality is part of plugin Week.
|
|
42
|
+
- **plugin WeekYear**: functionality is part of plugin Week.
|
|
43
|
+
- **plugin Weekday**: functionality is part of plugin Week.
|
|
44
|
+
|
|
45
|
+
## Differences to Moment.js
|
|
46
|
+
|
|
47
|
+
Esday uses moment@2.30.1 as api reference.
|
|
48
|
+
|
|
49
|
+
- **toString**: conforms to Day.js and uses Date.toUTCString() (returning the date in RFC 7231 format 'ddd, DD MMM YYYY HH:mm:ss [GMT]') while moment uses the format 'ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'.
|
|
50
|
+
- **toISOString**: conforms to Day.js and returns 'Invalid date' when called on an invalid date. In that case moment returns null (see [moment pr#3710](https://github.com/moment/moment/pull/3710)).
|
|
51
|
+
|
|
52
|
+
## Contribute
|
|
53
|
+
|
|
54
|
+
In the folder `dev` there is a template for creating new plugins and a template for new locale definitions.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
59
|
+
|
|
60
|
+
This project also partially contains code derived or copied from the following projects:
|
|
61
|
+
|
|
62
|
+
- [Day.js](https://github.com/iamkun/dayjs)
|
|
63
|
+
- [Moment.js](https://github.com/moment/moment)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { a as ISOWEEK, c as MS, d as WEEK, f as YEAR, l as QUARTER, n as DAY_OF_MONTH, o as MIN, r as HOUR, s as MONTH, t as DAY, u as SECOND } from "./BkjWOpMU.js";
|
|
2
|
+
|
|
3
|
+
//#region src/common/units.ts
|
|
4
|
+
const UNIT_MAP_SHORT_TO_LONG = {
|
|
5
|
+
y: YEAR,
|
|
6
|
+
Q: QUARTER,
|
|
7
|
+
M: MONTH,
|
|
8
|
+
w: WEEK,
|
|
9
|
+
W: ISOWEEK,
|
|
10
|
+
D: DAY_OF_MONTH,
|
|
11
|
+
d: DAY,
|
|
12
|
+
h: HOUR,
|
|
13
|
+
m: MIN,
|
|
14
|
+
s: SECOND,
|
|
15
|
+
ms: MS
|
|
16
|
+
};
|
|
17
|
+
const UNIT_MAP_PLURAL_TO_LONG = {
|
|
18
|
+
years: "year",
|
|
19
|
+
quarters: "quarter",
|
|
20
|
+
months: "month",
|
|
21
|
+
weeks: "week",
|
|
22
|
+
isoWeeks: "isoWeek",
|
|
23
|
+
dates: "date",
|
|
24
|
+
days: "day",
|
|
25
|
+
hours: "hour",
|
|
26
|
+
minutes: "minute",
|
|
27
|
+
seconds: "second",
|
|
28
|
+
milliseconds: "millisecond"
|
|
29
|
+
};
|
|
30
|
+
const UNIT_MAP_SHORT_TO_PLURAL = {
|
|
31
|
+
y: "years",
|
|
32
|
+
Q: "quarters",
|
|
33
|
+
M: "months",
|
|
34
|
+
w: "weeks",
|
|
35
|
+
W: "isoWeeks",
|
|
36
|
+
D: "dates",
|
|
37
|
+
d: "days",
|
|
38
|
+
h: "hours",
|
|
39
|
+
m: "minutes",
|
|
40
|
+
s: "seconds",
|
|
41
|
+
ms: "milliseconds"
|
|
42
|
+
};
|
|
43
|
+
const UNIT_MAP_LONG_TO_PLURAL = {
|
|
44
|
+
year: "years",
|
|
45
|
+
quarter: "quarters",
|
|
46
|
+
month: "months",
|
|
47
|
+
week: "weeks",
|
|
48
|
+
isoWeek: "isoWeeks",
|
|
49
|
+
date: "dates",
|
|
50
|
+
day: "days",
|
|
51
|
+
hour: "hours",
|
|
52
|
+
minute: "minutes",
|
|
53
|
+
second: "seconds",
|
|
54
|
+
millisecond: "milliseconds"
|
|
55
|
+
};
|
|
56
|
+
function normalizeUnit(unit) {
|
|
57
|
+
let normalizedUnit = UNIT_MAP_SHORT_TO_LONG[unit];
|
|
58
|
+
if (normalizedUnit === void 0) {
|
|
59
|
+
const unitAsLongUnit = unit;
|
|
60
|
+
normalizedUnit = UNIT_MAP_LONG_TO_PLURAL[unitAsLongUnit] ? unitAsLongUnit : normalizedUnit;
|
|
61
|
+
}
|
|
62
|
+
return normalizedUnit;
|
|
63
|
+
}
|
|
64
|
+
function normalizeUnitWithPlurals(unit) {
|
|
65
|
+
let normalizedUnit = UNIT_MAP_SHORT_TO_LONG[unit];
|
|
66
|
+
if (normalizedUnit === void 0) {
|
|
67
|
+
const singularUnit = unit?.replace?.(/s$/, "");
|
|
68
|
+
normalizedUnit = UNIT_MAP_LONG_TO_PLURAL.hasOwnProperty(singularUnit) ? singularUnit : normalizedUnit;
|
|
69
|
+
}
|
|
70
|
+
return normalizedUnit;
|
|
71
|
+
}
|
|
72
|
+
function normalizeUnitWithPluralsToPlural(unit) {
|
|
73
|
+
let normalizedUnit = UNIT_MAP_SHORT_TO_PLURAL[unit];
|
|
74
|
+
if (normalizedUnit === void 0) {
|
|
75
|
+
const unitAsPluralUnit = unit;
|
|
76
|
+
const isPluralUnit = UNIT_MAP_PLURAL_TO_LONG[unitAsPluralUnit];
|
|
77
|
+
const unitFromLongUnit = UNIT_MAP_LONG_TO_PLURAL[unit];
|
|
78
|
+
normalizedUnit = isPluralUnit ? unitAsPluralUnit : unitFromLongUnit;
|
|
79
|
+
}
|
|
80
|
+
return normalizedUnit;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
export { normalizeUnitWithPlurals as n, normalizeUnitWithPluralsToPlural as r, normalizeUnit as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/common/constants.ts
|
|
2
|
+
const SECONDS_A_MINUTE = 60;
|
|
3
|
+
const SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
|
|
4
|
+
const SECONDS_A_DAY = SECONDS_A_HOUR * 24;
|
|
5
|
+
const SECONDS_A_WEEK = SECONDS_A_DAY * 7;
|
|
6
|
+
const MILLISECONDS_A_SECOND = 1e3;
|
|
7
|
+
const MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
|
|
8
|
+
const MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
|
|
9
|
+
const MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
|
|
10
|
+
const MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND;
|
|
11
|
+
const MILLISECONDS_A_YEAR = MILLISECONDS_A_DAY * 365;
|
|
12
|
+
const MILLISECONDS_A_MONTH = MILLISECONDS_A_YEAR / 12;
|
|
13
|
+
const MILLISECONDS_A_QUARTER = MILLISECONDS_A_MONTH * 3;
|
|
14
|
+
const INDEX_SUNDAY = 0;
|
|
15
|
+
const INDEX_MONDAY = 1;
|
|
16
|
+
const INDEX_WEDNESDAY = 3;
|
|
17
|
+
const INDEX_THURSDAY = 4;
|
|
18
|
+
const MS = "millisecond";
|
|
19
|
+
const SECOND = "second";
|
|
20
|
+
const MIN = "minute";
|
|
21
|
+
const HOUR = "hour";
|
|
22
|
+
const DAY = "day";
|
|
23
|
+
const WEEK = "week";
|
|
24
|
+
const ISOWEEK = "isoWeek";
|
|
25
|
+
const MONTH = "month";
|
|
26
|
+
const QUARTER = "quarter";
|
|
27
|
+
const YEAR = "year";
|
|
28
|
+
const DAY_OF_MONTH = "date";
|
|
29
|
+
const FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ssZ";
|
|
30
|
+
const INVALID_DATE = /* @__PURE__ */ new Date("");
|
|
31
|
+
const INVALID_DATE_STRING = "Invalid date";
|
|
32
|
+
const REGEX_PARSE_DEFAULT = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
|
|
33
|
+
var constants_default = {
|
|
34
|
+
SECONDS_A_MINUTE,
|
|
35
|
+
SECONDS_A_HOUR,
|
|
36
|
+
SECONDS_A_DAY,
|
|
37
|
+
SECONDS_A_WEEK,
|
|
38
|
+
MILLISECONDS_A_SECOND,
|
|
39
|
+
MILLISECONDS_A_MINUTE,
|
|
40
|
+
MILLISECONDS_A_HOUR,
|
|
41
|
+
MILLISECONDS_A_DAY,
|
|
42
|
+
MILLISECONDS_A_WEEK,
|
|
43
|
+
MILLISECONDS_A_QUARTER,
|
|
44
|
+
MILLISECONDS_A_MONTH,
|
|
45
|
+
MILLISECONDS_A_YEAR,
|
|
46
|
+
INDEX_SUNDAY,
|
|
47
|
+
INDEX_MONDAY,
|
|
48
|
+
INDEX_WEDNESDAY,
|
|
49
|
+
INDEX_THURSDAY,
|
|
50
|
+
MS,
|
|
51
|
+
SECOND,
|
|
52
|
+
MIN,
|
|
53
|
+
HOUR,
|
|
54
|
+
DAY,
|
|
55
|
+
WEEK,
|
|
56
|
+
ISOWEEK,
|
|
57
|
+
MONTH,
|
|
58
|
+
QUARTER,
|
|
59
|
+
YEAR,
|
|
60
|
+
DAY_OF_MONTH,
|
|
61
|
+
FORMAT_DEFAULT,
|
|
62
|
+
INVALID_DATE,
|
|
63
|
+
INVALID_DATE_STRING,
|
|
64
|
+
REGEX_PARSE_DEFAULT
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { ISOWEEK as a, MS as c, WEEK as d, YEAR as f, INVALID_DATE_STRING as i, QUARTER as l, DAY_OF_MONTH as n, MIN as o, constants_default as p, HOUR as r, MONTH as s, DAY as t, SECOND as u };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
//#region src/common/units.d.ts
|
|
2
|
+
declare const UNIT_MAP_SHORT_TO_LONG: {
|
|
3
|
+
readonly y: "year";
|
|
4
|
+
readonly Q: "quarter";
|
|
5
|
+
readonly M: "month";
|
|
6
|
+
readonly w: "week";
|
|
7
|
+
readonly W: "isoWeek";
|
|
8
|
+
readonly D: "date";
|
|
9
|
+
readonly d: "day";
|
|
10
|
+
readonly h: "hour";
|
|
11
|
+
readonly m: "minute";
|
|
12
|
+
readonly s: "second";
|
|
13
|
+
readonly ms: "millisecond";
|
|
14
|
+
};
|
|
15
|
+
declare const UNIT_MAP_PLURAL_TO_LONG: {
|
|
16
|
+
readonly years: "year";
|
|
17
|
+
readonly quarters: "quarter";
|
|
18
|
+
readonly months: "month";
|
|
19
|
+
readonly weeks: "week";
|
|
20
|
+
readonly isoWeeks: "isoWeek";
|
|
21
|
+
readonly dates: "date";
|
|
22
|
+
readonly days: "day";
|
|
23
|
+
readonly hours: "hour";
|
|
24
|
+
readonly minutes: "minute";
|
|
25
|
+
readonly seconds: "second";
|
|
26
|
+
readonly milliseconds: "millisecond";
|
|
27
|
+
};
|
|
28
|
+
declare const UNIT_MAP_LONG_TO_PLURAL: {
|
|
29
|
+
readonly year: "years";
|
|
30
|
+
readonly quarter: "quarters";
|
|
31
|
+
readonly month: "months";
|
|
32
|
+
readonly week: "weeks";
|
|
33
|
+
readonly isoWeek: "isoWeeks";
|
|
34
|
+
readonly date: "dates";
|
|
35
|
+
readonly day: "days";
|
|
36
|
+
readonly hour: "hours";
|
|
37
|
+
readonly minute: "minutes";
|
|
38
|
+
readonly second: "seconds";
|
|
39
|
+
readonly millisecond: "milliseconds";
|
|
40
|
+
};
|
|
41
|
+
type ShortUnit = keyof typeof UNIT_MAP_SHORT_TO_LONG;
|
|
42
|
+
type LongUnit = (typeof UNIT_MAP_SHORT_TO_LONG)[ShortUnit];
|
|
43
|
+
type LongUnitPlurals = `${(typeof UNIT_MAP_SHORT_TO_LONG)[ShortUnit]}${'s'}`;
|
|
44
|
+
type UnitType = ShortUnit | LongUnit;
|
|
45
|
+
type UnitTypePlurals = UnitType | LongUnitPlurals;
|
|
46
|
+
type UnitTypeCore = Exclude<UnitType, UnitWeek | UnitIsoWeek | UnitQuarter>;
|
|
47
|
+
type UnitTypeAddSub = Exclude<UnitTypePlurals, UnitIsoWeeks>;
|
|
48
|
+
type UnitTypeGetSet = Exclude<UnitTypePlurals, UnitIsoWeeks>;
|
|
49
|
+
type PrettyUnitAsSingular<T extends UnitType> = T extends ShortUnit ? (typeof UNIT_MAP_SHORT_TO_LONG)[T] : T;
|
|
50
|
+
type PrettyUnitFromPlurals<T extends UnitTypePlurals> = T extends ShortUnit ? `${(typeof UNIT_MAP_SHORT_TO_LONG)[T]}` : T extends LongUnitPlurals ? `${(typeof UNIT_MAP_PLURAL_TO_LONG)[T]}` : T;
|
|
51
|
+
type PrettyUnitAsPlural<T extends UnitTypePlurals> = T extends ShortUnit ? `${(typeof UNIT_MAP_SHORT_TO_LONG)[T]}s` : T extends LongUnit ? `${(typeof UNIT_MAP_LONG_TO_PLURAL)[T]}` : T;
|
|
52
|
+
type UnionUnitSingular<T extends ShortUnit> = T | PrettyUnitAsSingular<T>;
|
|
53
|
+
type UnionUnitPlural<T extends ShortUnit> = UnionUnitSingular<T> | PrettyUnitAsPlural<T>;
|
|
54
|
+
type UnitYear = UnionUnitSingular<'y'>;
|
|
55
|
+
type UnitYears = UnionUnitPlural<'y'>;
|
|
56
|
+
type UnitQuarter = UnionUnitSingular<'Q'>;
|
|
57
|
+
type UnitQuarters = UnionUnitPlural<'Q'>;
|
|
58
|
+
type UnitMonth = UnionUnitSingular<'M'>;
|
|
59
|
+
type UnitMonths = UnionUnitPlural<'M'>;
|
|
60
|
+
type UnitWeek = UnionUnitSingular<'w'>;
|
|
61
|
+
type UnitWeeks = UnionUnitPlural<'w'>;
|
|
62
|
+
type UnitIsoWeek = UnionUnitSingular<'W'>;
|
|
63
|
+
type UnitIsoWeeks = UnionUnitPlural<'W'>;
|
|
64
|
+
type UnitDate = UnionUnitSingular<'D'>;
|
|
65
|
+
type UnitDates = UnionUnitPlural<'D'>;
|
|
66
|
+
type UnitDay = UnionUnitSingular<'d'>;
|
|
67
|
+
type UnitDays = UnionUnitPlural<'d'>;
|
|
68
|
+
type UnitHour = UnionUnitSingular<'h'>;
|
|
69
|
+
type UnitHours = UnionUnitPlural<'h'>;
|
|
70
|
+
type UnitMin = UnionUnitSingular<'m'>;
|
|
71
|
+
type UnitMins = UnionUnitPlural<'m'>;
|
|
72
|
+
type UnitSecond = UnionUnitSingular<'s'>;
|
|
73
|
+
type UnitSeconds = UnionUnitPlural<'s'>;
|
|
74
|
+
type UnitMs = UnionUnitSingular<'ms'>;
|
|
75
|
+
type UnitMss = UnionUnitPlural<'ms'>;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/types/util-types.d.ts
|
|
78
|
+
type SimpleType = string | number | boolean | null | undefined;
|
|
79
|
+
type SimpleObject = Record<string, SimpleType | string[] | Record<string, SimpleType>>;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/types/core.d.ts
|
|
82
|
+
type EsDayFactoryParserFn = (d?: DateType, ...others: (SimpleType | string[] | {
|
|
83
|
+
[key: string]: SimpleType;
|
|
84
|
+
})[]) => EsDay;
|
|
85
|
+
interface EsDayFactory {
|
|
86
|
+
(...args: Parameters<EsDayFactoryParserFn>): ReturnType<EsDayFactoryParserFn>;
|
|
87
|
+
extend: <T extends {}>(plugin: EsDayPlugin<T>, option?: T) => EsDayFactory;
|
|
88
|
+
addFormatTokenDefinitions: (newTokens: FormattingTokenDefinitions) => void;
|
|
89
|
+
}
|
|
90
|
+
type EsDayPlugin<T extends {} = {}> = (option: Partial<T>, esdayClass: typeof EsDay, esday: EsDayFactory) => void;
|
|
91
|
+
type DateType = EsDay | Date | string | number | number[] | null | undefined | object;
|
|
92
|
+
type DateFromDateComponents = (Y: number | undefined, M: number | undefined, D: number | undefined, h: number | undefined, m: number | undefined, s: number | undefined, ms: number | undefined, offsetMs?: number) => Date;
|
|
93
|
+
type FormattingTokenDefinitions = Record<string, (sourceDate: EsDay, formatStr?: string) => string>;
|
|
94
|
+
type UnitsObjectTypeAddSub = {
|
|
95
|
+
years?: number;
|
|
96
|
+
quarters?: number;
|
|
97
|
+
months?: number;
|
|
98
|
+
weeks?: number;
|
|
99
|
+
days?: number;
|
|
100
|
+
hours?: number;
|
|
101
|
+
minutes?: number;
|
|
102
|
+
seconds?: number;
|
|
103
|
+
milliseconds?: number;
|
|
104
|
+
};
|
|
105
|
+
type UnitsObjectTypeSet = {
|
|
106
|
+
year?: number;
|
|
107
|
+
quarter?: number;
|
|
108
|
+
month?: number;
|
|
109
|
+
week?: number;
|
|
110
|
+
day?: number;
|
|
111
|
+
date?: number;
|
|
112
|
+
hour?: number;
|
|
113
|
+
minute?: number;
|
|
114
|
+
second?: number;
|
|
115
|
+
millisecond?: number;
|
|
116
|
+
};
|
|
117
|
+
type ParsingObjectShort = {
|
|
118
|
+
y?: number | string;
|
|
119
|
+
M?: number | string;
|
|
120
|
+
d?: number | string;
|
|
121
|
+
D?: number | string;
|
|
122
|
+
h?: number | string;
|
|
123
|
+
m?: number | string;
|
|
124
|
+
s?: number | string;
|
|
125
|
+
ms?: number | string;
|
|
126
|
+
};
|
|
127
|
+
type ParsingObjectLong = {
|
|
128
|
+
year?: number | string;
|
|
129
|
+
month?: number | string;
|
|
130
|
+
day?: number | string;
|
|
131
|
+
date?: number | string;
|
|
132
|
+
hour?: number | string;
|
|
133
|
+
minute?: number | string;
|
|
134
|
+
second?: number | string;
|
|
135
|
+
millisecond?: number | string;
|
|
136
|
+
};
|
|
137
|
+
type ParsingObjectPlurals = {
|
|
138
|
+
years?: number | string;
|
|
139
|
+
months?: number | string;
|
|
140
|
+
days?: number | string;
|
|
141
|
+
dates?: number | string;
|
|
142
|
+
hours?: number | string;
|
|
143
|
+
minutes?: number | string;
|
|
144
|
+
seconds?: number | string;
|
|
145
|
+
milliseconds?: number | string;
|
|
146
|
+
};
|
|
147
|
+
type ParsingObject = ParsingObjectShort | ParsingObjectLong | ParsingObjectPlurals;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/core/EsDay.d.ts
|
|
150
|
+
declare interface EsDay {
|
|
151
|
+
year: (() => number) & ((year: number, month?: number, date?: number) => EsDay);
|
|
152
|
+
month: (() => number) & ((month: number, date?: number) => EsDay);
|
|
153
|
+
date: (() => number) & ((date: number) => EsDay);
|
|
154
|
+
day: (() => number) & ((day: number) => EsDay);
|
|
155
|
+
hour: (() => number) & ((hours: number, min?: number, sec?: number, ms?: number) => EsDay);
|
|
156
|
+
minute: (() => number) & ((min: number, sec?: number, ms?: number) => EsDay);
|
|
157
|
+
second: (() => number) & ((sec: number, ms?: number) => EsDay);
|
|
158
|
+
millisecond: (() => number) & ((ms: number) => EsDay);
|
|
159
|
+
}
|
|
160
|
+
declare class EsDay {
|
|
161
|
+
#private;
|
|
162
|
+
protected $d: Date;
|
|
163
|
+
/**
|
|
164
|
+
* mainly for plugin compatibility
|
|
165
|
+
* store data such as locale name, utc mode, etc.
|
|
166
|
+
*/
|
|
167
|
+
private $conf;
|
|
168
|
+
constructor(d: Exclude<DateType, EsDay>, conf?: SimpleObject);
|
|
169
|
+
protected $parse(d: Exclude<DateType, EsDay>): void;
|
|
170
|
+
/**
|
|
171
|
+
* Create a Date object from the date components (year, month, ...).
|
|
172
|
+
* The month is 1 based (1..12).
|
|
173
|
+
* Potential hook for plugins to change the details of Date creation.
|
|
174
|
+
* @param Y - year of date to create
|
|
175
|
+
* @param M - year of date to create (1..12)
|
|
176
|
+
* @param D - year of date to create
|
|
177
|
+
* @param h - year of date to create
|
|
178
|
+
* @param m - year of date to create
|
|
179
|
+
* @param s - year of date to create
|
|
180
|
+
* @param ms - year of date to create
|
|
181
|
+
* @param offsetMs - offset from utc in milliseconds
|
|
182
|
+
* @returns Date object created from input parameters
|
|
183
|
+
*/
|
|
184
|
+
protected dateFromDateComponents(Y: number | undefined, M: number | undefined, D: number | undefined, h: number | undefined, m: number | undefined, s: number | undefined, ms: number | undefined, offsetMs?: number): Date;
|
|
185
|
+
isSame(that: DateType, units?: UnitType): boolean;
|
|
186
|
+
isAfter(that: DateType, units?: UnitType): boolean;
|
|
187
|
+
isBefore(that: DateType, units?: UnitType): boolean;
|
|
188
|
+
valueOf(): number;
|
|
189
|
+
unix(): number;
|
|
190
|
+
isValid(): boolean;
|
|
191
|
+
clone(): EsDay;
|
|
192
|
+
format(formatStr?: string): string;
|
|
193
|
+
startOf(units: UnitType): EsDay;
|
|
194
|
+
endOf(units: UnitType): EsDay;
|
|
195
|
+
add(value: number, unit: UnitTypeAddSub): EsDay;
|
|
196
|
+
add(value: UnitsObjectTypeAddSub): EsDay;
|
|
197
|
+
subtract(value: number, unit: UnitTypeAddSub): EsDay;
|
|
198
|
+
subtract(value: UnitsObjectTypeAddSub): EsDay;
|
|
199
|
+
diff(date: EsDay, units?: UnitTypeAddSub, asFloat?: boolean): number;
|
|
200
|
+
/**
|
|
201
|
+
* Get the utcOffset of date in minutes.
|
|
202
|
+
* "Proxy" implementation (getter only); the full functionality including
|
|
203
|
+
* the setters is implemented in the plugin Utc.
|
|
204
|
+
* @param offset - offset to be set
|
|
205
|
+
* @param keepLocalTime - keep the current time when setting the offset
|
|
206
|
+
* @returns utcOffset of date in minutes (getter) or invalid date (setter)
|
|
207
|
+
*/
|
|
208
|
+
utcOffset(): number;
|
|
209
|
+
utcOffset(offset: number | string): EsDay;
|
|
210
|
+
utcOffset(offset: number | string, keepLocalTime?: boolean): EsDay;
|
|
211
|
+
get(unit: UnitTypeGetSet): number;
|
|
212
|
+
set(unit: UnitYears, year: number, month?: number, date?: number): EsDay;
|
|
213
|
+
set(unit: UnitQuarters, quarter: number): EsDay;
|
|
214
|
+
set(unit: UnitMonths, month: number, date?: number): EsDay;
|
|
215
|
+
set(unit: UnitWeeks, week: number): EsDay;
|
|
216
|
+
set(unit: UnitDates, date: number): EsDay;
|
|
217
|
+
set(unit: UnitDays, day: number): EsDay;
|
|
218
|
+
set(unit: UnitHours, hours: number, min?: number, sec?: number, ms?: number): EsDay;
|
|
219
|
+
set(unit: UnitMins, min: number, sec?: number, ms?: number): EsDay;
|
|
220
|
+
set(unit: UnitSeconds, sec: number, ms?: number): EsDay;
|
|
221
|
+
set(unit: UnitMss, ms: number): EsDay;
|
|
222
|
+
set(unit: UnitTypeGetSet, ...values: number[]): EsDay;
|
|
223
|
+
set(unit: UnitsObjectTypeSet): EsDay;
|
|
224
|
+
toDate(): Date;
|
|
225
|
+
toJSON(): string | null;
|
|
226
|
+
toISOString(): string;
|
|
227
|
+
toString(): string;
|
|
228
|
+
protected $set(unit: UnitTypeGetSet | UnitsObjectTypeSet, values: number[]): this;
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
export { UnitQuarter as A, UnitDay as C, UnitMin as D, UnitIsoWeeks as E, UnitTypeGetSet as F, UnitTypePlurals as I, UnitWeek as L, UnitType as M, UnitTypeAddSub as N, UnitMonth as O, UnitTypeCore as P, UnitYear as R, UnitDates as S, UnitIsoWeek as T, PrettyUnitAsPlural as _, EsDayFactoryParserFn as a, ShortUnit as b, ParsingObject as c, ParsingObjectShort as d, UnitsObjectTypeAddSub as f, LongUnit as g, SimpleType as h, EsDayFactory as i, UnitSecond as j, UnitMs as k, ParsingObjectLong as l, SimpleObject as m, DateFromDateComponents as n, EsDayPlugin as o, UnitsObjectTypeSet as p, DateType as r, FormattingTokenDefinitions as s, EsDay as t, ParsingObjectPlurals as u, PrettyUnitAsSingular as v, UnitHour as w, UnitDate as x, PrettyUnitFromPlurals as y };
|