Skip to content

Commit

Permalink
Replace the postal code pattern for Bahrain. Fixes #157.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojanz committed Mar 14, 2021
1 parent e506e39 commit 00c263f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions resources/library_customizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
function get_address_format_customizations($countryCode) {
$formatCustomizations = [];
// Replace the postal code pattern.
// https://github.com/google/libaddressinput/issues/207
$formatCustomizations['BH'] = [
'postal_code_pattern' => '(?:^|\b)(?:1[0-2]|[1-9])\d{2}(?:$|\b)',
];
// Make the locality required.
$formatCustomizations['CO'] = [
'required_fields' => [
Expand Down
2 changes: 1 addition & 1 deletion src/AddressFormat/AddressFormatRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected function getDefinitions()
],
'BH' => [
'format' => "%givenName %familyName\n%organization\n%addressLine1\n%addressLine2\n%locality %postalCode",
'postal_code_pattern' => '(?:\d|1[0-2])\d{2}',
'postal_code_pattern' => '(?:^|\b)(?:1[0-2]|[1-9])\d{2}(?:$|\b)',
],
'BJ' => [
'uppercase_fields' => [
Expand Down

0 comments on commit 00c263f

Please sign in to comment.