Skip to content

Commit

Permalink
Merge pull request #739 from avilcan/master
Browse files Browse the repository at this point in the history
isPostalCode validation for AU locale was checking for six digits instead of four
  • Loading branch information
chriso authored Oct 24, 2017
2 parents 375de50 + 78f36c0 commit 76834c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const sixDigit = /^\d{6}$/;

const patterns = {
AT: fourDigit,
AU: sixDigit,
AU: fourDigit,
BE: fourDigit,
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
CH: fourDigit,
Expand Down
10 changes: 10 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4932,6 +4932,16 @@ describe('Validators', function () {

it('should validate postal code', function () {
const fixtures = [
{
locale: 'AU',
valid: [
'4000',
'2620',
'3000',
'2017',
'0800',
],
},
{
locale: 'CA',
valid: [
Expand Down

0 comments on commit 76834c4

Please sign in to comment.