@fr0st/datetime 7.0.0 → 8.0.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.
package/Formats.md CHANGED
@@ -449,27 +449,6 @@
449
449
  </tbody>
450
450
  </table>
451
451
  <p><em>* Output only</em></p>
452
- <p><strong>Narrow month and weekday names are output only. See the compatibility matrix below for intentionally unsupported widths.</strong></p>
452
+ <p><strong>Narrow month and weekday names are output only. Use the token widths shown above; unsupported widths throw an error.</strong></p>
453
453
  <p><strong>Characters wrapped in <code>'</code> quotes are treated as literal text. A doubled apostrophe (<code>''</code>) represents one literal apostrophe during formatting and parsing, including inside quoted text: <code>yyyy 'o''clock'</code> → <code>2019 o'clock</code>.</strong></p>
454
454
  <p><strong>Numeric date and time fields use the active locale's numbering system during formatting and parsing, including non-BMP digits when supported by the runtime.</strong></p>
455
-
456
- ## PHP `IntlDateFormatter` token-width compatibility
457
-
458
- The expected PHP behavior was recorded with PHP 8.5.9 and ICU 70.1 using the Gregorian calendar. “Equivalent” describes the pattern-width behavior; localized names can still vary with the ICU data installed in each runtime.
459
-
460
- | Tokens | Supported widths | Status and PHP behavior |
461
- |---|---|---|
462
- | `G` | All | Equivalent: widths 1–3 and 6+ are abbreviated, 4 is long, and 5 is narrow. |
463
- | `y`, `Y` | All | Equivalent: `yy` uses the two low-order digits; other widths set minimum numeric padding, such as `yyyyy` → `02018`. |
464
- | `Q`, `q` | 1–2 and 5+ | Equivalent numeric and narrow/fallback forms. Widths 3–4 are intentionally unsupported because PHP uses localized quarter forms such as `Q2` and `2nd quarter`, which JavaScript `Intl` does not expose. |
465
- | `M`, `L` | All for formatting; all except 5 for parsing | Equivalent: widths 3–5 are abbreviated, long, and narrow names; widths 6+ return to padded numbers, such as `MMMMMM` → `000006`. Narrow names are output only because they are not reliably unique. |
466
- | `w`, `W`, `d`, `D`, `F` | All | Equivalent numeric padding, such as `www` → `022` and `dddd` → `0001`. |
467
- | `E`, `e`, `c` | All except 6; width 5 is output only | Widths 1–5 and 7+ are equivalent. Width 6 is intentionally unsupported because PHP uses a distinct short form such as `EEEEEE` → `Fr`, which JavaScript `Intl` does not expose. Narrow names are output only because they are not reliably unique. |
468
- | `a` | 1–4 | Equivalent for abbreviated and long day periods. Widths 5+ are intentionally unsupported because PHP uses narrow values such as `p`, which JavaScript `Intl` does not reliably expose. |
469
- | `h`, `H`, `K`, `k`, `m`, `s` | All | Equivalent numeric padding. |
470
- | `S` | All | Supported with millisecond precision: formatting pads beyond three digits with zeroes and parsing truncates additional precision. |
471
- | `z` | All, output only | Equivalent width selection: widths 1–3 are short and 4+ are long. The exact name depends on runtime ICU data. |
472
- | `Z` | All | Equivalent: widths 1–3 are basic offsets, 4 and 6+ are localized GMT, and 5 is an extended ISO offset. |
473
- | `O` | 1 and 4 | Width 4 is equivalent. Width 1 uses a two-digit hour (`GMT-04`) instead of PHP’s `GMT-4`; other widths are intentionally unsupported. |
474
- | `V` | 2 | Equivalent IANA time-zone ID. PHP’s short ID, exemplar city, and generic location widths are intentionally unsupported. |
475
- | `X`, `x` | 1–5 | Equivalent ISO offset widths. Widths 6+ are intentionally unsupported. |
package/README.md CHANGED
@@ -42,7 +42,7 @@ Load the bundle from your own copy or a CDN:
42
42
  <script src="https://cdn.jsdelivr.net/npm/@fr0st/datetime@latest/dist/frost-datetime.min.js"></script>
