Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/fifty-ads-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@obosbbl/format": patch
---

fix formatting of Swedish phone numbers that start with the area code 010

Previously it didn't recognize 010 as a 3 digit area code, so the format would be wrong.

```js
// before
formatPhoneNumber('010-1234567'); // -> 0101-23 45 67
// after
formatPhoneNumber('010-1234567'); // -> 010-123 45 67
```
1 change: 1 addition & 0 deletions packages/format/src/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('se', () => {
['081234567', '08-123 45 67'],
['0812345678', '08-123 456 78'],
// 3 digit area code
['010-123 45 67', '010-123 45 67'],
['03112345', '031-123 45'],
['031123456', '031-12 34 56'],
['0311234567', '031-123 45 67'],
Expand Down
2 changes: 1 addition & 1 deletion packages/format/src/se.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const SUBSCRIBER_NUMBER_FORMATS = {
// SE numbers have area codes of 2, 3 or 4 digits
const TWO_DIGIT_AREA_CODE = /^08/;
const THREE_DIGIT_AREA_CODE =
/^0(11|13|16|18|19|21|23|26|31|33|35|36|40|42|44|46|54|60|63|90)/;
/^0(10|11|13|16|18|19|21|23|26|31|33|35|36|40|42|44|46|54|60|63|90)/;

/**
* Format a phone number.
Expand Down