Skip to content

fix(isISO4217): sync the currency list with the ISO 4217 register - #2936

Open
yu2971512385-ui wants to merge 1 commit into
validatorjs:masterfrom
yu2971512385-ui:fix/iso4217-sync-register
Open

yu2971512385-ui wants to merge 1 commit into
validatorjs:masterfrom
yu2971512385-ui:fix/iso4217-sync-register

Conversation

@yu2971512385-ui

Copy link
Copy Markdown

isISO4217 is documented in the README as checking for an officially assigned currency code, but its list was copied from Wikipedia and has gone stale. Checked against ISO 4217 list one as published on 2026-09-17, it accepts four codes the register has withdrawn and rejects three it assigns.

code why
remove ANG replaced by XCG on 2025-03-31
remove BGN Bulgaria adopted the euro on 2026-01-01
remove SLL replaced by SLE on 2022-04-01
remove ZWL replaced by ZWG on 2024-04-05
add XAD Arab Accounting Dinar
add XCG Caribbean Guilder
add ZWG Zimbabwe Gold

After the change the set matches the register exactly: 178 codes, nothing extra and nothing missing.

On the four removals

They are a behaviour change — strings that used to validate no longer will — so they are worth a deliberate look. Two things suggest they are what the validator already intends:

  • the README says "officially assigned", and these four are not;
  • the existing suite already asserts that HRK and CUC, withdrawn in 2023 and 2021, are invalid. ZWL and SLL are the same case, just more recent.

If you would rather keep withdrawn codes accepted for backwards compatibility, say so and I will cut this down to the three additions.

Relation to #2842

#2842 by @simonkundrik adds XCG and ZWG and has been open since August. This change includes both of those, plus XAD and the four removals. Whichever you prefer, that PR found the problem first.

Tests

XAD, XCG and ZWG added to valid; ANG, BGN, SLL and ZWL added to invalid, alongside the HRK and CUC already there. The test fails on master and passes with the fix. Full suite: 323 passing, npm run lint clean. The source comment now cites the register and the date of the list it was checked against, instead of Wikipedia.

🤖 Generated with Claude Code

The list was taken from Wikipedia and has not kept up. Checked against ISO
4217 list one as published on 2026-09-17, it accepts four codes the register
has withdrawn and rejects three it assigns:

  removed  ANG  replaced by XCG on 2025-03-31
  removed  BGN  Bulgaria adopted the euro on 2026-01-01
  removed  SLL  replaced by SLE on 2022-04-01
  removed  ZWL  replaced by ZWG on 2024-04-05
  added    XAD  Arab Accounting Dinar
  added    XCG  Caribbean Guilder
  added    ZWG  Zimbabwe Gold

The README documents isISO4217 as checking for an officially assigned code,
and the suite already asserts that the withdrawn HRK and CUC are invalid, so
the four removals follow the behaviour the validator already claims.

The source comment now points at the register itself rather than at
Wikipedia, with the date of the list it was checked against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9ff3424) to head (535201d).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2936   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2599      2599           
  Branches       658       658           
=========================================
  Hits          2599      2599           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant