Skip to content

Commit 6b42030

Browse files
author
InfinitiesLoop
committed
Fixed IE bug with phone formatting
1 parent f11a4a4 commit 6b42030

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

demo-contacts.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ $.extend($.convertFn, {
1818
phone: function(value) {
1919
// turn a string phone number into a normalized one with dashes
2020
// and parens
21-
value = parseInt(value.replace(/[\(\)\- ]/g, ""), 10).toString();
22-
value = ("0000000000" + value).substr(-10);
21+
value = (parseInt(value.replace(/[\(\)\- ]/g, ""), 10) || 0).toString();
22+
value = "0000000000" + value;
23+
value = value.substr(value.length - 10);
2324
value = "(" + value.substr(0,3) + ") " + value.substr(3,3) + "-" + value.substr(6);
2425
return value;
2526
},

0 commit comments

Comments
 (0)