libphonenumber-js 1.12.25 → 1.12.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -69,6 +69,19 @@ And edit the README:
69
69
 
70
70
  <!-- CHANGELOG START -->
71
71
 
72
+ 1.12.26 / 7.11.2025
73
+ ===================
74
+
75
+ * Updated metadata to version 9.0.18:
76
+ - Updated phone metadata for region code(s):
77
+ AU, BJ, CC, CX, ET, IL, IR, MC, PY, QA, SG, SV, TJ, UG, ZA
78
+ - Updated short number metadata for region code(s): PY
79
+ - Updated geocoding data for country calling code(s): 61 (en)
80
+ - Updated carrier data for country calling code(s):
81
+ 61 (en), 65 (en), 98 (en, fa), 229 (en), 256 (en), 372 (en), 377 (en),
82
+ 503 (en), 972 (en), 992 (en)
83
+ - Updated / refreshed time zone meta data.
84
+
72
85
  1.12.25 / 24.10.2025
73
86
  ===================
74
87
 
package/README.md CHANGED
@@ -335,19 +335,38 @@ As for "custom" metadata, it could be used in those rare cases when not all coun
335
335
 
336
336
  ### Country code
337
337
 
338
- A "country code" is a [two-letter ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) (like `"US"`). <!-- or a special `001` country code used for ["non-geographic entities"](#non-geographic) (as per [Google's libphonenumber library](https://github.com/googlei18n/libphonenumber/blob/0068d861a68d3d4612f7bf8646ab844dd3cefce5/java/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java#L23-L24)). -->
339
-
340
- This library supports all [officially assigned](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) ISO alpha-2 country codes, plus a few extra ones: `AC` ([Ascension Island](https://en.wikipedia.org/wiki/Ascension_Island)), `TA` ([Tristan da Cunha](https://en.wikipedia.org/wiki/Tristan_da_Cunha)), `XK` ([Kosovo](https://en.wikipedia.org/wiki/Kosovo)).
341
-
342
- <!--
343
- var countries = []
344
- for (const code of Object.keys(country_calling_codes)) {
345
- countries = countries.concat(country_calling_codes[code])
346
- }
347
- console.log(countries.length)
348
- -->
349
-
350
- To check whether a country code is supported, use [`isSupportedCountry()`](#issupportedcountrycountry-string-boolean) function.
338
+ A "country code" is a two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) like `"US"`, `"CA"`, etc. <!-- or a special `001` country code used for ["non-geographic entities"](#non-geographic) (as per [Google's libphonenumber library](https://github.com/googlei18n/libphonenumber/blob/0068d861a68d3d4612f7bf8646ab844dd3cefce5/java/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java#L23-L24)). -->
339
+
340
+ However, this library uses the term "country code" rather broadly and it includes both the [official](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) ISO country codes and a few of unofficial "country codes" (listed below). For that reason, a developer should use a "country code" returned from this library with caution in an application that only expects the official ISO "country codes" to exist. For example, such application will likely not have a label or a flag for such an unofficial "country code". In that case, a developer could manually transform an unofficial "country code" returned from this library to an official ISO country code of the most suitable "parent" country.
341
+
342
+ Here's the list of the unofficial "country codes":
343
+ * `AC` — [Ascension Island](https://en.wikipedia.org/wiki/Ascension_Island)
344
+ * Ascension Island is officially part of [Saint Helena, Ascension and Tristan da Cunha
345
+ ](https://en.wikipedia.org/wiki/Saint_Helena,_Ascension_and_Tristan_da_Cunha) (`SH`). Yet, it has been assigned its own country calling code of `+247` and has its own telephone numbering plan. An unofficial code of `AC` is used for it in Google's `libphonenumber`.
346
+ * `AC` is also an official ["exceptional reservation"](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Reserved_code_elements) code for Ascension Island in the ISO-3166-1 standard.
347
+ * `TA` — [Tristan da Cunha](https://en.wikipedia.org/wiki/Tristan_da_Cunha)
348
+ * Tristan da Cunha is officially part of [Saint Helena, Ascension and Tristan da Cunha
349
+ ](https://en.wikipedia.org/wiki/Saint_Helena,_Ascension_and_Tristan_da_Cunha) (`SH`). For the purpose of differentiating Tristan da Cunha phone numbers from [Saint Helena](https://en.wikipedia.org/wiki/Saint_Helena) phone numbers, an unofficial code of `TA` is used for it in Google's `libphonenumber`.
350
+ * `TA` is also an official ["exceptional reservation"](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Reserved_code_elements) code for Tristan da Cunha in the ISO-3166-1 standard.
351
+ * `SH` — [Saint Helena](https://en.wikipedia.org/wiki/Saint_Helena)
352
+ * Saint Helena is officially part of [Saint Helena, Ascension and Tristan da Cunha
353
+ ](https://en.wikipedia.org/wiki/Saint_Helena,_Ascension_and_Tristan_da_Cunha) (`SH`). For the purpose of differentiating Saint Helena phone numbers from [Tristan da Cunha](https://en.wikipedia.org/wiki/Tristan_da_Cunha) phone numbers, the official code of `SH` is only used for Saint Helena in Google's `libphonenumber`.
354
+ * `XK` — [Kosovo](https://en.wikipedia.org/wiki/Kosovo)
355
+ * History: Kosovo separated from Yugoslavia (present Serbia, `RS`) after a civil war in 1998-1999 and a follow-up NATO's bombing of Yugoslavia in 1999. Kosovo officially (unilaterally) declared its independence from Serbia in 2008. Due to the mixed opinions on the legitimacy of NATO's intervention, about half of the United Nations member states currently support Kosovo's independence while the rest of them don't, so Kosovo is currently not assigned any ISO alpha-2 country code.
356
+ * Kosovo has been assigned its own country calling code of `+383` and has its own telephone numbering plan. An unofficial code of `XK` is used for it in Google's `libphonenumber`.
357
+ * `XK` is not an ["exceptional reservation"](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Reserved_code_elements) code in the ISO-3166-1 standard, but it's still being used by various international organizations as a temporary "country code" for Kosovo.
358
+
359
+ There're also other territories with a disputed status of an independent state, whose country calling code or telephone numbering plan is different from the one used by their "official" parent territory. These territories are currently not implemented in this library but they could potentially be implemented in some future:
360
+ * `XA` — [Abkhazia](https://en.wikipedia.org/wiki/Abkhazia)
361
+ * History: Abkhazia officially (unilaterally) declared its independence from [Georgia](https://en.wikipedia.org/wiki/Georgia_(country)) (`GE`) in 1994 after a 1992-1994 civil war. The first state to officially recognize Abkhazia's independence was Russia in 2008.
362
+ * Abkhazia currently shares a country calling code of `+7` with Russia but has [unique prefixes](https://en.wikipedia.org/wiki/Telephone_numbers_in_Russia#Codes_assigned_to_Abkhazia) of `840` and `940`.
363
+ * `XA` is not an ["exceptional reservation"](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Reserved_code_elements) code in the ISO-3166-1 standard, but it's still being used by some organizations as a temporary "country code" for Abkhazia.
364
+ * `XO` — [South Ossetia](https://en.wikipedia.org/wiki/South_Ossetia)
365
+ * History: South Ossetia officially (unilaterally) declared its independence from [Georgia](https://en.wikipedia.org/wiki/Georgia_(country)) (`GE`) in 1992 after a 1991–1992 civil war. The first state to officially recognize South Ossetia's independence was Russia in 2008.
366
+ * South Ossetia currently shares a country calling code of `+7` with Russia but has [unique prefixes](https://en.wikipedia.org/wiki/Telephone_numbers_in_Russia#Codes_assigned_to_South_Ossetia) of `850` and `929`.
367
+ * `XO` is not an ["exceptional reservation"](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Reserved_code_elements) code in the ISO-3166-1 standard, but it's still being used by some organizations as a temporary "country code" for South Ossetia.
368
+
369
+ To check whether a certain two-letter "country code" is supported by this library, use [`isSupportedCountry()`](#issupportedcountrycountry-string-boolean) function.
351
370
 
352
371
  ### Non-geographic
353
372
 
@@ -400,7 +419,7 @@ Returns an instance of [`PhoneNumber`](#phonenumber) class, or `undefined` if no
400
419
 
401
420
  Available `options`:
402
421
 
403
- * `defaultCountry: string` — Default [country](#country-code) for parsing numbers written in non-international form (without a `+` sign). Will be ignored when parsing numbers written in international form (with a `+` sign). Instead of passing it as `options.defaultCountry`, one could also pass it as a standalone `defaultCountry` argument (for convenience).
422
+ * `defaultCountry: string` — Default [country code](#country-code) for parsing numbers written in non-international form (without a `+` sign). Will be ignored when parsing numbers written in international form (with a `+` sign). Instead of passing it as `options.defaultCountry`, one could also pass it as a standalone `defaultCountry` argument (for convenience).
404
423
 
405
424
  * `defaultCallingCode: string` — Default calling code for parsing numbers written in non-international form (without a `+` sign). Will be ignored when parsing numbers written in international form (with a `+` sign). It could be specified when parsing phone numbers belonging to ["non-geographic numbering plans"](#non-geographic) which by nature don't have a country code, making the `defaultCountry` option unusable.
406
425
 
@@ -904,7 +923,7 @@ asYouType.getTemplate() === 'xx xxx xxx xxxx'
904
923
 
905
924
  For legacy API (before version `1.6.0`) the formatter instance provides the following getters:
906
925
 
907
- * `country: string?` — Phone number [country](#country-code). Will return `undefined` if the country couldn't be derived from the number.
926
+ * `country: string?` — The [country code](#country-code) of the phone number. Will return `undefined` if the country couldn't be derived from the number.
908
927
 
909
928
  * `getNationalNumber(): string` — Returns the national (significant) number part of the phone number.
910
929
 
@@ -1082,7 +1101,7 @@ Although Google's javascript port doesn't provide the `findPhoneNumbersInText()`
1082
1101
 
1083
1102
  ### getExampleNumber(country: string, examples: object): PhoneNumber
1084
1103
 
1085
- Returns an example phone number for a [country](#country-code). Returns an instance of [`PhoneNumber`](#phonenumber) class. Will return `undefined` if `country` doesn't exist or isn't supported by this library.
1104
+ Returns an example phone number for a [country code](#country-code). Returns an instance of [`PhoneNumber`](#phonenumber) class. Will return `undefined` if `country` doesn't exist or isn't supported by this library.
1086
1105
 
1087
1106
  ```js
1088
1107
  import examples from 'libphonenumber-js/mobile/examples'
@@ -1095,7 +1114,7 @@ phoneNumber.formatNational() === '8 (912) 345-67-89'
1095
1114
 
1096
1115
  ### isSupportedCountry(country: string): boolean
1097
1116
 
1098
- Checks if a [country](#country-code) is supported by this library.
1117
+ Checks if a given [country code](#country-code) is supported by this library.
1099
1118
 
1100
1119
  ```js
1101
1120
  isSupportedCountry('RU') === true
@@ -1114,7 +1133,7 @@ getCountries() === ["AC", "AD", ...]
1114
1133
 
1115
1134
  ### getCountryCallingCode(country: string): string
1116
1135
 
1117
- Returns [country calling code](#country-calling-code) for a [country](#country-code). Will throw an error if `country` doesn't exist or isn't supported by this library.
1136
+ Returns [country calling code](#country-calling-code) for a [country code](#country-code). Will throw an error if `country` doesn't exist or isn't supported by this library.
1118
1137
 
1119
1138
  ```js
1120
1139
  getCountryCallingCode('RU') === '7'
@@ -1123,7 +1142,7 @@ getCountryCallingCode('IL') === '972'
1123
1142
 
1124
1143
  ### getExtPrefix(country: string): string
1125
1144
 
1126
- Returns phone number extension prefix for a given [country](#country-code). If no custom ext prefix is defined for a `country` then the default `" ext. "` prefix is returned.
1145
+ Returns phone number extension prefix for a given [country code](#country-code). If no custom ext prefix is defined for a `country` then the default `" ext. "` prefix is returned.
1127
1146
 
1128
1147
  ```js
1129
1148
  getExtPrefix('US') === ' ext. '