@thi.ng/date 2.7.0 → 2.7.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/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/duration.d.ts +3 -0
- package/format.d.ts +8 -0
- package/i18n.d.ts +4 -0
- package/package.json +4 -4
- package/timecode.d.ts +2 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/duration.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare const decomposeDuration: (dur: number) => number[];
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
|
+
* import { composeDuration } from "@thi.ng/date";
|
|
16
|
+
*
|
|
15
17
|
* composeDuration({ h: 12, m: 34, s: 56 })
|
|
16
18
|
* // 45296000
|
|
17
19
|
* ```
|
|
@@ -24,6 +26,7 @@ export declare const composeDuration: (parts: Partial<Record<Precision, number>>
|
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```ts
|
|
29
|
+
* import { durationAs } from "@thi.ng/date";
|
|
27
30
|
* durationAs("d", difference("2023-02-01T12:00:00Z", "2023-01-01"))
|
|
28
31
|
* // 31.5
|
|
29
32
|
* ```
|
package/format.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const FORMATTERS: Record<string, FormatFn>;
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
18
|
+
* import { defFormat } from "@thi.ng/date";
|
|
19
|
+
*
|
|
18
20
|
* const fmt = defFormat(["yyyy", "-", "MM", "-", "dd"]);
|
|
19
21
|
*
|
|
20
22
|
* fmt(new Date(2015, 3, 23))
|
|
@@ -128,6 +130,8 @@ export declare const FMT_ss: (x?: MaybeDate, utc?: boolean) => string;
|
|
|
128
130
|
*
|
|
129
131
|
* @example
|
|
130
132
|
* ```ts
|
|
133
|
+
* import { formatRelative } from "@thi.ng/date";
|
|
134
|
+
*
|
|
131
135
|
* formatRelative("2020-06-01", "2021-07-01")
|
|
132
136
|
* // "1 year ago"
|
|
133
137
|
*
|
|
@@ -160,6 +164,8 @@ export declare const formatRelative: (date: MaybeDate, base?: MaybeDate, prec?:
|
|
|
160
164
|
*
|
|
161
165
|
* @example
|
|
162
166
|
* ```ts
|
|
167
|
+
* import { formatRelativeParts } from "@thi.ng/date";
|
|
168
|
+
*
|
|
163
169
|
* // with default precision (seconds)
|
|
164
170
|
* formatRelativeParts("2022-09-01 12:23:24", "2021-07-01 12:05")
|
|
165
171
|
* // "in 1 year, 2 months, 21 hours, 18 minutes, 24 seconds"
|
|
@@ -184,6 +190,8 @@ export declare const formatRelativeParts: (date: MaybeDate, base?: MaybeDate, pr
|
|
|
184
190
|
*
|
|
185
191
|
* @example
|
|
186
192
|
* ```ts
|
|
193
|
+
* import { formatDuration } from "@thi.ng/date";
|
|
194
|
+
*
|
|
187
195
|
* formatDuration(45296000)
|
|
188
196
|
* // "12 h, 34 min, 56 s"
|
|
189
197
|
*
|
package/i18n.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export declare const monthNames: () => string[];
|
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* ```ts
|
|
41
|
+
* import { withLocale } from "@thi.ng/date";
|
|
42
|
+
*
|
|
41
43
|
* withLocale(FR_LONG, () => units(1, "y"));
|
|
42
44
|
* // "1 année"
|
|
43
45
|
*
|
|
@@ -69,6 +71,8 @@ export declare const units: (x: number, unit: Precision | LocaleUnit, isDativ?:
|
|
|
69
71
|
*
|
|
70
72
|
* @example
|
|
71
73
|
* ```ts
|
|
74
|
+
* import { withLocale } from "@thi.ng/date";
|
|
75
|
+
*
|
|
72
76
|
* withLocale(DE_LONG, () => unitsLessThan(1, "y"));
|
|
73
77
|
* // "weniger als 1 Jahr"
|
|
74
78
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/date",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
38
|
+
"@thi.ng/api": "^8.9.26",
|
|
39
39
|
"@thi.ng/checks": "^3.5.0",
|
|
40
|
-
"@thi.ng/strings": "^3.7.
|
|
40
|
+
"@thi.ng/strings": "^3.7.17"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"thi.ng": {
|
|
133
133
|
"year": 2020
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "6e20f80dd9df1c8055ffa3c1e4d6f7598add0c0b\n"
|
|
136
136
|
}
|