@bemoje/date 1.1.1 → 1.1.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/lib/index.d.cts +90 -14
- package/lib/index.d.ts +90 -14
- package/package.json +78 -134
- package/lib/Timer.cjs +0 -21
- package/lib/Timer.d.cts +0 -6
- package/lib/Timer.d.ts +0 -6
- package/lib/Timer.js +0 -19
- package/lib/dateString.cjs +0 -12
- package/lib/dateString.d.cts +0 -6
- package/lib/dateString.d.ts +0 -6
- package/lib/dateString.js +0 -10
- package/lib/daysToMs.cjs +0 -12
- package/lib/daysToMs.d.cts +0 -6
- package/lib/daysToMs.d.ts +0 -6
- package/lib/daysToMs.js +0 -10
- package/lib/getWeek.cjs +0 -15
- package/lib/getWeek.d.cts +0 -6
- package/lib/getWeek.d.ts +0 -6
- package/lib/getWeek.js +0 -13
- package/lib/hasCooldownElapsed.cjs +0 -13
- package/lib/hasCooldownElapsed.d.cts +0 -10
- package/lib/hasCooldownElapsed.d.ts +0 -10
- package/lib/hasCooldownElapsed.js +0 -11
- package/lib/hoursToMs.cjs +0 -12
- package/lib/hoursToMs.d.cts +0 -6
- package/lib/hoursToMs.d.ts +0 -6
- package/lib/hoursToMs.js +0 -10
- package/lib/minutesToMs.cjs +0 -12
- package/lib/minutesToMs.d.cts +0 -6
- package/lib/minutesToMs.d.ts +0 -6
- package/lib/minutesToMs.js +0 -10
- package/lib/monthNameDa.cjs +0 -30
- package/lib/monthNameDa.d.cts +0 -14
- package/lib/monthNameDa.d.ts +0 -14
- package/lib/monthNameDa.js +0 -28
- package/lib/monthNameDaRelative.cjs +0 -38
- package/lib/monthNameDaRelative.d.cts +0 -13
- package/lib/monthNameDaRelative.d.ts +0 -13
- package/lib/monthNameDaRelative.js +0 -36
- package/lib/msSinceDate.cjs +0 -12
- package/lib/msSinceDate.d.cts +0 -6
- package/lib/msSinceDate.d.ts +0 -6
- package/lib/msSinceDate.js +0 -10
- package/lib/secondsToMs.cjs +0 -12
- package/lib/secondsToMs.d.cts +0 -6
- package/lib/secondsToMs.d.ts +0 -6
- package/lib/secondsToMs.js +0 -10
- package/lib/stripTime.cjs +0 -12
- package/lib/stripTime.d.cts +0 -6
- package/lib/stripTime.d.ts +0 -6
- package/lib/stripTime.js +0 -10
- package/lib/today.cjs +0 -18
- package/lib/today.d.cts +0 -6
- package/lib/today.d.ts +0 -6
- package/lib/today.js +0 -16
- package/lib/yesterday.cjs +0 -26
- package/lib/yesterday.d.cts +0 -6
- package/lib/yesterday.d.ts +0 -6
- package/lib/yesterday.js +0 -24
package/lib/index.d.cts
CHANGED
|
@@ -1,14 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/date",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Lightweight date and time utilities for formatting, time-unit conversion, and duration measurement.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
5
7
|
"keywords": [
|
|
6
8
|
"date",
|
|
7
9
|
"time",
|
|
@@ -12,19 +14,15 @@
|
|
|
12
14
|
"utilities",
|
|
13
15
|
"typescript"
|
|
14
16
|
],
|
|
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
17
|
"main": "./lib/index.cjs",
|
|
26
18
|
"module": "./lib/index.js",
|
|
27
19
|
"types": "./lib/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"./lib/index.js",
|
|
22
|
+
"./lib/index.d.ts",
|
|
23
|
+
"./lib/index.cjs",
|
|
24
|
+
"./lib/index.d.cts"
|
|
25
|
+
],
|
|
28
26
|
"exports": {
|
|
29
27
|
".": {
|
|
30
28
|
"import": {
|
|
@@ -38,216 +36,162 @@
|
|
|
38
36
|
},
|
|
39
37
|
"./Timer": {
|
|
40
38
|
"import": {
|
|
41
|
-
"types": "./lib/
|
|
42
|
-
"default": "./lib/
|
|
39
|
+
"types": "./lib/index.d.ts",
|
|
40
|
+
"default": "./lib/index.js"
|
|
43
41
|
},
|
|
44
42
|
"require": {
|
|
45
|
-
"types": "./lib/
|
|
46
|
-
"default": "./lib/
|
|
43
|
+
"types": "./lib/index.d.cts",
|
|
44
|
+
"default": "./lib/index.cjs"
|
|
47
45
|
}
|
|
48
46
|
},
|
|
49
47
|
"./dateString": {
|
|
50
48
|
"import": {
|
|
51
|
-
"types": "./lib/
|
|
52
|
-
"default": "./lib/
|
|
49
|
+
"types": "./lib/index.d.ts",
|
|
50
|
+
"default": "./lib/index.js"
|
|
53
51
|
},
|
|
54
52
|
"require": {
|
|
55
|
-
"types": "./lib/
|
|
56
|
-
"default": "./lib/
|
|
53
|
+
"types": "./lib/index.d.cts",
|
|
54
|
+
"default": "./lib/index.cjs"
|
|
57
55
|
}
|
|
58
56
|
},
|
|
59
57
|
"./daysToMs": {
|
|
60
58
|
"import": {
|
|
61
|
-
"types": "./lib/
|
|
62
|
-
"default": "./lib/
|
|
59
|
+
"types": "./lib/index.d.ts",
|
|
60
|
+
"default": "./lib/index.js"
|
|
63
61
|
},
|
|
64
62
|
"require": {
|
|
65
|
-
"types": "./lib/
|
|
66
|
-
"default": "./lib/
|
|
63
|
+
"types": "./lib/index.d.cts",
|
|
64
|
+
"default": "./lib/index.cjs"
|
|
67
65
|
}
|
|
68
66
|
},
|
|
69
67
|
"./getWeek": {
|
|
70
68
|
"import": {
|
|
71
|
-
"types": "./lib/
|
|
72
|
-
"default": "./lib/
|
|
69
|
+
"types": "./lib/index.d.ts",
|
|
70
|
+
"default": "./lib/index.js"
|
|
73
71
|
},
|
|
74
72
|
"require": {
|
|
75
|
-
"types": "./lib/
|
|
76
|
-
"default": "./lib/
|
|
73
|
+
"types": "./lib/index.d.cts",
|
|
74
|
+
"default": "./lib/index.cjs"
|
|
77
75
|
}
|
|
78
76
|
},
|
|
79
77
|
"./hasCooldownElapsed": {
|
|
80
78
|
"import": {
|
|
81
|
-
"types": "./lib/
|
|
82
|
-
"default": "./lib/
|
|
79
|
+
"types": "./lib/index.d.ts",
|
|
80
|
+
"default": "./lib/index.js"
|
|
83
81
|
},
|
|
84
82
|
"require": {
|
|
85
|
-
"types": "./lib/
|
|
86
|
-
"default": "./lib/
|
|
83
|
+
"types": "./lib/index.d.cts",
|
|
84
|
+
"default": "./lib/index.cjs"
|
|
87
85
|
}
|
|
88
86
|
},
|
|
89
87
|
"./hoursToMs": {
|
|
90
88
|
"import": {
|
|
91
|
-
"types": "./lib/
|
|
92
|
-
"default": "./lib/
|
|
89
|
+
"types": "./lib/index.d.ts",
|
|
90
|
+
"default": "./lib/index.js"
|
|
93
91
|
},
|
|
94
92
|
"require": {
|
|
95
|
-
"types": "./lib/
|
|
96
|
-
"default": "./lib/
|
|
93
|
+
"types": "./lib/index.d.cts",
|
|
94
|
+
"default": "./lib/index.cjs"
|
|
97
95
|
}
|
|
98
96
|
},
|
|
99
97
|
"./minutesToMs": {
|
|
100
98
|
"import": {
|
|
101
|
-
"types": "./lib/
|
|
102
|
-
"default": "./lib/
|
|
99
|
+
"types": "./lib/index.d.ts",
|
|
100
|
+
"default": "./lib/index.js"
|
|
103
101
|
},
|
|
104
102
|
"require": {
|
|
105
|
-
"types": "./lib/
|
|
106
|
-
"default": "./lib/
|
|
103
|
+
"types": "./lib/index.d.cts",
|
|
104
|
+
"default": "./lib/index.cjs"
|
|
107
105
|
}
|
|
108
106
|
},
|
|
109
107
|
"./monthNameDa": {
|
|
110
108
|
"import": {
|
|
111
|
-
"types": "./lib/
|
|
112
|
-
"default": "./lib/
|
|
109
|
+
"types": "./lib/index.d.ts",
|
|
110
|
+
"default": "./lib/index.js"
|
|
113
111
|
},
|
|
114
112
|
"require": {
|
|
115
|
-
"types": "./lib/
|
|
116
|
-
"default": "./lib/
|
|
113
|
+
"types": "./lib/index.d.cts",
|
|
114
|
+
"default": "./lib/index.cjs"
|
|
117
115
|
}
|
|
118
116
|
},
|
|
119
117
|
"./monthNameDaRelative": {
|
|
120
118
|
"import": {
|
|
121
|
-
"types": "./lib/
|
|
122
|
-
"default": "./lib/
|
|
119
|
+
"types": "./lib/index.d.ts",
|
|
120
|
+
"default": "./lib/index.js"
|
|
123
121
|
},
|
|
124
122
|
"require": {
|
|
125
|
-
"types": "./lib/
|
|
126
|
-
"default": "./lib/
|
|
123
|
+
"types": "./lib/index.d.cts",
|
|
124
|
+
"default": "./lib/index.cjs"
|
|
127
125
|
}
|
|
128
126
|
},
|
|
129
127
|
"./msSinceDate": {
|
|
130
128
|
"import": {
|
|
131
|
-
"types": "./lib/
|
|
132
|
-
"default": "./lib/
|
|
129
|
+
"types": "./lib/index.d.ts",
|
|
130
|
+
"default": "./lib/index.js"
|
|
133
131
|
},
|
|
134
132
|
"require": {
|
|
135
|
-
"types": "./lib/
|
|
136
|
-
"default": "./lib/
|
|
133
|
+
"types": "./lib/index.d.cts",
|
|
134
|
+
"default": "./lib/index.cjs"
|
|
137
135
|
}
|
|
138
136
|
},
|
|
139
137
|
"./secondsToMs": {
|
|
140
138
|
"import": {
|
|
141
|
-
"types": "./lib/
|
|
142
|
-
"default": "./lib/
|
|
139
|
+
"types": "./lib/index.d.ts",
|
|
140
|
+
"default": "./lib/index.js"
|
|
143
141
|
},
|
|
144
142
|
"require": {
|
|
145
|
-
"types": "./lib/
|
|
146
|
-
"default": "./lib/
|
|
143
|
+
"types": "./lib/index.d.cts",
|
|
144
|
+
"default": "./lib/index.cjs"
|
|
147
145
|
}
|
|
148
146
|
},
|
|
149
147
|
"./stripTime": {
|
|
150
148
|
"import": {
|
|
151
|
-
"types": "./lib/
|
|
152
|
-
"default": "./lib/
|
|
149
|
+
"types": "./lib/index.d.ts",
|
|
150
|
+
"default": "./lib/index.js"
|
|
153
151
|
},
|
|
154
152
|
"require": {
|
|
155
|
-
"types": "./lib/
|
|
156
|
-
"default": "./lib/
|
|
153
|
+
"types": "./lib/index.d.cts",
|
|
154
|
+
"default": "./lib/index.cjs"
|
|
157
155
|
}
|
|
158
156
|
},
|
|
159
157
|
"./today": {
|
|
160
158
|
"import": {
|
|
161
|
-
"types": "./lib/
|
|
162
|
-
"default": "./lib/
|
|
159
|
+
"types": "./lib/index.d.ts",
|
|
160
|
+
"default": "./lib/index.js"
|
|
163
161
|
},
|
|
164
162
|
"require": {
|
|
165
|
-
"types": "./lib/
|
|
166
|
-
"default": "./lib/
|
|
163
|
+
"types": "./lib/index.d.cts",
|
|
164
|
+
"default": "./lib/index.cjs"
|
|
167
165
|
}
|
|
168
166
|
},
|
|
169
167
|
"./yesterday": {
|
|
170
168
|
"import": {
|
|
171
|
-
"types": "./lib/
|
|
172
|
-
"default": "./lib/
|
|
169
|
+
"types": "./lib/index.d.ts",
|
|
170
|
+
"default": "./lib/index.js"
|
|
173
171
|
},
|
|
174
172
|
"require": {
|
|
175
|
-
"types": "./lib/
|
|
176
|
-
"default": "./lib/
|
|
173
|
+
"types": "./lib/index.d.cts",
|
|
174
|
+
"default": "./lib/index.cjs"
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
},
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
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
|
-
"repository": {
|
|
243
|
-
"type": "git",
|
|
244
|
-
"url": "git+https://github.com/bemoje/mono.git",
|
|
245
|
-
"directory": "libs/date"
|
|
178
|
+
"dependencies": {
|
|
179
|
+
"date-fns": "^4.1.0",
|
|
180
|
+
"enhanced-ms": "^4.2.0",
|
|
181
|
+
"@types/date-fns": "^2.6.3"
|
|
246
182
|
},
|
|
183
|
+
"publishConfig": {
|
|
184
|
+
"access": "public"
|
|
185
|
+
},
|
|
186
|
+
"license": "MIT",
|
|
247
187
|
"author": {
|
|
248
188
|
"name": "Benjamin Møller Jensen",
|
|
249
189
|
"email": "bemoje@bemoje.net",
|
|
250
190
|
"url": "https://github.com/bemoje/"
|
|
251
191
|
},
|
|
252
|
-
"
|
|
192
|
+
"repository": {
|
|
193
|
+
"type": "git",
|
|
194
|
+
"url": "git+https://github.com/bemoje/mono.git",
|
|
195
|
+
"directory": "libs/date"
|
|
196
|
+
}
|
|
253
197
|
}
|
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
package/lib/Timer.d.ts
DELETED
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 };
|
package/lib/dateString.cjs
DELETED
|
@@ -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;
|
package/lib/dateString.d.cts
DELETED
package/lib/dateString.d.ts
DELETED
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;
|
package/lib/daysToMs.d.cts
DELETED