@eldrajs/sdk 0.4.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -9,6 +9,15 @@ platform repository.
9
9
 
10
10
  ## Unreleased
11
11
 
12
+ - **`installIcelandicIntl()` (new entry `@eldrajs/sdk/format/intl`)** — Icelandic for code that calls
13
+ `Intl` itself (date pickers, vue-i18n, chart libraries). Where the runtime has no Icelandic data,
14
+ it patches `Intl.NumberFormat`, `Intl.DateTimeFormat`, `Number.prototype.toLocaleString` and
15
+ `Date.prototype.toLocale{,Date,Time}String` so Icelandic requests use this package's data; every
16
+ other locale stays with the runtime. Opt-in, nothing runs on import; `{ force: true }` patches
17
+ runtimes that have Icelandic too (use it on both sides of a server render), and the function the
18
+ installing call returns restores the runtime; a repeat call is a no-op. Only dates in a UTC zone
19
+ are patched; a date in another zone, the runtime's default included, stays with the runtime.
20
+
12
21
  - **Campaign attribution (WS-546, contract 5.4.0).** `captureCampaignAttribution(url?)` keeps a
13
22
  landing URL's `utm_source`, `utm_medium`, `utm_campaign` and `utm_id` (as `campaignId`, only when
14
23
  it is a uuid) in `localStorage` for 30 days, replacing an earlier landing whole; nothing else, and
package/README.md CHANGED
@@ -83,6 +83,27 @@ same methods. `./format/list`, `./format/relative-time` and `./format/display-na
83
83
  Import only the entries you use; each carries its own data. The rules and what it costs are in
84
84
  [docs/icelandic-formatting.md](../../docs/icelandic-formatting.md).
85
85
 
86
+ ### Code that calls `Intl` itself
87
+
88
+ A date picker, vue-i18n's `n()`/`d()` or a chart library formats with `Intl` directly. Opt in to
89
+ Icelandic there with one call, before anything formats:
90
+
91
+ ```ts
92
+ import { installIcelandicIntl } from '@eldrajs/sdk/format/intl';
93
+
94
+ installIcelandicIntl();
95
+ ```
96
+
97
+ Where the runtime has no Icelandic, it patches `Intl.NumberFormat`, `Intl.DateTimeFormat`,
98
+ `Number.prototype.toLocaleString` and `Date.prototype.toLocale{,Date,Time}String` so a request for
99
+ Icelandic is formatted from this package's data. Every other locale goes to the runtime untouched,
100
+ so a browser on `en-GB` keeps `12/10/2026`. Where the runtime has Icelandic (Node, Safari, Firefox)
101
+ it does nothing, unless `{ force: true }`; a server render installs it with `force` on both sides so
102
+ the two match. The call that installs it returns a function that restores the runtime's `Intl`; a
103
+ later call while it is installed returns one that does nothing. Dates in a zone other than UTC, the
104
+ runtime's default included, stay with the runtime and can print in English; pass `timeZone: 'UTC'`.
105
+ Lists, relative times, names and sorting are not patched; use the functions above.
106
+
86
107
  ## What is in the client
87
108
 
88
109
  | Group | Methods |