Rates for currencies the ECB lacks (ALL); only list currencies in circulation #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/currency-rates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes two currency problems: no exchange rate for the Albanian lek (ALL), and a picker full of currencies that no longer exist.
Why
Intl.supportedValuesOf('currency'), which in Chrome and Firefox includes historical codes (ATS, DEM, …).What changed
RATES_EXTRA_URL, defaulthttps://open.er-api.com/v6/latest/EUR; empty turns it off) on the existing 6-hour schedule.rates_extratable. The ECB rate always wins for a currency both publish.GET /api/ratesmerges the two and addssources: { CODE: "xr:<date>" }for supplementary rates.rateSource: "xr:<date>". The editor shows "Rates By Exchange Rate API, {date}" with a link to exchangerate-api.com, which the free tier requires. Added to both locales.ACTIVE_CURRENCIES(packages/core/src/currencies.ts, hand-maintained ISO 4217 list, 154 codes). This also drops recently replaced codes (BGN → EUR 2026, HRK, ANG → XCG, ZWL → ZWG, SLL → SLE, CUC) and non-cash units (XDR, XSU)./api/ratesnow returns 400 for impossible dates like2026-13-45; before, the new date math would have thrown a 500 on them.SPEC.md§8.2 andREADME.mdupdated.Limitations
Tested
npm test: core 26/26, server 15/15 (new: merge and ECB precedence, week staleness cutoff, feed parsing, bad dates, currency list).npm run check: 0 errors, 0 warnings.npm run build && npm run test:e2e: 2/2 pass./api/ratesreturned ALL = 90.93754 (xr:2026-11-06) and CZK from the ECB. In Chromium the picker showed 152 currencies under "Daily rate" (ALL included), 2 under manual (KPW, SVC), and no ATS/BGN/non-ISO codes.xr:label in the expense editor. No automated test covers it either.🤖 Generated with Claude Code
https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x
Browsers' Intl.supportedValuesOf('currency') includes long-withdrawn codes (ATS, DEM, ...). Use a hand-maintained ACTIVE_CURRENCIES list in core instead, which also drops recently replaced ones (BGN, HRK, ANG, ZWL, SLL, CUC) and non-cash units (XDR, XSU). A withdrawn currency already in use stays selectable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x