Cimpress-MCP / postal-codes-js

Provide postal code validation for javascript
Apache License 2.0
43 stars 36 forks source link

Invalid validation for PL postal code #50

Closed MariuszHenn closed 4 years ago

MariuszHenn commented 4 years ago

In reference to official documents (https://www.poczta-polska.pl/hermes/uploads/2013/11/spispna.pdf, https://bip.poczta-polska.pl/bez-kategorii/system-pocztowych-numerow-adresowych-pna/), and other sources (https://en.wikipedia.org/wiki/Postal_codes_in_Poland, https://en.wikipedia.org/wiki/List_of_postal_codes), postal code format for Poland is NN-NNN, then - is not redundant and should not be removed.

Now is:

{
  "Description": "PL : 99-999",
  "RedundantCharacters": " -",
  "ValidationRegex": "^[0-9]{5}$",
  "TestData": {
    "Valid": [
      "44100",
      "44-100"
    ],
    "Invalid": [
      "44f00",
      "e4410",
      "44-100d",
      "c44-100",
      "b44100",
      "44100a"
    ]
  }
}

should be:

{
  "Description": "PL : 99-999",
  "RedundantCharacters": " ",
  "ValidationRegex": "^[0-9]{2}-[0-9]{3}$",
  "TestData": {
    "Valid": [
      "44-100"
    ],
    "Invalid": [
      "44100",
      "44f00",
      "e4410",
      "44-100d",
      "c44-100",
      "b44100",
      "44100a"
    ]
  }
}
wenceslauslee commented 4 years ago

Thanks for raising the issue. The PR below should have resolved it.

https://github.com/Cimpress-MCP/postal-codes-js/pull/51