Skip to content

Commit c174a1f

Browse files
Rajput-Balramrajput-balramrubiin
authored
fix(isPostalCode): improve FR locale (#2479)
Co-authored-by: rajput-balram <[email protected]> Co-authored-by: Rubin Bhandari <[email protected]>
1 parent 7ff247d commit c174a1f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/lib/isPostalCode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const patterns = {
2828
EE: fiveDigit,
2929
ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/,
3030
FI: fiveDigit,
31-
FR: /^\d{2}\s?\d{3}$/,
31+
FR: /^(?:(?:0[1-9]|[1-8]\d|9[0-5])\d{3}|97[1-46]\d{2})$/,
3232
GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,
3333
GR: /^\d{3}\s?\d{2}$/,
3434
HR: /^([1-5]\d{4}$)/,

test/validators.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12427,10 +12427,16 @@ describe('Validators', () => {
1242712427
locale: 'FR',
1242812428
valid: [
1242912429
'75008',
12430+
'44522',
12431+
'38499',
12432+
'39940',
12433+
'01000',
12434+
],
12435+
invalid: [
1243012436
'44 522',
12431-
'98025',
1243212437
'38 499',
12433-
'39940',
12438+
'96000',
12439+
'98025',
1243412440
],
1243512441
},
1243612442
{

0 commit comments

Comments
 (0)