phonelib
phonelib copied to clipboard
Problem on parsing numbers that starts with 0685
Hello,
We have found an edge case bug with the parse function of Phonelib.
Phonelib.parse(number)
works fine for every 10 digits french numbers like 0635374637
but with numbers starting with 0685, it have a weird behaviour.
For exemple parsing the number 0685123456
will have this output
[4] pry(main)> Phonelib.parse('0685123456')
=> #<Phonelib::Phone:0x00007f888cf92a88
@data=
{"WS"=>
{:id=>"WS",
:country_code=>"685",
:international_prefix=>"0",
:national=>"123456",
:format=>{:pattern=>"(\\d+)(\\d{3})(\\d{4})", :format=>"$1 $2 $3"},
:valid=>[],
:possible=>[:toll_free, :fixed_line]}},
@extension="",
@national_number="123456",
@original="0685123456",
@original_s="0685123456",
@sanitized="0685123456">
It understands that the country code is 685
and the national number 123456
the national number should be 0685123456
and not 123456
Any idea how we could fix this ?
Thanks ! 😄
@yann120 do you have any way to provide country for phone validator? Or in case you are parsing french phones only you can define default_country for the gem.