Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/nz/ird.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ describe('nz/ird', () => {
expect(result.error).toBeInstanceOf(InvalidComponent);
});

// Valid since Inland Revenue raised the upper limit to 200,000,000 (2026)
it('validate:150000009', () => {
const result = validate('150000009');

expect(result.isValid && result.compact).toEqual('150000009');
});

it('validate:199-999-990', () => {
const result = validate('199-999-990');

expect(result.isValid && result.compact).toEqual('199999990');
});

// Valid check digit, but above the upper limit
it('validate:200000005', () => {
const result = validate('200000005');

expect(result.error).toBeInstanceOf(InvalidComponent);
});

it('validate:123478', () => {
const result = validate('123478');

Expand Down
14 changes: 10 additions & 4 deletions src/nz/ird.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
* The IRD number is used by the New Zealand Inland Revenue Department (Te Tari Taake)
* to identify businesses and individuals for tax purposes. The number consists of 8 or 9 digits
* where the last digit is a check digit. Valid numbers lie between 10-000-000
* and 150-000-000.
* and 200-000-000.
*
* In February 2026 Inland Revenue raised the maximum valid IRD number from
* 150,000,000 to 200,000,000. python-stdnum still uses 150,000,000 as the
* upper limit, so this module deliberately differs from it there.
*
* Source
* https://www.ird.govt.nz/updates/news-folder/2026/increase-to-ird-number-validation-upper-limit
* https://www.ird.govt.nz/
* https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/nz/ird.py (range)
* https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/nz/ird.py
* https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/New%20Zealand-TIN.pdf
*
* PERSON/ENTITY
Expand Down Expand Up @@ -68,9 +73,10 @@ const impl: Validator = {
if (!strings.isdigits(value)) {
return { isValid: false, error: new exceptions.InvalidFormat() };
}
// Numbers outside this range have not been (or will not soon be) issued
// Numbers outside this range are not valid IRD numbers (upper limit raised
// from 150,000,000 to 200,000,000 by Inland Revenue in February 2026)
const num = parseInt(value, 10);
if (num <= 10000000 || num >= 150000000) {
if (num <= 10000000 || num >= 200000000) {
return { isValid: false, error: new exceptions.InvalidComponent() };
}

Expand Down
Loading