@thi.ng/date 2.7.1 → 2.7.3

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +23 -14
  3. package/package.json +5 -5
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-03-01T15:22:50Z
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
@@ -1,16 +1,5 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
  <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
3
- > [!IMPORTANT]
4
- > ‼️ Announcing the thi.ng user survey 2024 📋
5
- >
6
- > [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
7
- > (open until end of February)
8
- >
9
- > **To achieve a better sample size, I'd highly appreciate if you could
10
- > circulate the link to this survey in your own networks.**
11
- >
12
- > [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
13
-
14
3
  # ![@thi.ng/date](https://media.thi.ng/umbrella/banners-20230807/thing-date.svg?954b4ac2)
15
4
 
16
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/date.svg)](https://www.npmjs.com/package/@thi.ng/date)
@@ -22,7 +11,7 @@
22
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
23
12
  > and anti-framework.
24
13
  >
25
- > 🚀 Help me to work full-time on these projects by [sponsoring me on
14
+ > 🚀 Please help me to work full-time on these projects by [sponsoring me on
26
15
  > GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
27
16
 
28
17
  - [About](#about)
@@ -280,8 +269,8 @@ Dates can be formatted as relative descriptions using
280
269
  [`formatRelative()`](https://docs.thi.ng/umbrella/date/functions/formatRelative.html)
281
270
  and
282
271
  [`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).
272
+ Both functions use the currently active [locale](#locales) and accept an
273
+ optional reference date (default: `now()`).
285
274
 
286
275
  ```ts
287
276
  setLocale(EN_LONG);
@@ -374,8 +363,10 @@ string literal, prefix the term with `\\`.
374
363
 
375
364
  The following preset formatters are available:
376
365
 
366
+ - `FMT_ISO` - `"2020-09-13T21:42:07.123Z"`
377
367
  - `FMT_ISO_SHORT` - `"2020-09-13T21:42:07Z"`
378
368
  - `FMT_yyyyMMdd` - `"2020-09-13"`
369
+ - `FMT_yyyyMMdd_ALT` - `"20200913"`
379
370
  - `FMT_Mdyyyy` - `"9/13/2020"`
380
371
  - `FMT_MMMdyyyy` - `"Sep 13 2020"`
381
372
  - `FMT_dMyyyy` - `"13/9/2020"`
@@ -384,7 +375,25 @@ The following preset formatters are available:
384
375
  - `FMT_HHmm` - `"21:42"`
385
376
  - `FMT_hm` - `"9:42 PM"`
386
377
  - `FMT_HHmmss` - `"21:42:07"`
378
+ - `FMT_HHmmss_ALT` - `"214207"`
387
379
  - `FMT_hms` - `"9:42:07 PM"`
380
+ - `FMT_yyyy` - `"2020"` (4 digit year)
381
+ - `FMT_MM` - `"12"` (2 digit month)
382
+ - `FMT_ww` - `"52"` (2 digit week)
383
+ - `FMT_dd` - `"28"` (2 digit day in month)
384
+ - `FMT_HH` - `"23"` (2 digit hour, 24h system)
385
+ - `FMT_mm` - `"59"` (2 digit minute)
386
+ - `FMT_ss` - `"01"` (2 digit second)
387
+
388
+ All formatters are fully composable/nestable, i.e. new formats can be created
389
+ using existing formats like so:
390
+
391
+ ```ts
392
+ import { defFormat, FMT_HHmmss, FMT_yyyyMMdd } from "@thi.ng/date";
393
+
394
+ defFormat([FMT_yyyyMMdd, " @ ", FMT_HHmmss])();
395
+ // "2024-02-28 @ 12:05:47"
396
+ ```
388
397
 
389
398
  ### Timecodes
390
399
 
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.3",
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.26",
39
- "@thi.ng/checks": "^3.5.0",
40
- "@thi.ng/strings": "^3.7.17"
38
+ "@thi.ng/api": "^8.9.27",
39
+ "@thi.ng/checks": "^3.5.1",
40
+ "@thi.ng/strings": "^3.7.19"
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": "d660ae8fd1bf64d919b4334f19509f1f539d70f6\n"
136
136
  }