-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phony has trouble validating luxembourg phone numbers #276
Comments
Hi Julien, Phony operates on these rules: https://github.com/floere/phony/blob/master/lib/phony/countries.rb#L595-L602 Can you have a look at them and let me know which ones are incorrect? (The rules are, hopefully, understandable – and if not, let me know) Cheers & thanks! |
The rules are understandable, however, I don't know what the specs are for luxembourg numbers, especially regarding length. Looks like the minimum length for landlines is 6 digits total excluding the country code (formatted by 3 groups of 2). Mobile numbers are always 9 digits (formatted by 3 groups of 3, or 1 group of 3 and 3 groups of 2). The regexp I don't understand how it validates the length in the first condition If I try to format "+352 44 55 66" which should be formatted exactly how I've written it is formatted differently by Phony:
On the upside, all mobile numbers seem to work fine. While the formatting is ok to me, the length validation seems to be causing the issue with plausible? but I cannot find where this length validation is done. |
After a bit of fiddling, I ended up with the following rules that seem to do what I want:
I am not sure it is interesting to separate numbers starting with 4 to give them a different formatting as they are more commonly formatted XX XX XX and not X XX XXX so I removed the first rule altogether. I also added a few rules to match numbers with extensions. I will monkey patch the gem on my test environment to do more tests in the next few days. |
Looking good! (Small typo: "didigts") Do you know how to change the Phony code (fork etc.), how to run the tests ( |
(And if the tests don't run, feel free to adapt the tests – within reason – according to how Luxembourg is supposed to work) |
Yes, I will fork and submit a PR if i can do that behind our company proxy, otherwise it will have to wait until next week. |
@jdel Thanks! (Protip: Use |
Any update on this? @jdel? I just ran into the same issue and would put some time into fixing this, but if you already did the work, there's not much use in doing it again 😄 Number in question for me is |
I'm happy for any and all PRs 😊 |
@klaustopher Since it's been 4 months already, I think you can go ahead :) |
Sorry guys, the last time I tried to download the github client on my corporate computer, I got flagged for potential virus and my computer was rebuilt :/ I have since monkey patched phony on my live environment and it is running happily with the following rules:
@klaustopher Feel free to submit a PR, as I will definitely not have time to look at the tests. Also, I tried the number you are having trouble with, and it validates fine with my rules. |
Ok, thanks I will have a go at it in the next days ;) |
@floere, yes feel free too, I will not have a chance to look at the tests anytime soon. |
@klaustopher Should I keep this open? |
Yes, please, I will get on this probably next week ;) |
So, last week got so many other things in front of this one, that I was actually planning to do this during the bug fixing day tomorrow, but now @bdewater has already completed it. Cool 😎 ... Works fine with the numbers I had trouble with |
Hello,
I am using phony to validate phone numbers that users input with international format.
Some valid numbers are not plausible according to phony. Example numbers are:
+352 44 55 66
+352 54 52 58
+352 81 81 81
+352 35 72 14 1
I don't understand why some numbers will validate and not others. So far, I have seen that all the 6 digits numbers don't validate, some 7 don't, but some, like this one, will:
+352 40 22 66 1
I am pretty sure this one has a base phone number of 40 22 66 with extension 1.
I already looked in the code, but I'm not familiar with telephony in general so I'm pretty much useless at troubleshooting this issue.
Any advice would be much appreciated.
Thanks and regards.
The text was updated successfully, but these errors were encountered: