esday 1.0.0 → 1.0.1
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 +5 -0
- package/README.md +16 -8
- package/chunks/{DuP2qVZn.d.ts → BB5OVV-y.d.ts} +1 -1
- package/chunks/{Dc43cziu.d.ts → CBlQG2yl.d.ts} +1 -2
- package/chunks/{CNIy0PdR.js → DIG_UBsE.js} +2 -1
- package/chunks/{D2Xh96oz.js → oiGWnahC.js} +6 -5
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/locales/af.d.ts +0 -1
- package/locales/am.d.ts +0 -1
- package/locales/ar-dz.d.ts +0 -1
- package/locales/ar-iq.d.ts +0 -1
- package/locales/ar-kw.d.ts +0 -1
- package/locales/ar-ly.d.ts +0 -1
- package/locales/ar-ma.d.ts +0 -1
- package/locales/ar-sa.d.ts +0 -1
- package/locales/ar-tn.d.ts +0 -1
- package/locales/ar.d.ts +0 -1
- package/locales/az.d.ts +0 -1
- package/locales/be.d.ts +0 -1
- package/locales/bg.d.ts +0 -1
- package/locales/bi.d.ts +0 -1
- package/locales/bm.d.ts +0 -1
- package/locales/bn-bd.d.ts +0 -1
- package/locales/bn.d.ts +0 -1
- package/locales/bo.d.ts +0 -1
- package/locales/br.d.ts +0 -1
- package/locales/bs.d.ts +0 -1
- package/locales/ca.d.ts +0 -1
- package/locales/cs.d.ts +0 -1
- package/locales/cv.d.ts +0 -1
- package/locales/cy.d.ts +0 -1
- package/locales/da.d.ts +0 -1
- package/locales/de-at.d.ts +0 -1
- package/locales/de-ch.d.ts +0 -1
- package/locales/de.d.ts +0 -1
- package/locales/dv.d.ts +0 -1
- package/locales/el.d.ts +0 -1
- package/locales/en-au.d.ts +0 -1
- package/locales/en-ca.d.ts +0 -1
- package/locales/en-gb.d.ts +0 -1
- package/locales/en-ie.d.ts +0 -1
- package/locales/en-il.d.ts +0 -1
- package/locales/en-in.d.ts +0 -1
- package/locales/en-nz.d.ts +0 -1
- package/locales/en-sg.d.ts +0 -1
- package/locales/en-tt.d.ts +0 -1
- package/locales/en-us.d.ts +0 -1
- package/locales/en.d.ts +0 -1
- package/locales/eo.d.ts +0 -1
- package/locales/es-do.d.ts +0 -1
- package/locales/es-mx.d.ts +0 -1
- package/locales/es-pr.d.ts +0 -1
- package/locales/es-us.d.ts +0 -1
- package/locales/es.d.ts +0 -1
- package/locales/et.d.ts +0 -1
- package/locales/eu.d.ts +0 -1
- package/locales/fa.d.ts +0 -1
- package/locales/fi.d.ts +0 -1
- package/locales/fil.d.ts +0 -1
- package/locales/fo.d.ts +0 -1
- package/locales/fr-ca.d.ts +0 -1
- package/locales/fr-ch.d.ts +0 -1
- package/locales/fr.d.ts +0 -1
- package/locales/fy.d.ts +0 -1
- package/locales/ga.d.ts +0 -1
- package/locales/gd.d.ts +0 -1
- package/locales/gl.d.ts +0 -1
- package/locales/gom-deva.d.ts +0 -1
- package/locales/gom-latn.d.ts +0 -1
- package/locales/gu.d.ts +0 -1
- package/locales/he.d.ts +0 -1
- package/locales/he.js +2 -1
- package/locales/hi.d.ts +0 -1
- package/locales/hr.d.ts +0 -1
- package/locales/ht.d.ts +0 -1
- package/locales/hu.d.ts +0 -1
- package/locales/hy-am.d.ts +0 -1
- package/locales/id.d.ts +0 -1
- package/locales/is.d.ts +0 -1
- package/locales/it-ch.d.ts +0 -1
- package/locales/it.d.ts +0 -1
- package/locales/ja.d.ts +0 -1
- package/locales/jv.d.ts +0 -1
- package/locales/ka.d.ts +0 -1
- package/locales/kk.d.ts +0 -1
- package/locales/km.d.ts +0 -1
- package/locales/kn.d.ts +0 -1
- package/locales/ko.d.ts +0 -1
- package/locales/ku.d.ts +0 -1
- package/locales/ky.d.ts +0 -1
- package/locales/lb.d.ts +0 -1
- package/locales/lo.d.ts +0 -1
- package/locales/lt.d.ts +0 -1
- package/locales/lv.d.ts +0 -1
- package/locales/me.d.ts +0 -1
- package/locales/mi.d.ts +0 -1
- package/locales/mk.d.ts +0 -1
- package/locales/ml.d.ts +0 -1
- package/locales/mn.d.ts +0 -1
- package/locales/mr.d.ts +0 -1
- package/locales/ms-my.d.ts +0 -1
- package/locales/ms.d.ts +0 -1
- package/locales/mt.d.ts +0 -1
- package/locales/my.d.ts +0 -1
- package/locales/nb.d.ts +0 -1
- package/locales/ne.d.ts +0 -1
- package/locales/nl-be.d.ts +0 -1
- package/locales/nl.d.ts +0 -1
- package/locales/nn.d.ts +0 -1
- package/locales/oc-lnc.d.ts +0 -1
- package/locales/pa-in.d.ts +0 -1
- package/locales/pl.d.ts +0 -1
- package/locales/pt-br.d.ts +0 -1
- package/locales/pt.d.ts +0 -1
- package/locales/rn.d.ts +0 -1
- package/locales/ro.d.ts +0 -1
- package/locales/ru.d.ts +0 -1
- package/locales/rw.d.ts +0 -1
- package/locales/sd.d.ts +0 -1
- package/locales/se.d.ts +0 -1
- package/locales/si.d.ts +0 -1
- package/locales/sk.d.ts +0 -1
- package/locales/sl.d.ts +0 -1
- package/locales/sq.d.ts +0 -1
- package/locales/sr-cyrl.d.ts +0 -1
- package/locales/sr.d.ts +0 -1
- package/locales/ss.d.ts +0 -1
- package/locales/sv-fi.d.ts +0 -1
- package/locales/sv.d.ts +0 -1
- package/locales/sw.d.ts +0 -1
- package/locales/ta.d.ts +0 -1
- package/locales/te.d.ts +0 -1
- package/locales/tet.d.ts +0 -1
- package/locales/tg.d.ts +0 -1
- package/locales/th.d.ts +0 -1
- package/locales/tk.d.ts +0 -1
- package/locales/tl-ph.d.ts +0 -1
- package/locales/tlh.d.ts +0 -1
- package/locales/tr.d.ts +0 -1
- package/locales/tzl.d.ts +0 -1
- package/locales/tzm-latn.d.ts +0 -1
- package/locales/tzm.d.ts +0 -1
- package/locales/ug-cn.d.ts +0 -1
- package/locales/uk.d.ts +0 -1
- package/locales/ur.d.ts +0 -1
- package/locales/uz-latn.d.ts +0 -1
- package/locales/uz.d.ts +0 -1
- package/locales/vi.d.ts +0 -1
- package/locales/x-pseudo.d.ts +0 -1
- package/locales/yo.d.ts +0 -1
- package/locales/zh-cn.d.ts +0 -1
- package/locales/zh-hk.d.ts +0 -1
- package/locales/zh-mo.d.ts +0 -1
- package/locales/zh-tw.d.ts +0 -1
- package/locales/zh.d.ts +0 -1
- package/package.json +18 -18
- package/plugins/advancedFormat/index.d.ts +1 -2
- package/plugins/advancedParse/index.d.ts +1 -2
- package/plugins/calendar/index.d.ts +1 -2
- package/plugins/dayOfYear/index.d.ts +1 -2
- package/plugins/duration/index.d.ts +1 -2
- package/plugins/duration/index.js +7 -6
- package/plugins/isBetween/index.d.ts +1 -2
- package/plugins/isLeapYear/index.d.ts +1 -2
- package/plugins/isSameOrAfter/index.d.ts +1 -2
- package/plugins/isSameOrBefore/index.d.ts +1 -2
- package/plugins/isToday/index.d.ts +1 -2
- package/plugins/isTomorrow/index.d.ts +1 -2
- package/plugins/isYesterday/index.d.ts +1 -2
- package/plugins/isoWeek/index.d.ts +1 -2
- package/plugins/locale/index.d.ts +1 -2
- package/plugins/locale/index.js +4 -2
- package/plugins/localeData/index.d.ts +1 -2
- package/plugins/localeData/index.js +5 -3
- package/plugins/localizedFormat/index.d.ts +1 -2
- package/plugins/localizedParse/index.d.ts +1 -2
- package/plugins/localizedParse/index.js +2 -1
- package/plugins/minMax/index.d.ts +1 -2
- package/plugins/objectSupport/index.d.ts +1 -2
- package/plugins/pluralGetSet/index.d.ts +1 -2
- package/plugins/quarterOfYear/index.d.ts +1 -2
- package/plugins/relativeTime/index.d.ts +1 -2
- package/plugins/timezone/index.d.ts +1 -2
- package/plugins/timezone/index.js +1 -1
- package/plugins/toArray/index.d.ts +1 -2
- package/plugins/toObject/index.d.ts +1 -2
- package/plugins/utc/index.d.ts +1 -2
- package/plugins/utc/index.js +1 -1
- package/plugins/week/index.d.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
## [1.0.1](https://github.com/BePo65/esday/compare/v1.0.0...v1.0.1) (2026-07-30)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* allow other types beside EsDay as first argument to diff() ([198f9da](https://github.com/BePo65/esday/commit/198f9dab0453ce6e60ec9071629197f209f36fd9))
|
|
5
10
|
## [1.0.0](https://github.com/BePo65/esday/compare/v0.6.3...v1.0.0) (2026-06-04)
|
|
6
11
|
|
|
7
12
|
## [0.6.3](https://github.com/BePo65/esday/compare/v0.6.2...v0.6.3) (2026-03-08)
|
package/README.md
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
# EsDay
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/esday)
|
|
4
4
|
[](https://github.com/kessler/license-report/blob/master/LICENSE)
|
|
5
5
|
[](https://github.com/BePo65/esday?tab=readme-ov-file#contribute)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Repository changing ownership
|
|
8
8
|
|
|
9
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
10
|
|
|
11
|
-
|
|
11
|
+
## Concepts
|
|
12
|
+
|
|
13
|
+
EsDay is a JavaScript library inspired by [Day.js](https://github.com/iamkun/dayjs).
|
|
14
|
+
|
|
15
|
+
Esday has an API largely similar to Day.js (v1.11.13), but it is written in TypeScript and fully supports es modules.
|
|
16
|
+
|
|
17
|
+
Being compatible to Day.js, EsDay is also a good replacement for Moment.js.
|
|
18
|
+
|
|
19
|
+
**Highlights**
|
|
20
|
+
|
|
21
|
+
- **Modern API**: Provides the same API as Day.js, with some features moved to plugins for a simpler core.
|
|
22
|
+
- **Immutable**: esday is immutable, which means that all operations will return a new instance of esday.
|
|
23
|
+
|
|
24
|
+
## Basic use
|
|
12
25
|
|
|
13
26
|
```javascript
|
|
14
27
|
import { esday } from 'esday'
|
|
@@ -21,11 +34,6 @@ esday('2024-12-10').set('year', 2025).add(1, 'month').isToday()
|
|
|
21
34
|
|
|
22
35
|
For detailed information see the [full documentation](https://bepo65.github.io/esday/).
|
|
23
36
|
|
|
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
37
|
## Differences to Day.js
|
|
30
38
|
|
|
31
39
|
- **Locale is a Plugin**: no default locale!
|
|
@@ -201,7 +201,7 @@ declare class EsDay {
|
|
|
201
201
|
add(value: UnitsObjectTypeAddSub): EsDay;
|
|
202
202
|
subtract(value: number, unit: UnitTypeAddSub): EsDay;
|
|
203
203
|
subtract(value: UnitsObjectTypeAddSub): EsDay;
|
|
204
|
-
diff(date:
|
|
204
|
+
diff(date: DateType, units?: UnitTypeAddSub, asFloat?: boolean): number;
|
|
205
205
|
/**
|
|
206
206
|
* Get the utcOffset of date in minutes.
|
|
207
207
|
* "Proxy" implementation (getter only); the full functionality including
|
|
@@ -16,7 +16,8 @@ const UNIT_FIELD_MAP = {
|
|
|
16
16
|
};
|
|
17
17
|
const prettyUnitsDate = Object.keys(UNIT_FIELD_MAP);
|
|
18
18
|
function unitToField(unit) {
|
|
19
|
-
|
|
19
|
+
const p = normalizeUnitWithPlurals(unit);
|
|
20
|
+
return UNIT_FIELD_MAP[p];
|
|
20
21
|
}
|
|
21
22
|
function getUnitInDate(date, unit) {
|
|
22
23
|
return date[`get${unitToField(unit)}`]();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as constants_default } from "./CeKusvtV.js";
|
|
2
2
|
import { a as isUndefined, n as isEmptyObject, o as isValidDate, r as isObject, t as isArray } from "./DuRKUq5K.js";
|
|
3
3
|
import { n as normalizeUnitWithPlurals, t as normalizeUnit } from "./DMdr1ZL1.js";
|
|
4
|
-
import { i as setUnitInDate, r as prettyUnitsDate, t as getUnitInDate } from "./
|
|
4
|
+
import { i as setUnitInDate, r as prettyUnitsDate, t as getUnitInDate } from "./DIG_UBsE.js";
|
|
5
5
|
import { t as createInstanceFromExist } from "./i3oEJgL3.js";
|
|
6
6
|
import { n as padStart, r as padZoneStr } from "./DXFoLbHM.js";
|
|
7
7
|
//#region src/core/Impl/add.ts
|
|
@@ -225,17 +225,17 @@ function startOfImpl(that, unit, reverse = false) {
|
|
|
225
225
|
return result;
|
|
226
226
|
}
|
|
227
227
|
//#endregion
|
|
228
|
-
//#region \0@oxc-project+runtime@0.
|
|
228
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/checkPrivateRedeclaration.js
|
|
229
229
|
function _checkPrivateRedeclaration(e, t) {
|
|
230
230
|
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
231
231
|
}
|
|
232
232
|
//#endregion
|
|
233
|
-
//#region \0@oxc-project+runtime@0.
|
|
233
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
234
234
|
function _classPrivateMethodInitSpec(e, a) {
|
|
235
235
|
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
236
236
|
}
|
|
237
237
|
//#endregion
|
|
238
|
-
//#region \0@oxc-project+runtime@0.
|
|
238
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/assertClassBrand.js
|
|
239
239
|
function _assertClassBrand(e, t, n) {
|
|
240
240
|
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
241
241
|
throw new TypeError("Private element is not present on this object");
|
|
@@ -333,7 +333,8 @@ var EsDay = class EsDay {
|
|
|
333
333
|
return this.clone();
|
|
334
334
|
}
|
|
335
335
|
diff(date, units, asFloat = false) {
|
|
336
|
-
|
|
336
|
+
const parsedDate = esday(date);
|
|
337
|
+
return diffImpl(this, parsedDate, units, asFloat);
|
|
337
338
|
}
|
|
338
339
|
utcOffset(offset, _keepLocalTime) {
|
|
339
340
|
if (offset !== void 0) return new EsDay(constants_default.INVALID_DATE);
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as UnitMs, E as UnitIsoWeek, F as UnitTypeCore, I as UnitTypeGetSet, M as UnitSecond, N as UnitType, O as UnitMin, P as UnitTypeAddSub, R as UnitWeek, S as UnitDate, T as UnitHour, _ as LongUnit, a as EsDayFactory, b as PrettyUnitFromPlurals, c as FormattingTokenDefinitions, d as ParsingObjectPlurals, f as ParsingObjectShort, g as SimpleType, h as SimpleObject, i as DateType, j as UnitQuarter, k as UnitMonth, l as ParsingObject, m as UnitsObjectTypeSet, n as ConfigurationObject, o as EsDayFactoryParserFn, p as UnitsObjectTypeAddSub, r as DateFromDateComponents, s as EsDayPlugin, t as EsDay, u as ParsingObjectLong, v as PrettyUnitAsPlural, w as UnitDay, x as ShortUnit, y as PrettyUnitAsSingular, z as UnitYear } from "./chunks/
|
|
2
|
-
import { t as esday } from "./chunks/
|
|
1
|
+
import { A as UnitMs, E as UnitIsoWeek, F as UnitTypeCore, I as UnitTypeGetSet, M as UnitSecond, N as UnitType, O as UnitMin, P as UnitTypeAddSub, R as UnitWeek, S as UnitDate, T as UnitHour, _ as LongUnit, a as EsDayFactory, b as PrettyUnitFromPlurals, c as FormattingTokenDefinitions, d as ParsingObjectPlurals, f as ParsingObjectShort, g as SimpleType, h as SimpleObject, i as DateType, j as UnitQuarter, k as UnitMonth, l as ParsingObject, m as UnitsObjectTypeSet, n as ConfigurationObject, o as EsDayFactoryParserFn, p as UnitsObjectTypeAddSub, r as DateFromDateComponents, s as EsDayPlugin, t as EsDay, u as ParsingObjectLong, v as PrettyUnitAsPlural, w as UnitDay, x as ShortUnit, y as PrettyUnitAsSingular, z as UnitYear } from "./chunks/BB5OVV-y.js";
|
|
2
|
+
import { t as esday } from "./chunks/CBlQG2yl.js";
|
|
3
3
|
export { ConfigurationObject, DateFromDateComponents, DateType, EsDay, EsDayFactory, EsDayFactoryParserFn, EsDayPlugin, FormattingTokenDefinitions, type LongUnit, ParsingObject, ParsingObjectLong, ParsingObjectPlurals, ParsingObjectShort, type PrettyUnitAsPlural, type PrettyUnitAsSingular, type PrettyUnitFromPlurals, type ShortUnit, type SimpleObject, type SimpleType, type UnitDate, type UnitDay, type UnitHour, type UnitIsoWeek, type UnitMin, type UnitMonth, type UnitMs, type UnitQuarter, type UnitSecond, type UnitType, type UnitTypeAddSub, type UnitTypeCore, type UnitTypeGetSet, type UnitWeek, type UnitYear, UnitsObjectTypeAddSub, UnitsObjectTypeSet, esday };
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EsDay, t as esday } from "./chunks/
|
|
1
|
+
import { n as EsDay, t as esday } from "./chunks/oiGWnahC.js";
|
|
2
2
|
export { EsDay, esday };
|
package/locales/af.d.ts
CHANGED
package/locales/am.d.ts
CHANGED
package/locales/ar-dz.d.ts
CHANGED
package/locales/ar-iq.d.ts
CHANGED
package/locales/ar-kw.d.ts
CHANGED
package/locales/ar-ly.d.ts
CHANGED
package/locales/ar-ma.d.ts
CHANGED
package/locales/ar-sa.d.ts
CHANGED
package/locales/ar-tn.d.ts
CHANGED
package/locales/ar.d.ts
CHANGED
package/locales/az.d.ts
CHANGED
package/locales/be.d.ts
CHANGED
package/locales/bg.d.ts
CHANGED
package/locales/bi.d.ts
CHANGED
package/locales/bm.d.ts
CHANGED
package/locales/bn-bd.d.ts
CHANGED
package/locales/bn.d.ts
CHANGED
package/locales/bo.d.ts
CHANGED
package/locales/br.d.ts
CHANGED
package/locales/bs.d.ts
CHANGED
package/locales/ca.d.ts
CHANGED
package/locales/cs.d.ts
CHANGED
package/locales/cv.d.ts
CHANGED
package/locales/cy.d.ts
CHANGED
package/locales/da.d.ts
CHANGED
package/locales/de-at.d.ts
CHANGED
package/locales/de-ch.d.ts
CHANGED
package/locales/de.d.ts
CHANGED
package/locales/dv.d.ts
CHANGED
package/locales/el.d.ts
CHANGED
package/locales/en-au.d.ts
CHANGED
package/locales/en-ca.d.ts
CHANGED
package/locales/en-gb.d.ts
CHANGED
package/locales/en-ie.d.ts
CHANGED
package/locales/en-il.d.ts
CHANGED
package/locales/en-in.d.ts
CHANGED
package/locales/en-nz.d.ts
CHANGED
package/locales/en-sg.d.ts
CHANGED
package/locales/en-tt.d.ts
CHANGED
package/locales/en-us.d.ts
CHANGED
package/locales/en.d.ts
CHANGED
package/locales/eo.d.ts
CHANGED
package/locales/es-do.d.ts
CHANGED
package/locales/es-mx.d.ts
CHANGED
package/locales/es-pr.d.ts
CHANGED
package/locales/es-us.d.ts
CHANGED
package/locales/es.d.ts
CHANGED
package/locales/et.d.ts
CHANGED
package/locales/eu.d.ts
CHANGED
package/locales/fa.d.ts
CHANGED
package/locales/fi.d.ts
CHANGED
package/locales/fil.d.ts
CHANGED
package/locales/fo.d.ts
CHANGED
package/locales/fr-ca.d.ts
CHANGED
package/locales/fr-ch.d.ts
CHANGED
package/locales/fr.d.ts
CHANGED
package/locales/fy.d.ts
CHANGED
package/locales/ga.d.ts
CHANGED
package/locales/gd.d.ts
CHANGED
package/locales/gl.d.ts
CHANGED
package/locales/gom-deva.d.ts
CHANGED
package/locales/gom-latn.d.ts
CHANGED
package/locales/gu.d.ts
CHANGED
package/locales/he.d.ts
CHANGED
package/locales/he.js
CHANGED
|
@@ -21,7 +21,8 @@ const relativeTimeFormatStrings = {
|
|
|
21
21
|
yy2: "שנתיים"
|
|
22
22
|
};
|
|
23
23
|
const relativeTimeFormatter = (timeValue, _withoutSuffix, token, _isFuture) => {
|
|
24
|
-
|
|
24
|
+
const formatStringsIndex = token + (+timeValue === 2 ? "2" : "");
|
|
25
|
+
return (relativeTimeFormatStrings[formatStringsIndex] ?? relativeTimeFormatStrings[token]).replace("%d", timeValue.toString());
|
|
25
26
|
};
|
|
26
27
|
const localeHe = {
|
|
27
28
|
name: "he",
|
package/locales/hi.d.ts
CHANGED