@thi.ng/date 2.7.1 → 2.7.2

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-25T14:07:53Z
3
+ - **Last updated**: 2024-02-28T14:23:30Z
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.
package/README.md CHANGED
@@ -280,8 +280,8 @@ Dates can be formatted as relative descriptions using
280
280
  [`formatRelative()`](https://docs.thi.ng/umbrella/date/functions/formatRelative.html)
281
281
  and
282
282
  [`formatRelativeParts()`](https://docs.thi.ng/umbrella/date/functions/formatRelativeParts.html).
283
- Both functions use the currently active [locale](#locales) and accept an optional
284
- reference date (default: now).
283
+ Both functions use the currently active [locale](#locales) and accept an
284
+ optional reference date (default: `now()`).
285
285
 
286
286
  ```ts
287
287
  setLocale(EN_LONG);
@@ -374,8 +374,10 @@ string literal, prefix the term with `\\`.
374
374
 
375
375
  The following preset formatters are available:
376
376
 
377
+ - `FMT_ISO` - `"2020-09-13T21:42:07.123Z"`
377
378
  - `FMT_ISO_SHORT` - `"2020-09-13T21:42:07Z"`
378
379
  - `FMT_yyyyMMdd` - `"2020-09-13"`
380
+ - `FMT_yyyyMMdd_ALT` - `"20200913"`
379
381
  - `FMT_Mdyyyy` - `"9/13/2020"`
380
382
  - `FMT_MMMdyyyy` - `"Sep 13 2020"`
381
383
  - `FMT_dMyyyy` - `"13/9/2020"`
@@ -384,7 +386,25 @@ The following preset formatters are available:
384
386
  - `FMT_HHmm` - `"21:42"`
385
387
  - `FMT_hm` - `"9:42 PM"`
386
388
  - `FMT_HHmmss` - `"21:42:07"`
389
+ - `FMT_HHmmss_ALT` - `"214207"`
387
390
  - `FMT_hms` - `"9:42:07 PM"`
391
+ - `FMT_yyyy` - `"2020"` (4 digit year)
392
+ - `FMT_MM` - `"12"` (2 digit month)
393
+ - `FMT_ww` - `"52"` (2 digit week)
394
+ - `FMT_dd` - `"28"` (2 digit day in month)
395
+ - `FMT_HH` - `"23"` (2 digit hour, 24h system)
396
+ - `FMT_mm` - `"59"` (2 digit minute)
397
+ - `FMT_ss` - `"01"` (2 digit second)
398
+
399
+ All formatters are fully composable/nestable, i.e. new formats can be created
400
+ using existing formats like so:
401
+
402
+ ```ts
403
+ import { defFormat, FMT_HHmmss, FMT_yyyyMMdd } from "@thi.ng/date";
404
+
405
+ defFormat([FMT_yyyyMMdd, " @ ", FMT_HHmmss])();
406
+ // "2024-02-28 @ 12:05:47"
407
+ ```
388
408
 
389
409
  ### Timecodes
390
410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/date",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@thi.ng/api": "^8.9.26",
39
39
  "@thi.ng/checks": "^3.5.0",
40
- "@thi.ng/strings": "^3.7.17"
40
+ "@thi.ng/strings": "^3.7.18"
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": "6e20f80dd9df1c8055ffa3c1e4d6f7598add0c0b\n"
135
+ "gitHead": "190d68e7f7524631b333cfdbf32c6a23be27c166\n"
136
136
  }