@bemoje/date 1.1.1 → 1.1.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.
Files changed (60) hide show
  1. package/README.md +22 -21
  2. package/lib/index.d.cts +90 -14
  3. package/lib/index.d.ts +90 -14
  4. package/package.json +22 -208
  5. package/lib/Timer.cjs +0 -21
  6. package/lib/Timer.d.cts +0 -6
  7. package/lib/Timer.d.ts +0 -6
  8. package/lib/Timer.js +0 -19
  9. package/lib/dateString.cjs +0 -12
  10. package/lib/dateString.d.cts +0 -6
  11. package/lib/dateString.d.ts +0 -6
  12. package/lib/dateString.js +0 -10
  13. package/lib/daysToMs.cjs +0 -12
  14. package/lib/daysToMs.d.cts +0 -6
  15. package/lib/daysToMs.d.ts +0 -6
  16. package/lib/daysToMs.js +0 -10
  17. package/lib/getWeek.cjs +0 -15
  18. package/lib/getWeek.d.cts +0 -6
  19. package/lib/getWeek.d.ts +0 -6
  20. package/lib/getWeek.js +0 -13
  21. package/lib/hasCooldownElapsed.cjs +0 -13
  22. package/lib/hasCooldownElapsed.d.cts +0 -10
  23. package/lib/hasCooldownElapsed.d.ts +0 -10
  24. package/lib/hasCooldownElapsed.js +0 -11
  25. package/lib/hoursToMs.cjs +0 -12
  26. package/lib/hoursToMs.d.cts +0 -6
  27. package/lib/hoursToMs.d.ts +0 -6
  28. package/lib/hoursToMs.js +0 -10
  29. package/lib/minutesToMs.cjs +0 -12
  30. package/lib/minutesToMs.d.cts +0 -6
  31. package/lib/minutesToMs.d.ts +0 -6
  32. package/lib/minutesToMs.js +0 -10
  33. package/lib/monthNameDa.cjs +0 -30
  34. package/lib/monthNameDa.d.cts +0 -14
  35. package/lib/monthNameDa.d.ts +0 -14
  36. package/lib/monthNameDa.js +0 -28
  37. package/lib/monthNameDaRelative.cjs +0 -38
  38. package/lib/monthNameDaRelative.d.cts +0 -13
  39. package/lib/monthNameDaRelative.d.ts +0 -13
  40. package/lib/monthNameDaRelative.js +0 -36
  41. package/lib/msSinceDate.cjs +0 -12
  42. package/lib/msSinceDate.d.cts +0 -6
  43. package/lib/msSinceDate.d.ts +0 -6
  44. package/lib/msSinceDate.js +0 -10
  45. package/lib/secondsToMs.cjs +0 -12
  46. package/lib/secondsToMs.d.cts +0 -6
  47. package/lib/secondsToMs.d.ts +0 -6
  48. package/lib/secondsToMs.js +0 -10
  49. package/lib/stripTime.cjs +0 -12
  50. package/lib/stripTime.d.cts +0 -6
  51. package/lib/stripTime.d.ts +0 -6
  52. package/lib/stripTime.js +0 -10
  53. package/lib/today.cjs +0 -18
  54. package/lib/today.d.cts +0 -6
  55. package/lib/today.d.ts +0 -6
  56. package/lib/today.js +0 -16
  57. package/lib/yesterday.cjs +0 -26
  58. package/lib/yesterday.d.cts +0 -6
  59. package/lib/yesterday.d.ts +0 -6
  60. package/lib/yesterday.js +0 -24
package/README.md CHANGED
@@ -2,8 +2,28 @@
2
2
 
3
3
  Lightweight date and time utilities for formatting, time-unit conversion, and duration measurement.
