@bemoje/date 1.0.1 → 1.1.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/lib/Timer.cjs +21 -0
- package/lib/Timer.d.cts +6 -0
- package/lib/Timer.d.ts +6 -0
- package/lib/Timer.js +19 -0
- package/lib/dateString.cjs +12 -0
- package/lib/dateString.d.cts +6 -0
- package/lib/dateString.d.ts +6 -0
- package/lib/dateString.js +10 -0
- package/lib/daysToMs.cjs +12 -0
- package/lib/daysToMs.d.cts +6 -0
- package/lib/daysToMs.d.ts +6 -0
- package/lib/daysToMs.js +10 -0
- package/lib/getWeek.cjs +15 -0
- package/lib/getWeek.d.cts +6 -0
- package/lib/getWeek.d.ts +6 -0
- package/lib/getWeek.js +13 -0
- package/lib/hasCooldownElapsed.cjs +13 -0
- package/lib/hasCooldownElapsed.d.cts +10 -0
- package/lib/hasCooldownElapsed.d.ts +10 -0
- package/lib/hasCooldownElapsed.js +11 -0
- package/lib/hoursToMs.cjs +12 -0
- package/lib/hoursToMs.d.cts +6 -0
- package/lib/hoursToMs.d.ts +6 -0
- package/lib/hoursToMs.js +10 -0
- package/lib/index.cjs +127 -0
- package/lib/index.d.cts +14 -0
- package/lib/index.d.ts +14 -0
- package/lib/minutesToMs.cjs +12 -0
- package/lib/minutesToMs.d.cts +6 -0
- package/lib/minutesToMs.d.ts +6 -0
- package/lib/minutesToMs.js +10 -0
- package/lib/monthNameDa.cjs +30 -0
- package/lib/monthNameDa.d.cts +14 -0
- package/lib/monthNameDa.d.ts +14 -0
- package/lib/monthNameDa.js +28 -0
- package/lib/monthNameDaRelative.cjs +38 -0
- package/lib/monthNameDaRelative.d.cts +13 -0
- package/lib/monthNameDaRelative.d.ts +13 -0
- package/lib/monthNameDaRelative.js +36 -0
- package/lib/msSinceDate.cjs +12 -0
- package/lib/msSinceDate.d.cts +6 -0
- package/lib/msSinceDate.d.ts +6 -0
- package/lib/msSinceDate.js +10 -0
- package/lib/secondsToMs.cjs +12 -0
- package/lib/secondsToMs.d.cts +6 -0
- package/lib/secondsToMs.d.ts +6 -0
- package/lib/secondsToMs.js +10 -0
- package/lib/stripTime.cjs +12 -0
- package/lib/stripTime.d.cts +6 -0
- package/lib/stripTime.d.ts +6 -0
- package/lib/stripTime.js +10 -0
- package/lib/today.cjs +18 -0
- package/lib/today.d.cts +6 -0
- package/lib/today.d.ts +6 -0
- package/lib/today.js +16 -0
- package/lib/yesterday.cjs +26 -0
- package/lib/yesterday.d.cts +6 -0
- package/lib/yesterday.d.ts +6 -0
- package/lib/yesterday.js +24 -0
- package/package.json +236 -19
- package/index.d.ts +0 -90
- /package/{index.mjs → lib/index.js} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { addMonths } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/monthNameDa.ts
|
|
7
|
+
function monthNameDa(month) {
|
|
8
|
+
if (month < 1 || month > 12) {
|
|
9
|
+
throw new Error(`Invalid month number. Got: ${month}`);
|
|
10
|
+
}
|
|
11
|
+
return MONTH_NAMES_DA[month];
|
|
12
|
+
}
|
|
13
|
+
__name(monthNameDa, "monthNameDa");
|
|
14
|
+
var MONTH_NAMES_DA = [
|
|
15
|
+
"",
|
|
16
|
+
"Januar",
|
|
17
|
+
"Februar",
|
|
18
|
+
"Marts",
|
|
19
|
+
"April",
|
|
20
|
+
"Maj",
|
|
21
|
+
"Juni",
|
|
22
|
+
"Juli",
|
|
23
|
+
"August",
|
|
24
|
+
"September",
|
|
25
|
+
"Oktober",
|
|
26
|
+
"November",
|
|
27
|
+
"December"
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// src/monthNameDaRelative.ts
|
|
31
|
+
function monthNameDaRelative(n) {
|
|
32
|
+
return monthNameDa(addMonths(/* @__PURE__ */ new Date(), n).getUTCMonth() + 1);
|
|
33
|
+
}
|
|
34
|
+
__name(monthNameDaRelative, "monthNameDaRelative");
|
|
35
|
+
|
|
36
|
+
export { monthNameDaRelative };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/msSinceDate.ts
|
|
7
|
+
function msSinceDate(date) {
|
|
8
|
+
return Date.now() - new Date(date).getTime();
|
|
9
|
+
}
|
|
10
|
+
__name(msSinceDate, "msSinceDate");
|
|
11
|
+
|
|
12
|
+
exports.msSinceDate = msSinceDate;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/msSinceDate.ts
|
|
5
|
+
function msSinceDate(date) {
|
|
6
|
+
return Date.now() - new Date(date).getTime();
|
|
7
|
+
}
|
|
8
|
+
__name(msSinceDate, "msSinceDate");
|
|
9
|
+
|
|
10
|
+
export { msSinceDate };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/secondsToMs.ts
|
|
7
|
+
function secondsToMs(seconds) {
|
|
8
|
+
return 1e3 * seconds;
|
|
9
|
+
}
|
|
10
|
+
__name(secondsToMs, "secondsToMs");
|
|
11
|
+
|
|
12
|
+
exports.secondsToMs = secondsToMs;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/secondsToMs.ts
|
|
5
|
+
function secondsToMs(seconds) {
|
|
6
|
+
return 1e3 * seconds;
|
|
7
|
+
}
|
|
8
|
+
__name(secondsToMs, "secondsToMs");
|
|
9
|
+
|
|
10
|
+
export { secondsToMs };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/stripTime.ts
|
|
7
|
+
function stripTime(date) {
|
|
8
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
9
|
+
}
|
|
10
|
+
__name(stripTime, "stripTime");
|
|
11
|
+
|
|
12
|
+
exports.stripTime = stripTime;
|
package/lib/stripTime.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/stripTime.ts
|
|
5
|
+
function stripTime(date) {
|
|
6
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
7
|
+
}
|
|
8
|
+
__name(stripTime, "stripTime");
|
|
9
|
+
|
|
10
|
+
export { stripTime };
|
package/lib/today.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/stripTime.ts
|
|
7
|
+
function stripTime(date) {
|
|
8
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
9
|
+
}
|
|
10
|
+
__name(stripTime, "stripTime");
|
|
11
|
+
|
|
12
|
+
// src/today.ts
|
|
13
|
+
function today() {
|
|
14
|
+
return stripTime(new Date(Date.now()));
|
|
15
|
+
}
|
|
16
|
+
__name(today, "today");
|
|
17
|
+
|
|
18
|
+
exports.today = today;
|
package/lib/today.d.cts
ADDED
package/lib/today.d.ts
ADDED
package/lib/today.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/stripTime.ts
|
|
5
|
+
function stripTime(date) {
|
|
6
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
7
|
+
}
|
|
8
|
+
__name(stripTime, "stripTime");
|
|
9
|
+
|
|
10
|
+
// src/today.ts
|
|
11
|
+
function today() {
|
|
12
|
+
return stripTime(new Date(Date.now()));
|
|
13
|
+
}
|
|
14
|
+
__name(today, "today");
|
|
15
|
+
|
|
16
|
+
export { today };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
8
|
+
// src/stripTime.ts
|
|
9
|
+
function stripTime(date) {
|
|
10
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
11
|
+
}
|
|
12
|
+
__name(stripTime, "stripTime");
|
|
13
|
+
|
|
14
|
+
// src/today.ts
|
|
15
|
+
function today() {
|
|
16
|
+
return stripTime(new Date(Date.now()));
|
|
17
|
+
}
|
|
18
|
+
__name(today, "today");
|
|
19
|
+
|
|
20
|
+
// src/yesterday.ts
|
|
21
|
+
function yesterday() {
|
|
22
|
+
return stripTime(dateFns.subDays(today(), 1));
|
|
23
|
+
}
|
|
24
|
+
__name(yesterday, "yesterday");
|
|
25
|
+
|
|
26
|
+
exports.yesterday = yesterday;
|
package/lib/yesterday.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { subDays } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/stripTime.ts
|
|
7
|
+
function stripTime(date) {
|
|
8
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
9
|
+
}
|
|
10
|
+
__name(stripTime, "stripTime");
|
|
11
|
+
|
|
12
|
+
// src/today.ts
|
|
13
|
+
function today() {
|
|
14
|
+
return stripTime(new Date(Date.now()));
|
|
15
|
+
}
|
|
16
|
+
__name(today, "today");
|
|
17
|
+
|
|
18
|
+
// src/yesterday.ts
|
|
19
|
+
function yesterday() {
|
|
20
|
+
return stripTime(subDays(today(), 1));
|
|
21
|
+
}
|
|
22
|
+
__name(yesterday, "yesterday");
|
|
23
|
+
|
|
24
|
+
export { yesterday };
|
package/package.json
CHANGED
|
@@ -1,36 +1,253 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/date",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "date",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Lightweight date and time utilities for formatting, time-unit conversion, and duration measurement.",
|
|
7
5
|
"keywords": [
|
|
8
|
-
"date"
|
|
6
|
+
"date",
|
|
7
|
+
"time",
|
|
8
|
+
"formatting",
|
|
9
|
+
"duration",
|
|
10
|
+
"conversion",
|
|
11
|
+
"measurement",
|
|
12
|
+
"utilities",
|
|
13
|
+
"typescript"
|
|
9
14
|
],
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"import": "./index.mjs",
|
|
14
|
-
"default": "./index.mjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
15
|
"dependencies": {
|
|
18
16
|
"date-fns": "^4.1.0",
|
|
19
|
-
"enhanced-ms": "^4.
|
|
17
|
+
"enhanced-ms": "^4.2.0",
|
|
20
18
|
"@types/date-fns": "^2.6.3"
|
|
21
19
|
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
25
|
+
"main": "./lib/index.cjs",
|
|
26
|
+
"module": "./lib/index.js",
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"default": "./lib/index.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./lib/index.d.cts",
|
|
36
|
+
"default": "./lib/index.cjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
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": {
|
|
90
|
+
"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"
|
|
173
|
+
},
|
|
174
|
+
"require": {
|
|
175
|
+
"types": "./lib/yesterday.d.cts",
|
|
176
|
+
"default": "./lib/yesterday.cjs"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
30
179
|
},
|
|
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
|
+
],
|
|
31
242
|
"repository": {
|
|
32
243
|
"type": "git",
|
|
33
244
|
"url": "git+https://github.com/bemoje/mono.git",
|
|
34
245
|
"directory": "libs/date"
|
|
35
|
-
}
|
|
246
|
+
},
|
|
247
|
+
"author": {
|
|
248
|
+
"name": "Benjamin Møller Jensen",
|
|
249
|
+
"email": "bemoje@bemoje.net",
|
|
250
|
+
"url": "https://github.com/bemoje/"
|
|
251
|
+
},
|
|
252
|
+
"license": "MIT"
|
|
36
253
|
}
|
package/index.d.ts
DELETED
|
@@ -1,90 +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
|
-
/**
|
|
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 };
|
|
File without changes
|