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
6 changes: 6 additions & 0 deletions src/ie/pps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ describe('ie/pps', () => {
expect(result.isValid && result.compact).toEqual('6433435IH');
});

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

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

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

Expand Down
9 changes: 5 additions & 4 deletions src/ie/pps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* When present (which should be the case for new numbers as of 2013),
* the second letter can be 'A' (for individuals) or 'H' (for
* non-individuals, such as limited companies, trusts, partnerships
* and unincorporated bodies). Pre-2013 values may have 'W', 'T',
* or 'X' as the second letter ; it is ignored by the check.
* and unincorporated bodies). As of 2024, 'B' was accepted as a
* second letter on all new PPS numbers. Pre-2013 values may have
* 'W', 'T', or 'X' as the second letter ; it is ignored by the check.
*
* Source
*
Expand All @@ -23,7 +24,7 @@ function clean(input: string): ReturnType<typeof strings.cleanUnicode> {
return strings.cleanUnicode(input, ' -');
}

const ppsRe = /^\d{7}[A-W][AHWTX]?$/;
const ppsRe = /^\d{7}[A-W][ABHWTX]?$/;

const impl: Validator = {
name: 'Irish Personal Number',
Expand Down Expand Up @@ -58,7 +59,7 @@ const impl: Validator = {
return { isValid: false, error: new exceptions.InvalidFormat() };
}

if (value.length === 9 && 'AH'.includes(value[8])) {
if (value.length === 9 && 'ABH'.includes(value[8])) {
if (
value[7] !== calcCheckDigit(`${value.substr(0, 7)}${value.substr(8)}`)
) {
Expand Down
Loading