43
43
  <script>
44
44
  const date = DateTime.now({ timeZone: 'UTC' });
45
- console.log(date.toISOString());
45
+ console.log(date.toIsoString());
46
46
  </script>
47
47
  ```
48
48
 
@@ -62,7 +62,7 @@ const nextWeek = meeting.addWeeks(1);
62
62
  nextWeek.toString();
63
63
  // Mon Mar 30 2026 09:30:00 +1000 (Australia/Brisbane)
64
64
 
65
- nextWeek.toISOString();
65
+ nextWeek.toIsoString();
66
66
  // 2026-03-29T23:30:00.000+00:00
67
67
 
68
68
  nextWeek.monthName();
@@ -87,11 +87,11 @@ FrostDateTime revolves around an immutable `DateTime` class and a small set of p
87
87
  const a = DateTime.fromArray([2026, 3, 23], { timeZone: 'UTC' });
88
88
  const b = a.addDays(1);
89
89
 
90
- a.toISOString(); // 2026-03-23T00:00:00.000+00:00
91
- b.toISOString(); // 2026-03-24T00:00:00.000+00:00
90
+ a.toIsoString(); // 2026-03-23T00:00:00.000+00:00
91
+ b.toIsoString(); // 2026-03-24T00:00:00.000+00:00
92
92
 
93
93
  new DateTime('January 1, 2019 00:00:00', { timeZone: 'Australia/Brisbane' })
94
- .toISOString();
94
+ .toIsoString();
95
95
  // 2018-12-31T14:00:00.000+00:00
96
96
  ```
97
97
 
@@ -154,7 +154,7 @@ A time-only `fromFormat()` pattern starts from January 1, 1970 in the requested
154
154
  DateTime.fromFormat('yyyyMMddHHmmss', '20190102123456');
155
155
  ```
156
156
 
157
- `fromFormat()` rejects output-only or intentionally unsupported token widths. The compatibility matrix in [Formats.md](./Formats.md#php-intldateformatter-token-width-compatibility) records the supported PHP behavior and known differences.
157
+ `fromFormat()` rejects output-only or intentionally unsupported token widths.
158
158
 
159
159
  Format tokens are documented in [Formats.md](./Formats.md).
160
160
 
@@ -164,7 +164,7 @@ Format tokens are documented in [Formats.md](./Formats.md).
164
164
  - `toString()`: `eee MMM dd yyyy HH:mm:ss xx (VV)`
165
165
  - `toDateString()`: `eee MMM dd yyyy`
166
166
  - `toTimeString()`: `HH:mm:ss xx (VV)`
167
- - `toISOString()`: `yyyy-MM-dd'T'HH:mm:ss.SSSxxx` in English and UTC
167
+ - `toIsoString()`: `yyyy-MM-dd'T'HH:mm:ss.SSSxxx` in English and UTC
168
168
  - `toJSON()`: same UTC ISO string for valid dates, `null` for invalid dates
169
169
  - `toUTCString()`: `toString()` shape in English and UTC
170
170
 
@@ -384,9 +384,9 @@ DateTime.clearDataCache();
384
384
 
385
385
  - Constructor-based parsing throws on invalid strings or unsupported time zones.
386
386
  - `fromFormat()` rejects trailing characters and marks impossible parsed dates as `isValid === false`.
387
- - `fromISOString()` parses the RFC 3339 / ISO-style shape used by `toISOString()`.
388
- - `toISOString()` always returns a UTC string regardless of the instance time zone.
389
- - `toJSON()` returns the same value as `toISOString()` for valid dates and `null` for invalid dates.
387
+ - `fromISOString()` parses the RFC 3339 / ISO-style shape used by `toIsoString()`.
388
+ - `toIsoString()` always returns a UTC string regardless of the instance time zone.
389
+ - `toJSON()` returns the same value as `toIsoString()` for valid dates and `null` for invalid dates.
390
390
  - `withTimeZone()` keeps the same instant and changes representation.
391
391
  - `withTimeZoneOffset()` returns a fixed-offset view of the same instant.
392
392
  - A nonexistent local wall time moves forward to the next valid time, while a repeated wall time uses the later occurrence.