Fix: correct French VAT (FR) validation regex and add tests#2584
Fix: correct French VAT (FR) validation regex and add tests#2584rubiin merged 1 commit intovalidatorjs:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2584 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2536 2536
Branches 642 642
=========================================
Hits 2536 2536 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WikiRik
left a comment
There was a problem hiding this comment.
For future improvement we might want to look at some leniency for whitespaces in between the 'segments' (so something like FR 12 345678912 might be valid as well) but on a quick search I didn't find good resources for that. For now this is already an improvement.
I do also see all resources pointing towards requiring FR at the start, so that's also a change I'm approving
|
Thanks for the review! I agree — adding leniency for whitespaces could be a useful future improvement. For now, I’ll leave it strict since that’s what most resources confirm. |
|
For "whitespaces", we could remove all of them from the string before validating it with the regex. Currently, validation without whitespaces seems to me more reliable than a version that allows them. |
Fixes #2582
Summary
This PR fixes the French VAT number validation.
Changes
FR+ 2 digits + 9 digits (SIREN).