File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @obosbbl/format " : patch
3+ ---
4+
5+ fix formatting of Swedish phone numbers that start with the area code 010
6+
7+ Previously it didn't recognize 010 as a 3 digit area code, so the format would be wrong.
8+
9+ ``` js
10+ // before
11+ formatPhoneNumber (' 010-1234567' ); // -> 0101-23 45 67
12+ // after
13+ formatPhoneNumber (' 010-1234567' ); // -> 010-123 45 67
14+ ```
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ describe('se', () => {
5050 [ '081234567' , '08-123 45 67' ] ,
5151 [ '0812345678' , '08-123 456 78' ] ,
5252 // 3 digit area code
53+ [ '010-123 45 67' , '010-123 45 67' ] ,
5354 [ '03112345' , '031-123 45' ] ,
5455 [ '031123456' , '031-12 34 56' ] ,
5556 [ '0311234567' , '031-123 45 67' ] ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const SUBSCRIBER_NUMBER_FORMATS = {
1111// SE numbers have area codes of 2, 3 or 4 digits
1212const TWO_DIGIT_AREA_CODE = / ^ 0 8 / ;
1313const THREE_DIGIT_AREA_CODE =
14- / ^ 0 ( 1 1 | 1 3 | 1 6 | 1 8 | 1 9 | 2 1 | 2 3 | 2 6 | 3 1 | 3 3 | 3 5 | 3 6 | 4 0 | 4 2 | 4 4 | 4 6 | 5 4 | 6 0 | 6 3 | 9 0 ) / ;
14+ / ^ 0 ( 1 0 | 1 1 | 1 3 | 1 6 | 1 8 | 1 9 | 2 1 | 2 3 | 2 6 | 3 1 | 3 3 | 3 5 | 3 6 | 4 0 | 4 2 | 4 4 | 4 6 | 5 4 | 6 0 | 6 3 | 9 0 ) / ;
1515
1616/**
1717 * Format a phone number.
You can’t perform that action at this time.
0 commit comments