@thi.ng/date 2.6.0 → 2.7.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-22T11:59:16Z
3
+ - **Last updated**: 2024-02-22T23:15:26Z
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.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.7.0) (2024-02-22)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add single component formatter presets ([661a4b7](https://github.com/thi-ng/umbrella/commit/661a4b7))
17
+
12
18
  ## [2.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/date@2.6.0) (2024-02-22)
13
19
 
14
20
  #### 🚀 Features
package/format.d.ts CHANGED
@@ -65,7 +65,7 @@ export declare const FMT_hm: (x?: MaybeDate, utc?: boolean) => string;
65
65
  */
66
66
  export declare const FMT_HHmmss: (x?: MaybeDate, utc?: boolean) => string;
67
67
  /**
68
- * Format preset, e.g. `17:08:01`
68
+ * Format preset, e.g. `170801`
69
69
  */
70
70
  export declare const FMT_HHmmss_ALT: (x?: MaybeDate, utc?: boolean) => string;
71
71
  /**
@@ -86,6 +86,34 @@ export declare const FMT_ISO_SHORT: (x?: MaybeDate, utc?: boolean) => string;
86
86
  * `2020-09-19T17:08:01.123Z`
87
87
  */
88
88
  export declare const FMT_ISO: (x?: MaybeDate, utc?: boolean) => string;
89
+ /**
90
+ * Format preset, 4-digit year only
91
+ */
92
+ export declare const FMT_yyyy: (x?: MaybeDate, utc?: boolean) => string;
93
+ /**
94
+ * Format preset, 2-digit month only
95
+ */
96
+ export declare const FMT_MM: (x?: MaybeDate, utc?: boolean) => string;
97
+ /**
98
+ * Format preset, 2-digit week in year only
99
+ */
100
+ export declare const FMT_ww: (x?: MaybeDate, utc?: boolean) => string;
101
+ /**
102
+ * Format preset, 2-digit day in month only
103
+ */
104
+ export declare const FMT_dd: (x?: MaybeDate, utc?: boolean) => string;
105
+ /**
106
+ * Format preset, 2-digit hour only
107
+ */
108
+ export declare const FMT_HH: (x?: MaybeDate, utc?: boolean) => string;
109
+ /**
110
+ * Format preset, 2-digit minute only
111
+ */
112
+ export declare const FMT_mm: (x?: MaybeDate, utc?: boolean) => string;
113
+ /**
114
+ * Format preset, 2-digit second only
115
+ */
116
+ export declare const FMT_ss: (x?: MaybeDate, utc?: boolean) => string;
89
117
  /**
90
118
  * Takes a `date` and optional reference `base` date and (also optional
91
119
  * `prec`ision, i.e. number of fractional digits, default: 0). Computes the
package/format.js CHANGED
@@ -179,6 +179,13 @@ const FMT_ISO_SHORT = defFormat(
179
179
  const FMT_ISO = defFormat(
180
180
  ["yyyy", "-", "MM", "-", "dd", "T", "HH", ":", "mm", ":", "ss", ".", "SS", "ZZ"]
181
181
  );
182
+ const FMT_yyyy = defFormat(["yyyy"]);
183
+ const FMT_MM = defFormat(["MM"]);
184
+ const FMT_ww = defFormat(["ww"]);
185
+ const FMT_dd = defFormat(["dd"]);
186
+ const FMT_HH = defFormat(["HH"]);
187
+ const FMT_mm = defFormat(["mm"]);
188
+ const FMT_ss = defFormat(["ss"]);
182
189
  const formatRelative = (date, base = /* @__PURE__ */ new Date(), prec = 0, eps = 100) => {
183
190
  const delta = difference(date, base);
184
191
  if (Math.abs(delta) < eps)
@@ -238,17 +245,24 @@ const formatDurationParts = (parts, prec = "s") => {
238
245
  }).filter((x) => !!x).join(", ");
239
246
  };
240
247
  export {
248
+ FMT_HH,
241
249
  FMT_HHmm,
242
250
  FMT_HHmmss,
243
251
  FMT_HHmmss_ALT,
244
252
  FMT_ISO,
245
253
  FMT_ISO_SHORT,
254
+ FMT_MM,
246
255
  FMT_MMMdyyyy,
247
256
  FMT_Mdyyyy,
248
257
  FMT_dMMMyyyy,
249
258
  FMT_dMyyyy,
259
+ FMT_dd,
250
260
  FMT_hm,
251
261
  FMT_hms,
262
+ FMT_mm,
263
+ FMT_ss,
264
+ FMT_ww,
265
+ FMT_yyyy,
252
266
  FMT_yyyyMMdd,
253
267
  FMT_yyyyMMdd_ALT,
254
268
  FMT_yyyyMMdd_HHmmss,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/date",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -132,5 +132,5 @@
132
132
  "thi.ng": {
133
133
  "year": 2020
134
134
  },
135
- "gitHead": "4513a1c703bdbf0f0867f03e547e47692e415fac\n"
135
+ "gitHead": "16f2b92b5410bd35dcde6c2971c8e62783ebc472\n"
136
136
  }