@thi.ng/date 2.1.7 → 2.2.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/CHANGELOG.md +7 -1
- package/format.d.ts +16 -13
- package/format.js +4 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-05-
|
|
3
|
+
- **Last updated**: 2022-05-18T12:59:20Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.2.0) (2022-05-18)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- use current time as default for all formatters ([ee536db](https://github.com/thi-ng/umbrella/commit/ee536db))
|
|
17
|
+
|
|
12
18
|
### [2.1.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.1.6) (2022-04-07)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/format.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare const FORMATTERS: Record<string, FormatFn>;
|
|
|
7
7
|
* instead of local time (default).
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
|
+
* If no date is given to the returned formatter, `Date.now()` will be used by
|
|
11
|
+
* default.
|
|
12
|
+
*
|
|
10
13
|
* See {@link FORMATTERS} for available date component format IDs. To escape a
|
|
11
14
|
* formatter and use as a string literal, prefix the term with `\\`.
|
|
12
15
|
*
|
|
@@ -23,56 +26,56 @@ export declare const FORMATTERS: Record<string, FormatFn>;
|
|
|
23
26
|
*
|
|
24
27
|
* @param fmt -
|
|
25
28
|
*/
|
|
26
|
-
export declare const defFormat: (fmt: (string | FormatFn)[]) => (x
|
|
29
|
+
export declare const defFormat: (fmt: (string | FormatFn)[]) => (x?: MaybeDate, utc?: boolean) => string;
|
|
27
30
|
/**
|
|
28
31
|
* Format preset, e.g. `2020-09-19`
|
|
29
32
|
*/
|
|
30
|
-
export declare const FMT_yyyyMMdd: (x
|
|
33
|
+
export declare const FMT_yyyyMMdd: (x?: MaybeDate, utc?: boolean) => string;
|
|
31
34
|
/**
|
|
32
35
|
* Format preset, e.g. `9/19/2020`
|
|
33
36
|
*/
|
|
34
|
-
export declare const FMT_Mdyyyy: (x
|
|
37
|
+
export declare const FMT_Mdyyyy: (x?: MaybeDate, utc?: boolean) => string;
|
|
35
38
|
/**
|
|
36
39
|
* Format preset, e.g. `Sep 19 2020`. Uses current `LOCALE`, see
|
|
37
40
|
* {@link setLocale}.
|
|
38
41
|
*/
|
|
39
|
-
export declare const FMT_MMMdyyyy: (x
|
|
42
|
+
export declare const FMT_MMMdyyyy: (x?: MaybeDate, utc?: boolean) => string;
|
|
40
43
|
/**
|
|
41
44
|
* Format preset, e.g. `19.9.2020`
|
|
42
45
|
*/
|
|
43
|
-
export declare const FMT_dMyyyy: (x
|
|
46
|
+
export declare const FMT_dMyyyy: (x?: MaybeDate, utc?: boolean) => string;
|
|
44
47
|
/**
|
|
45
48
|
* Format preset, e.g. `19 Sep 2020`
|
|
46
49
|
*/
|
|
47
|
-
export declare const FMT_dMMMyyyy: (x
|
|
50
|
+
export declare const FMT_dMMMyyyy: (x?: MaybeDate, utc?: boolean) => string;
|
|
48
51
|
/**
|
|
49
52
|
* Format preset, e.g. `17:08`
|
|
50
53
|
*/
|
|
51
|
-
export declare const FMT_HHmm: (x
|
|
54
|
+
export declare const FMT_HHmm: (x?: MaybeDate, utc?: boolean) => string;
|
|
52
55
|
/**
|
|
53
56
|
* Format preset, e.g. `5:08 PM`
|
|
54
57
|
*/
|
|
55
|
-
export declare const FMT_hm: (x
|
|
58
|
+
export declare const FMT_hm: (x?: MaybeDate, utc?: boolean) => string;
|
|
56
59
|
/**
|
|
57
60
|
* Format preset, e.g. `17:08:01`
|
|
58
61
|
*/
|
|
59
|
-
export declare const FMT_HHmmss: (x
|
|
62
|
+
export declare const FMT_HHmmss: (x?: MaybeDate, utc?: boolean) => string;
|
|
60
63
|
/**
|
|
61
64
|
* Format preset, e.g. `5:08:01 PM`
|
|
62
65
|
*/
|
|
63
|
-
export declare const FMT_hms: (x
|
|
66
|
+
export declare const FMT_hms: (x?: MaybeDate, utc?: boolean) => string;
|
|
64
67
|
/**
|
|
65
68
|
* Format preset, e.g. `20200919-170801`
|
|
66
69
|
*/
|
|
67
|
-
export declare const FMT_yyyyMMdd_HHmmss: (x
|
|
70
|
+
export declare const FMT_yyyyMMdd_HHmmss: (x?: MaybeDate, utc?: boolean) => string;
|
|
68
71
|
/**
|
|
69
72
|
* ISO8601 format preset (without millisecond term), e.g.
|
|
70
73
|
* `2020-09-19T17:08:01Z`
|
|
71
74
|
*/
|
|
72
|
-
export declare const FMT_ISO_SHORT: (x
|
|
75
|
+
export declare const FMT_ISO_SHORT: (x?: MaybeDate, utc?: boolean) => string;
|
|
73
76
|
/**
|
|
74
77
|
* ISO8601 format preset (with millisecond term), e.g.
|
|
75
78
|
* `2020-09-19T17:08:01.123Z`
|
|
76
79
|
*/
|
|
77
|
-
export declare const FMT_ISO: (x
|
|
80
|
+
export declare const FMT_ISO: (x?: MaybeDate, utc?: boolean) => string;
|
|
78
81
|
//# sourceMappingURL=format.d.ts.map
|
package/format.js
CHANGED
|
@@ -148,6 +148,9 @@ export const FORMATTERS = {
|
|
|
148
148
|
* instead of local time (default).
|
|
149
149
|
*
|
|
150
150
|
* @remarks
|
|
151
|
+
* If no date is given to the returned formatter, `Date.now()` will be used by
|
|
152
|
+
* default.
|
|
153
|
+
*
|
|
151
154
|
* See {@link FORMATTERS} for available date component format IDs. To escape a
|
|
152
155
|
* formatter and use as a string literal, prefix the term with `\\`.
|
|
153
156
|
*
|
|
@@ -164,7 +167,7 @@ export const FORMATTERS = {
|
|
|
164
167
|
*
|
|
165
168
|
* @param fmt -
|
|
166
169
|
*/
|
|
167
|
-
export const defFormat = (fmt) => (x, utc = false) => {
|
|
170
|
+
export const defFormat = (fmt) => (x = Date.now(), utc = false) => {
|
|
168
171
|
let d = ensureDate(x);
|
|
169
172
|
utc && (d = new Date(d.getTime() + d.getTimezoneOffset() * MINUTE));
|
|
170
173
|
return fmt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/date",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"thi.ng": {
|
|
130
130
|
"year": 2020
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "f696c94665a3adef4fa475d99dd2e18ceb15863f\n"
|
|
133
133
|
}
|