esday 0.0.1 → 0.0.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.
@@ -94,8 +94,8 @@ function startOf(date, unit, utc, reverse = false) {
94
94
  }
95
95
  }
96
96
 
97
- // src/core/Dayts.ts
98
- var Dayts = class _Dayts {
97
+ // src/core/EsDay.ts
98
+ var EsDay = class _EsDay {
99
99
  $d;
100
100
  $y;
101
101
  $M;
@@ -125,7 +125,7 @@ var Dayts = class _Dayts {
125
125
  }
126
126
  // return utc instance
127
127
  utc() {
128
- return new _Dayts({
128
+ return new _EsDay({
129
129
  d: this.$d,
130
130
  utc: true
131
131
  });
@@ -138,7 +138,7 @@ var Dayts = class _Dayts {
138
138
  return Math.floor(this.valueOf() / 1e3);
139
139
  }
140
140
  clone() {
141
- return new _Dayts({
141
+ return new _EsDay({
142
142
  d: new Date(this.$d),
143
143
  utc: this.$u
144
144
  });
@@ -193,22 +193,22 @@ function parseDate(date) {
193
193
  }
194
194
 
195
195
  // src/core/index.ts
196
- var dayts = (d) => {
197
- if (d instanceof Dayts) {
196
+ var esday = (d) => {
197
+ if (d instanceof EsDay) {
198
198
  return d;
199
199
  } else {
200
- return new Dayts({
200
+ return new EsDay({
201
201
  d: parseDate(d),
202
202
  utc: false
203
203
  });
204
204
  }
205
205
  };
206
- dayts.extend = (plugin, option) => {
206
+ esday.extend = (plugin, option) => {
207
207
  if (!plugin.$i) {
208
- plugin(option, Dayts, dayts);
208
+ plugin(option, EsDay, esday);
209
209
  plugin.$i = true;
210
210
  }
211
- return dayts;
211
+ return esday;
212
212
  };
213
213
 
214
- export { Dayts, dayts };
214
+ export { EsDay, esday };
package/package.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "esday",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "A simple date library fully written in TypeScript",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
8
- "main": "dist/index.js",
9
- "module": "dist/index.js",
10
- "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "default": "./index.js"
12
+ },
13
+ "./*": {
14
+ "types": "./*/index.d.ts",
15
+ "default": "./*/index.js"
16
+ }
17
+ },
18
+ "main": "index.js",
19
+ "module": "index.js",
20
+ "types": "index.d.ts",
11
21
  "typesVersions": {},
12
- "files": [
13
- "dist"
14
- ],
22
+ "files": [],
15
23
  "dependencies": {
16
24
  "radash": "^12.1.0"
17
25
  },
@@ -30,6 +38,7 @@
30
38
  "test": "vitest",
31
39
  "test:ui": "vitest --ui --api 9527",
32
40
  "test:run": "vitest run",
33
- "pub": "pnpm build && pnpm publish"
41
+ "copypkg": "node scripts/copy-pkg.mjs",
42
+ "pub": "pnpm build && pnpm copypkg && cd dist && pnpm publish"
34
43
  }
35
44
  }
package/dist/index.d.ts DELETED
@@ -1,39 +0,0 @@
1
- declare class Dayts {
2
- private $d;
3
- private $y;
4
- private $M;
5
- private $D;
6
- private $W;
7
- private $H;
8
- private $m;
9
- private $s;
10
- private $ms;
11
- private $u;
12
- constructor(cfg: {
13
- d: Date;
14
- utc: boolean;
15
- });
16
- init(): void;
17
- utc(): Dayts;
18
- valueOf(): number;
19
- unix(): number;
20
- clone(): Dayts;
21
- format(formatStr: string): string;
22
- startOf(units: UnitType): Dayts;
23
- endOf(units: UnitType): Dayts;
24
- set(units: UnitType, value: number): Dayts;
25
- private $set;
26
- }
27
-
28
- type DateType = Date | string | number | Dayts;
29
- type PrettyUnitType = 'date' | 'day' | 'week' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'millisecond';
30
- type UnitType = 'y' | 'M' | 'D' | 'W' | 'H' | 'm' | 's' | 'ms' | PrettyUnitType;
31
- interface DaytsFactory {
32
- (d?: DateType): Dayts;
33
- extend: (plugin: DaytsPlugin, option?: any) => DaytsFactory;
34
- }
35
- type DaytsPlugin = (option: any, dayTsClass: typeof Dayts, dayts: DaytsFactory) => void;
36
-
37
- declare const dayts: DaytsFactory;
38
-
39
- export { type DateType, Dayts, type DaytsFactory, type DaytsPlugin, type PrettyUnitType, type UnitType, dayts };