From e4b0bf03afce19023e24c1aa23f82af6becc2cf8 Mon Sep 17 00:00:00 2001 From: hebulin Date: Tue, 14 Jul 2026 12:05:25 +0800 Subject: [PATCH] fix(isTaxID): correct dk-DK century digit 5-8 year threshold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Danish CPR numbers (dk-DK), when the century digit is 5, 6, 7, or 8, the correct century mapping is: - year 00-57 → 2000s - year 58-99 → 1800s The previous code incorrectly used the same thresholds as the 4/9 case (year < 37 / year > 58), leaving a gap for years 37-58 that caused otherwise valid CPR numbers to be rejected. Fixes #2818 --- src/lib/isTaxID.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index 3a87fd0b9..2fcd25a95 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -232,12 +232,10 @@ function dkDkCheck(tin) { } break; default: - if (year < 37) { + if (year < 58) { year = `20${year}`; - } else if (year > 58) { - year = `18${year}`; } else { - return false; + year = `18${year}`; } break; }