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