@dokebi/i18n 0.2.0 → 0.2.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/AI.md CHANGED
@@ -207,13 +207,13 @@ const at = fromWallTime(zone, '2026-11-02T09:00'); // a schedule
207
207
  - `fromWallTime(zone, text)`: a time a summer-time change skips is taken after the gap (02:30 → 03:30), a repeated one is the earlier.
208
208
  - `addDays`, `addMonths`, `daysBetween` (both ends counted), `weekStart(day, firstDay = 1)` (0 Sunday … 6 Saturday), `presetRange(zone, preset, now?, firstDay?)` for `today`, `yesterday`, `last7`, `last30`, `thisWeek`, `thisMonth`, `lastMonth` (`DATE_PRESETS`).
209
209
  - `offsetMinutes(zone, ms)`, `zoneOffsets(zone, year)` (`['+9']`, `['+1', '+2']`, `['+5:30']`: a label's offsets), `isWholeHourZone(zone)` (whole hours from two years back to two years ahead), `checkZone(zone, { wholeHours? })` (the canonical name), `WHOLE_HOUR_ZONES` (43 zones east to west whose offset is always whole hours — the choices of a site whose reports count UTC hours into days, as @dokebi/rollups requires; the labels belong to your catalogs).
210
- - A bad day, month, time, count or preset is `CalendarError` `INVALID_DATE`, a bad zone `INVALID_ZONE`: status 400 with `plugin: 'dokebi-i18n'` and `data.field`, so a route that passes query input straight in answers 400 through @dokebi/web.
210
+ - A bad day, month, time, instant (not finite epoch ms, `data.field` `ms`), count or preset is `CalendarError` `INVALID_DATE`, a bad zone `INVALID_ZONE`: status 400 with `plugin: 'dokebi-i18n'` and `data.field`, so a route that passes query input straight in answers 400 through @dokebi/web.
211
211
 
212
212
  <!-- docs-check: complete-error-codes CalendarErrorCode -->
213
213
 
214
214
  | Code | Meaning |
215
215
  |---|---|
216
- | `INVALID_DATE` | not a real `YYYY-MM-DD` day, `YYYY-MM` month or `YYYY-MM-DDTHH:mm` time, `to` before `from`, a count or preset out of range (400) |
216
+ | `INVALID_DATE` | not a real `YYYY-MM-DD` day, `YYYY-MM` month or `YYYY-MM-DDTHH:mm` time, an instant that is not a finite number of epoch ms, `to` before `from`, a count or preset out of range (400) |
217
217
  | `INVALID_ZONE` | not an IANA time zone, or not whole hours with `wholeHours` (400) |
218
218
 
219
219
  ## Errors
package/dist/calendar.js CHANGED
@@ -96,6 +96,10 @@ function formatOf(zone) {
96
96
  return format;
97
97
  }
98
98
  function wall(zone, ms) {
99
+ // An instant from a request (`Number(query.at)`) that is no time: a coded 400, not Intl's
100
+ // RangeError (a 500).
101
+ if (typeof ms !== 'number' || !Number.isFinite(ms) || Math.abs(ms) > 8.64e15)
102
+ throw new CalendarError('INVALID_DATE', 'An instant is epoch milliseconds', 'ms');
99
103
  const out = {};
100
104
  for (const part of formatOf(zone).formatToParts(ms))
101
105
  if (part.type !== 'literal')
package/dist/plugin.js CHANGED
@@ -82,7 +82,7 @@ export class I18nRuntime {
82
82
  }
83
83
  export const createPlugin = definePlugin({
84
84
  name: 'dokebi-i18n',
85
- version: '0.2.0',
85
+ version: '0.2.1',
86
86
  core: '^0.4.0',
87
87
  options,
88
88
  contributes: [localeData],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/i18n",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Compiled translation catalogs, locale negotiation, cardinal plurals and named Intl formats.",
5
5
  "keywords": [
6
6
  "dokebi",
@@ -97,6 +97,6 @@
97
97
  }
98
98
  },
99
99
  "devDependencies": {
100
- "@dokebi/web": "0.4.3"
100
+ "@dokebi/web": "0.4.4"
101
101
  }
102
102
  }