4
4
 
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
6
- [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/) [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
6
+
7
+ ## Exports
8
+
9
+ <!-- EXPORTS_START -->
10
+
11
+ - **Timer**: Returns a function that returns the elapsed time since invokation.
12
+ - **dateString**: Reutnrs the date formatted as: yyyy-MM-dd
13
+ - **daysToMs**: Converts days to milliseconds.
14
+ - **getWeek**: Get the week number of the year for a given date using Danish locale.
15
+ - **hasCooldownElapsed**: Determines if a specified cooldown period has elapsed since a given date.
16
+ - **hoursToMs**: Converts hours to milliseconds.
17
+ - **minutesToMs**: Converts minutes to milliseconds.
18
+ - **monthNameDa**: Returns the name, in Danish language, of the month corresponding to the provided month number.
19
+ - **monthNameDaRelative** name of the month relative to the current month.
20
+ - **msSinceDate**: Calculates the number of milliseconds that have elapsed since the given date.
21
+ - **secondsToMs**: Converts seconds to milliseconds.
22
+ - **stripTime**: Remove the time component from a date, returning only the date part.
23
+ - **today**: Get the UTC date today, time stripped
24
+ - **yesterday**: Get the UTC date yesterday, time stripped
25
+
26
+ <!-- EXPORTS_END -->
7
27
 
8
28
  ## Installation
9
29
 
@@ -87,22 +107,3 @@ monthNameDa(new Date('2026-03-15'))
87
107
  monthNameDaRelative(new Date())
88
108
  // => relative month name in Danish
89
109
  ```
90
-
91
- ## API Reference
92
-
93
- | Export | Description |
94
- | --------------------- | -------------------------------------------- |
95
- | `dateString` | Format date as `yyyy-MM-dd` |
96
- | `today` | Today's date with time stripped |
97
- | `yesterday` | Yesterday's date |
98
- | `stripTime` | Remove time component from a Date |
99
- | `getWeek` | ISO week number |
100
- | `msSinceDate` | Milliseconds elapsed since a date |
101
- | `hasCooldownElapsed` | Check if a cooldown period has passed |
102
- | `Timer` | Returns a function that reports elapsed time |
103
- | `daysToMs` | Convert days to milliseconds |
104
- | `hoursToMs` | Convert hours to milliseconds |
105
- | `minutesToMs` | Convert minutes to milliseconds |
106
- | `secondsToMs` | Convert seconds to milliseconds |
107
- | `monthNameDa` | Danish month name |
108
- | `monthNameDaRelative` | Relative Danish month name |
package/lib/index.d.cts CHANGED
@@ -1,14 +1,90 @@
1
- export { Timer } from './Timer.cjs';
2
- export { dateString } from './dateString.cjs';
3
- export { daysToMs } from './daysToMs.cjs';
4
- export { getWeek } from './getWeek.cjs';
5
- export { hasCooldownElapsed } from './hasCooldownElapsed.cjs';
6
- export { hoursToMs } from './hoursToMs.cjs';
7
- export { minutesToMs } from './minutesToMs.cjs';
8
- export { monthNameDa } from './monthNameDa.cjs';
9
- export { monthNameDaRelative } from './monthNameDaRelative.cjs';
10
- export { msSinceDate } from './msSinceDate.cjs';
11
- export { secondsToMs } from './secondsToMs.cjs';
12
- export { stripTime } from './stripTime.cjs';
13
- export { today } from './today.cjs';
14
- export { yesterday } from './yesterday.cjs';
1
+ /**
2
+ * Returns a function that returns the elapsed time since invokation.
3
+ */
4
+ declare function Timer(startTime?: number): (endTime?: number) => string;
5
+
6
+ /**
7
+ * Reutnrs the date formatted as: yyyy-MM-dd
8
+ */
9
+ declare function dateString(date?: Date | number | string): string;
10
+
11
+ /**
12
+ * Converts days to milliseconds.
13
+ */
14
+ declare function daysToMs(days: number): number;
15
+
16
+ /**
17
+ * Get the week number of the year for a given date using Danish locale.
18
+ */
19
+ declare function getWeek(date: Date): number;
20
+
21
+ /**
22
+ * Determines if a specified cooldown period has elapsed since a given date.
23
+ *
24
+ * @param startDate - The starting date to calculate elapsed time from.
25
+ * @param cooldownMs - The cooldown duration in milliseconds.
26
+ * @returns `true` if the cooldown period has elapsed, otherwise `false`.
27
+ */
28
+ declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
29
+
30
+ /**
31
+ * Converts hours to milliseconds.
32
+ */
33
+ declare function hoursToMs(hours: number): number;
34
+
35
+ /**
36
+ * Converts minutes to milliseconds.
37
+ */
38
+ declare function minutesToMs(minutes: number): number;
39
+
40
+ /**
41
+ * Returns the name, in Danish language, of the month corresponding to the provided month number.
42
+ *
43
+ * @param month - A month number between 1 and 12.
44
+ *
45
+ * @throws if the provided month number is not a valid month.
46
+ *
47
+ * @example ```ts
48
+ * monthNameDA(9) //=> 'September'
49
+ * ```
50
+ */
51
+ declare function monthNameDa(month: number): string;
52
+
53
+ /**
54
+ * Get the (Danish) name of the month relative to the current month.
55
+ *
56
+ * @example ```ts
57
+ * // assuming current month is August
58
+ * monthNameDaRelative(-1) //=> 'Juli'
59
+ * monthNameDaRelative(0) //=> 'August'
60
+ * monthNameDaRelative(1) //=> 'September'
61
+ * ```
62
+ */
63
+ declare function monthNameDaRelative(n: number): string;
64
+
65
+ /**
66
+ * Calculates the number of milliseconds that have elapsed since the given date.
67
+ */
68
+ declare function msSinceDate(date: Date | string | number): number;
69
+
70
+ /**
71
+ * Converts seconds to milliseconds.
72
+ */
73
+ declare function secondsToMs(seconds: number): number;
74
+
75
+ /**
76
+ * Remove the time component from a date, returning only the date part.
77
+ */
78
+ declare function stripTime(date: Date): Date;
79
+
80
+ /**
81
+ * Get the UTC date today, time stripped
82
+ */
83
+ declare function today(): Date;
84
+
85
+ /**
86
+ * Get the UTC date yesterday, time stripped
87
+ */
88
+ declare function yesterday(): Date;
89
+
90
+ export { Timer, dateString, daysToMs, getWeek, hasCooldownElapsed, hoursToMs, minutesToMs, monthNameDa, monthNameDaRelative, msSinceDate, secondsToMs, stripTime, today, yesterday };
package/lib/index.d.ts CHANGED
@@ -1,14 +1,90 @@
1
- export { Timer } from './Timer.js';
2
- export { dateString } from './dateString.js';
3
- export { daysToMs } from './daysToMs.js';
4
- export { getWeek } from './getWeek.js';
5
- export { hasCooldownElapsed } from './hasCooldownElapsed.js';
6
- export { hoursToMs } from './hoursToMs.js';
7
- export { minutesToMs } from './minutesToMs.js';
8
- export { monthNameDa } from './monthNameDa.js';
9
- export { monthNameDaRelative } from './monthNameDaRelative.js';
10
- export { msSinceDate } from './msSinceDate.js';
11
- export { secondsToMs } from './secondsToMs.js';
12
- export { stripTime } from './stripTime.js';
13
- export { today } from './today.js';
14
- export { yesterday } from './yesterday.js';
1
+ /**
2
+ * Returns a function that returns the elapsed time since invokation.
3
+ */
4
+ declare function Timer(startTime?: number): (endTime?: number) => string;
5
+
6
+ /**
7
+ * Reutnrs the date formatted as: yyyy-MM-dd
8
+ */
9
+ declare function dateString(date?: Date | number | string): string;
10
+
11
+ /**
12
+ * Converts days to milliseconds.
13
+ */
14
+ declare function daysToMs(days: number): number;
15
+
16
+ /**
17
+ * Get the week number of the year for a given date using Danish locale.
18
+ */
19
+ declare function getWeek(date: Date): number;
20
+
21
+ /**
22
+ * Determines if a specified cooldown period has elapsed since a given date.
23
+ *
24
+ * @param startDate - The starting date to calculate elapsed time from.
25
+ * @param cooldownMs - The cooldown duration in milliseconds.
26
+ * @returns `true` if the cooldown period has elapsed, otherwise `false`.
27
+ */
28
+ declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
29
+
30
+ /**
31
+ * Converts hours to milliseconds.
32
+ */
33
+ declare function hoursToMs(hours: number): number;
34
+
35
+ /**
36
+ * Converts minutes to milliseconds.
37
+ */
38
+ declare function minutesToMs(minutes: number): number;
39
+
40
+ /**
41
+ * Returns the name, in Danish language, of the month corresponding to the provided month number.
42
+ *
43
+ * @param month - A month number between 1 and 12.
44
+ *
45
+ * @throws if the provided month number is not a valid month.
46
+ *
47
+ * @example ```ts
48
+ * monthNameDA(9) //=> 'September'
49
+ * ```
50
+ */
51
+ declare function monthNameDa(month: number): string;
52
+
53
+ /**
54
+ * Get the (Danish) name of the month relative to the current month.
55
+ *
56
+ * @example ```ts
57
+ * // assuming current month is August
58
+ * monthNameDaRelative(-1) //=> 'Juli'
59
+ * monthNameDaRelative(0) //=> 'August'
60
+ * monthNameDaRelative(1) //=> 'September'
61
+ * ```
62
+ */
63
+ declare function monthNameDaRelative(n: number): string;
64
+
65
+ /**
66
+ * Calculates the number of milliseconds that have elapsed since the given date.
67
+ */
68
+ declare function msSinceDate(date: Date | string | number): number;
69
+
70
+ /**
71
+ * Converts seconds to milliseconds.
72
+ */
73
+ declare function secondsToMs(seconds: number): number;
74
+
75
+ /**
76
+ * Remove the time component from a date, returning only the date part.
77
+ */
78
+ declare function stripTime(date: Date): Date;
79
+
80
+ /**
81
+ * Get the UTC date today, time stripped
82
+ */
83
+ declare function today(): Date;
84
+
85
+ /**
86
+ * Get the UTC date yesterday, time stripped
87
+ */
88
+ declare function yesterday(): Date;
89
+
90
+ export { Timer, dateString, daysToMs, getWeek, hasCooldownElapsed, hoursToMs, minutesToMs, monthNameDa, monthNameDaRelative, msSinceDate, secondsToMs, stripTime, today, yesterday };
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "@bemoje/date",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Lightweight date and time utilities for formatting, time-unit conversion, and duration measurement.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "dependencies": {
11
+ "date-fns": "^4.1.0",
12
+ "enhanced-ms": "^4.2.0",
13
+ "@types/date-fns": "^2.6.3"
14
+ },
5
15
  "keywords": [
6
16
  "date",
7
17
  "time",
@@ -12,19 +22,15 @@
12
22
  "utilities",
13
23
  "typescript"
14
24
  ],
15
- "dependencies": {
16
- "date-fns": "^4.1.0",
17
- "enhanced-ms": "^4.2.0",
18
- "@types/date-fns": "^2.6.3"
19
- },
20
- "type": "module",
21
- "sideEffects": false,
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
25
  "main": "./lib/index.cjs",
26
26
  "module": "./lib/index.js",
27
27
  "types": "./lib/index.d.ts",
28
+ "files": [
29
+ "./lib/index.js",
30
+ "./lib/index.d.ts",
31
+ "./lib/index.cjs",
32
+ "./lib/index.d.cts"
33
+ ],
28
34
  "exports": {
29
35
  ".": {
30
36
  "import": {
@@ -36,209 +42,17 @@
36
42
  "default": "./lib/index.cjs"
37
43
  }
38
44
  },
39
- "./Timer": {
40
- "import": {
41
- "types": "./lib/Timer.d.ts",
42
- "default": "./lib/Timer.js"
43
- },
44
- "require": {
45
- "types": "./lib/Timer.d.cts",
46
- "default": "./lib/Timer.cjs"
47
- }
48
- },
49
- "./dateString": {
50
- "import": {
51
- "types": "./lib/dateString.d.ts",
52
- "default": "./lib/dateString.js"
53
- },
54
- "require": {
55
- "types": "./lib/dateString.d.cts",
56
- "default": "./lib/dateString.cjs"
57
- }
58
- },
59
- "./daysToMs": {
60
- "import": {
61
- "types": "./lib/daysToMs.d.ts",
62
- "default": "./lib/daysToMs.js"
63
- },
64
- "require": {
65
- "types": "./lib/daysToMs.d.cts",
66
- "default": "./lib/daysToMs.cjs"
67
- }
68
- },
69
- "./getWeek": {
70
- "import": {
71
- "types": "./lib/getWeek.d.ts",
72
- "default": "./lib/getWeek.js"
73
- },
74
- "require": {
75
- "types": "./lib/getWeek.d.cts",
76
- "default": "./lib/getWeek.cjs"
77
- }
78
- },
79
- "./hasCooldownElapsed": {
80
- "import": {
81
- "types": "./lib/hasCooldownElapsed.d.ts",
82
- "default": "./lib/hasCooldownElapsed.js"
83
- },
84
- "require": {
85
- "types": "./lib/hasCooldownElapsed.d.cts",
86
- "default": "./lib/hasCooldownElapsed.cjs"
87
- }
88
- },
89
- "./hoursToMs": {
45
+ "./*": {
90
46
  "import": {
91
- "types": "./lib/hoursToMs.d.ts",
92
- "default": "./lib/hoursToMs.js"
93
- },
94
- "require": {
95
- "types": "./lib/hoursToMs.d.cts",
96
- "default": "./lib/hoursToMs.cjs"
97
- }
98
- },
99
- "./minutesToMs": {
100
- "import": {
101
- "types": "./lib/minutesToMs.d.ts",
102
- "default": "./lib/minutesToMs.js"
103
- },
104
- "require": {
105
- "types": "./lib/minutesToMs.d.cts",
106
- "default": "./lib/minutesToMs.cjs"
107
- }
108
- },
109
- "./monthNameDa": {
110
- "import": {
111
- "types": "./lib/monthNameDa.d.ts",
112
- "default": "./lib/monthNameDa.js"
113
- },
114
- "require": {
115
- "types": "./lib/monthNameDa.d.cts",
116
- "default": "./lib/monthNameDa.cjs"
117
- }
118
- },
119
- "./monthNameDaRelative": {
120
- "import": {
121
- "types": "./lib/monthNameDaRelative.d.ts",
122
- "default": "./lib/monthNameDaRelative.js"
123
- },
124
- "require": {
125
- "types": "./lib/monthNameDaRelative.d.cts",
126
- "default": "./lib/monthNameDaRelative.cjs"
127
- }
128
- },
129
- "./msSinceDate": {
130
- "import": {
131
- "types": "./lib/msSinceDate.d.ts",
132
- "default": "./lib/msSinceDate.js"
133
- },
134
- "require": {
135
- "types": "./lib/msSinceDate.d.cts",
136
- "default": "./lib/msSinceDate.cjs"
137
- }
138
- },
139
- "./secondsToMs": {
140
- "import": {
141
- "types": "./lib/secondsToMs.d.ts",
142
- "default": "./lib/secondsToMs.js"
143
- },
144
- "require": {
145
- "types": "./lib/secondsToMs.d.cts",
146
- "default": "./lib/secondsToMs.cjs"
147
- }
148
- },
149
- "./stripTime": {
150
- "import": {
151
- "types": "./lib/stripTime.d.ts",
152
- "default": "./lib/stripTime.js"
153
- },
154
- "require": {
155
- "types": "./lib/stripTime.d.cts",
156
- "default": "./lib/stripTime.cjs"
157
- }
158
- },
159
- "./today": {
160
- "import": {
161
- "types": "./lib/today.d.ts",
162
- "default": "./lib/today.js"
163
- },
164
- "require": {
165
- "types": "./lib/today.d.cts",
166
- "default": "./lib/today.cjs"
167
- }
168
- },
169
- "./yesterday": {
170
- "import": {
171
- "types": "./lib/yesterday.d.ts",
172
- "default": "./lib/yesterday.js"
47
+ "types": "./lib/index.d.ts",
48
+ "default": "./lib/index.js"
173
49
  },
174
50
  "require": {
175
- "types": "./lib/yesterday.d.cts",
176
- "default": "./lib/yesterday.cjs"
51
+ "types": "./lib/index.d.cts",
52
+ "default": "./lib/index.cjs"
177
53
  }
178
54
  }
179
55
  },
180
- "files": [
181
- "./lib/index.js",
182
- "./lib/index.d.ts",
183
- "./lib/index.cjs",
184
- "./lib/index.d.cts",
185
- "./lib/Timer.js",
186
- "./lib/Timer.d.ts",
187
- "./lib/Timer.cjs",
188
- "./lib/Timer.d.cts",
189
- "./lib/dateString.js",
190
- "./lib/dateString.d.ts",
191
- "./lib/dateString.cjs",
192
- "./lib/dateString.d.cts",
193
- "./lib/daysToMs.js",
194
- "./lib/daysToMs.d.ts",
195
- "./lib/daysToMs.cjs",
196
- "./lib/daysToMs.d.cts",
197
- "./lib/getWeek.js",
198
- "./lib/getWeek.d.ts",
199
- "./lib/getWeek.cjs",
200
- "./lib/getWeek.d.cts",
201
- "./lib/hasCooldownElapsed.js",
202
- "./lib/hasCooldownElapsed.d.ts",
203
- "./lib/hasCooldownElapsed.cjs",
204
- "./lib/hasCooldownElapsed.d.cts",
205
- "./lib/hoursToMs.js",
206
- "./lib/hoursToMs.d.ts",
207
- "./lib/hoursToMs.cjs",
208
- "./lib/hoursToMs.d.cts",
209
- "./lib/minutesToMs.js",
210
- "./lib/minutesToMs.d.ts",
211
- "./lib/minutesToMs.cjs",
212
- "./lib/minutesToMs.d.cts",
213
- "./lib/monthNameDa.js",
214
- "./lib/monthNameDa.d.ts",
215
- "./lib/monthNameDa.cjs",
216
- "./lib/monthNameDa.d.cts",
217
- "./lib/monthNameDaRelative.js",
218
- "./lib/monthNameDaRelative.d.ts",
219
- "./lib/monthNameDaRelative.cjs",
220
- "./lib/monthNameDaRelative.d.cts",
221
- "./lib/msSinceDate.js",
222
- "./lib/msSinceDate.d.ts",
223
- "./lib/msSinceDate.cjs",
224
- "./lib/msSinceDate.d.cts",
225
- "./lib/secondsToMs.js",
226
- "./lib/secondsToMs.d.ts",
227
- "./lib/secondsToMs.cjs",
228
- "./lib/secondsToMs.d.cts",
229
- "./lib/stripTime.js",
230
- "./lib/stripTime.d.ts",
231
- "./lib/stripTime.cjs",
232
- "./lib/stripTime.d.cts",
233
- "./lib/today.js",
234
- "./lib/today.d.ts",
235
- "./lib/today.cjs",
236
- "./lib/today.d.cts",
237
- "./lib/yesterday.js",
238
- "./lib/yesterday.d.ts",
239
- "./lib/yesterday.cjs",
240
- "./lib/yesterday.d.cts"
241
- ],
242
56
  "repository": {
243
57
  "type": "git",
244
58
  "url": "git+https://github.com/bemoje/mono.git",
package/lib/Timer.cjs DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var enhancedMs = require('enhanced-ms');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- function Timer(startTime = Date.now()) {
8
- return function(endTime = Date.now()) {
9
- const duration = endTime - startTime;
10
- if (duration === 0) {
11
- return "0ms";
12
- }
13
- const string = enhancedMs.ms(duration, {
14
- useAbbreviations: true
15
- });
16
- return string ?? `${duration}ms`;
17
- };
18
- }
19
- __name(Timer, "Timer");
20
-
21
- exports.Timer = Timer;
package/lib/Timer.d.cts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Returns a function that returns the elapsed time since invokation.
3
- */
4
- declare function Timer(startTime?: number): (endTime?: number) => string;
5
-
6
- export { Timer };
package/lib/Timer.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Returns a function that returns the elapsed time since invokation.
3
- */
4
- declare function Timer(startTime?: number): (endTime?: number) => string;
5
-
6
- export { Timer };
package/lib/Timer.js DELETED
@@ -1,19 +0,0 @@
1
- import { ms } from 'enhanced-ms';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function Timer(startTime = Date.now()) {
6
- return function(endTime = Date.now()) {
7
- const duration = endTime - startTime;
8
- if (duration === 0) {
9
- return "0ms";
10
- }
11
- const string = ms(duration, {
12
- useAbbreviations: true
13
- });
14
- return string ?? `${duration}ms`;
15
- };
16
- }
17
- __name(Timer, "Timer");
18
-
19
- export { Timer };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var dateFns = require('date-fns');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- function dateString(date) {
8
- return dateFns.format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
9
- }
10
- __name(dateString, "dateString");
11
-
12
- exports.dateString = dateString;
@@ -1,6 +0,0 @@
1
- /**
2
- * Reutnrs the date formatted as: yyyy-MM-dd
3
- */
4
- declare function dateString(date?: Date | number | string): string;
5
-
6
- export { dateString };
@@ -1,6 +0,0 @@
1
- /**
2
- * Reutnrs the date formatted as: yyyy-MM-dd
3
- */
4
- declare function dateString(date?: Date | number | string): string;
5
-
6
- export { dateString };
package/lib/dateString.js DELETED
@@ -1,10 +0,0 @@
1
- import { format } from 'date-fns';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function dateString(date) {
6
- return format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
7
- }
8
- __name(dateString, "dateString");
9
-
10
- export { dateString };
package/lib/daysToMs.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/daysToMs.ts
7
- function daysToMs(days) {
8
- return 1e3 * 60 * 60 * 24 * days;
9
- }
10
- __name(daysToMs, "daysToMs");
11
-
12
- exports.daysToMs = daysToMs;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts days to milliseconds.
3
- */
4
- declare function daysToMs(days: number): number;
5
-
6
- export { daysToMs };
package/lib/daysToMs.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts days to milliseconds.
3
- */
4
- declare function daysToMs(days: number): number;
5
-
6
- export { daysToMs };
package/lib/daysToMs.js DELETED
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/daysToMs.ts
5
- function daysToMs(days) {
6
- return 1e3 * 60 * 60 * 24 * days;
7
- }
8
- __name(daysToMs, "daysToMs");
9
-
10
- export { daysToMs };
package/lib/getWeek.cjs DELETED
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- var locale = require('date-fns/locale');
4
- var dateFns = require('date-fns');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- function getWeek(date) {
9
- return dateFns.getWeek(date, {
10
- locale: locale.da
11
- });
12
- }
13
- __name(getWeek, "getWeek");
14
-
15
- exports.getWeek = getWeek;