From 0e6566d0c550724a1ca28461e0bfd2e0eeda3a08 Mon Sep 17 00:00:00 2001 From: Bojan Zivanovic Date: Sat, 7 Oct 2023 18:18:04 +0200 Subject: [PATCH] Change the locality type for Great Britain to town/city. Source: https://www.royalmail.com/personal/receiving-mail/update-your-address --- const.go | 1 + formats.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/const.go b/const.go index 60354b9..77c5cd3 100644 --- a/const.go +++ b/const.go @@ -64,6 +64,7 @@ const ( LocalityTypeDistrict LocalityTypePostTown LocalityTypeSuburb + LocalityTypeTownCity ) var localityTypeNames = [...]string{"city", "district", "post_town", "suburb"} diff --git a/formats.go b/formats.go index 72a6fca..c33b7f5 100644 --- a/formats.go +++ b/formats.go @@ -498,7 +498,7 @@ var formats = map[string]Format{ "GB": { Layout: "%1\n%2\n%3\n%L\n%P", Required: []Field{FieldLine1, FieldLocality, FieldPostalCode}, - LocalityType: LocalityTypePostTown, + LocalityType: LocalityTypeTownCity, PostalCodePattern: `GIR ?0AA|(?:(?:AB|AL|B|BA|BB|BD|BF|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(?:\d[\dA-Z]? ?\d[ABD-HJLN-UW-Z]{2}))|BFPO ?\d{1,4}`, }, "GE": {