Code Monkey home page Code Monkey logo

Comments (6)

akfernun avatar akfernun commented on July 28, 2024

Hey @ksouthworth!

Have you checked out this method?

from telephone_number.

ksouthworth avatar ksouthworth commented on July 28, 2024

Yes I've seen that formatter method, but that only works when we already have a phone number, correct? In this case I don't know the phone # or country code yet on the front end, until the user submits the form/page.

from telephone_number.

akfernun avatar akfernun commented on July 28, 2024

@ksouthworth, I see now. That makes sense. I'm not sure that it's something we'll be able to do. Here's why:

Phone number validation/formatting in North America is pretty straight-forward because we really only have 1 standard format that we abide by. For example, we know that all phone numbers will be 10 digits long which makes providing a formatting "hint" easy. The problem is that other countries don't have simple rules like this. Phone numbers within a single country can be of varying lengths and some of the formats are entirely dependent on the phone number itself. This means we wouldn't really be talking about a single hint, but rather many different hints (or formats) that the input could abide by.

If you don't know the formatting or the country code yet, there really are an infinite number of hints that we could provide.

Does that clear things up?

from telephone_number.

ksouthworth avatar ksouthworth commented on July 28, 2024

Yes that makes sense. If we knew the country code ahead of time, would that narrow the list of possible hints down to a reasonable number (1 to 3) you think?

If we knew the Country Code when the page loaded, could possibly show a hint (or 2) that way...?

from telephone_number.

akfernun avatar akfernun commented on July 28, 2024

Hey @ksouthworth,

Unfortunately, I don't think it's going to be something we'll be able to support. Because countries can support many different formats, we won't be able to narrow it down to just one or two. Additionally, formatting rules are generally with regex, so extract hints from regex would be a pretty difficult task.

from telephone_number.

ksouthworth avatar ksouthworth commented on July 28, 2024

Ok, thanks for considering it, and thanks for this gem!

from telephone_number.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.