diff --git a/.changeset/tall-symbols-enjoy.md b/.changeset/tall-symbols-enjoy.md new file mode 100644 index 0000000..7a83fe2 --- /dev/null +++ b/.changeset/tall-symbols-enjoy.md @@ -0,0 +1,5 @@ +--- +"@obosbbl/validation": patch +--- + +add checksum validation of Swedish organization numbers. Previously we only checked the length of the number. diff --git a/packages/validation/src/se.ts b/packages/validation/src/se.ts index d3a3f14..d41cc2b 100644 --- a/packages/validation/src/se.ts +++ b/packages/validation/src/se.ts @@ -81,7 +81,7 @@ export function validateOrganizationNumber( value = stripFormatting(value); } - return /^\d{10}$/.test(value); + return /^\d{10}$/.test(value) && mod10(value); } type NationalIdentityNumberFormat = 'short' | 'long';