temporal-fmt 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +38 -36
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  Format `Temporal.PlainDate` / `PlainTime` / `PlainDateTime` / `ZonedDateTime` objects
4
4
  using date-fns-style token strings.
5
5
 
6
- Native `Temporal` shipped in Node 26 and modern browsers, but it deliberately has
7
- no custom-string formatter — the TC39 authors punted that to userland in favor of
8
- `Intl.DateTimeFormat`. This fills that specific gap for people who want the
9
- `'yyyy-MM-dd'`-style syntax they already know from date-fns / moment / dayjs.
6
+ Node 26 shipped native `Temporal`, and it's deliberately missing a custom-string
7
+ formatter — TC39 left that to userland in favor of `Intl.DateTimeFormat`. This
8
+ fills that gap if you want `'yyyy-MM-dd'` syntax like you're used to from
9
+ date-fns, moment, or dayjs.
10
10
 
11
- Zero dependencies. Requires a global `Temporal` (native in Node 26+, or bring your
12
- own polyfill like `temporal-polyfill`).
11
+ Zero dependencies. You'll need a global `Temporal` (native in Node 26+, or bring
12
+ your own polyfill `temporal-polyfill` works fine).
13
13
 
14
14
  ## Install
15
15
 
@@ -33,42 +33,44 @@ const zdt = Temporal.ZonedDateTime.from('2026-08-04T15:45:30-04:00[America/New_Y
33
33
  format(zdt, 'yyyy-MM-dd HH:mm zzz'); // "2026-08-04 15:45 America/New_York"
34
34
  ```
35
35
 
36
- Quote literal text with single quotes: `'at'`. Use `''` for a literal single quote.
36
+ Quote literal text with single quotes, like `'at'` above. Use `''` if you need a
37
+ literal single quote.
37
38
 
38
39
  ## Tokens
39
40
 
40
- | Token | Meaning | Example |
41
- |-------|------------------|---------|
42
- | yyyy | 4-digit year | 2026 |
43
- | yy | 2-digit year | 26 |
44
- | MMMM | full month name | August |
45
- | MMM | short month name | Aug |
46
- | MM | 2-digit month | 08 |
47
- | M | month | 8 |
48
- | dd | 2-digit day | 04 |
49
- | d | day | 4 |
50
- | EEEE | full weekday | Tuesday |
51
- | EEE | short weekday | Tue |
52
- | HH | 2-digit hour (24h) | 15 |
53
- | H | hour (24h) | 15 |
54
- | hh | 2-digit hour (12h) | 03 |
55
- | h | hour (12h) | 3 |
56
- | mm | 2-digit minute | 45 |
57
- | m | minute | 45 |
58
- | ss | 2-digit second | 30 |
59
- | s | second | 30 |
60
- | SSS | milliseconds | 000 |
61
- | a | AM/PM | PM |
62
- | zzz | IANA time zone id | America/New_York |
63
-
64
- Passing a token the input type doesn't support (e.g. `HH` on a `PlainDate`) throws
65
- a clear error instead of silently printing `undefined`.
41
+ | Token | Meaning | Example |
42
+ |-------|--------------------|---------|
43
+ | yyyy | 4-digit year | 2026 |
44
+ | yy | 2-digit year | 26 |
45
+ | MMMM | full month name | August |
46
+ | MMM | short month name | Aug |
47
+ | MM | 2-digit month | 08 |
48
+ | M | month | 8 |
49
+ | dd | 2-digit day | 04 |
50
+ | d | day | 4 |
51
+ | EEEE | full weekday | Tuesday |
52
+ | EEE | short weekday | Tue |
53
+ | HH | 2-digit hour (24h) | 15 |
54
+ | H | hour (24h) | 15 |
55
+ | hh | 2-digit hour (12h) | 03 |
56
+ | h | hour (12h) | 3 |
57
+ | mm | 2-digit minute | 45 |
58
+ | m | minute | 45 |
59
+ | ss | 2-digit second | 30 |
60
+ | s | second | 30 |
61
+ | SSS | milliseconds | 000 |
62
+ | a | AM/PM | PM |
63
+ | zzz | IANA time zone id | America/New_York |
64
+
65
+ Pass a token the input type doesn't support `HH` on a `PlainDate`, say — and
66
+ you get a clear error instead of a silent `undefined`.
66
67
 
67
68
  ## Dev notes
68
69
 
69
- `tsconfig.json` sets `ignoreDeprecations: "6.0"` as a workaround for a tsup bug
70
- (tsup#1388/#1389) tsup's dts build step injects a deprecated `baseUrl` internally,
71
- which TypeScript 6+ hard-errors on. Remove this once tsup ships a fix upstream.
70
+ `tsconfig.json` sets `ignoreDeprecations: "6.0"` to work around a tsup bug
71
+ (tsup#1388/#1389): tsup's dts build step injects a deprecated `baseUrl`
72
+ internally, and TypeScript 6+ hard-errors on it. Drop this once tsup ships a fix
73
+ upstream.
72
74
 
73
75
  ## License
74
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "temporal-fmt",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Format Temporal.PlainDate/PlainDateTime/PlainTime/ZonedDateTime objects using date-fns-style token strings.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,4 +50,4 @@
50
50
  "engines": {
51
51
  "node": ">=24"
52
52
  }
53
- }
53
+ }