GithubHelp home page GithubHelp logo

Comments (3)

catamphetamine avatar catamphetamine commented on July 21, 2024

Not getting the behaviour you described.
On the demo page I can enter 1234+ and then 5 and it still retains the full number (except for the national prefix which is expected for the US)
https://catamphetamine.github.io/libphonenumber-js/

    <!-- United States -->
    <!-- Note the national prefix of US is the same as its country code, and when formatting phone
         numbers in the national format, it is not included. Therefore, we omit it here to make
         formatting consistent with the rest of the world. The same applies to all the
         countries/regions under NANPA -->

from libphonenumber-js.

mahyarr avatar mahyarr commented on July 21, 2024

Seems like on the demo page, you're explicitly stripping out plus signs if they are not at the beginning of the value before passing it on to the asYouType. I guess I could use the same technique. Thanks for your quick response.

parse={(character, value) =>
{
  // Leading plus is allowed
  if (character === '+')
  {
    if (!value)
    {
      return character
    }
  }

  // Digits are allowed
  return parseDigit(character)
}}

from libphonenumber-js.

catamphetamine avatar catamphetamine commented on July 21, 2024

It's not about the demo page.
Until you provide a test case illustrating the issue there's no proof that such an issue exists.
https://github.com/catamphetamine/libphonenumber-js/blob/master/test/as%20you%20type.js

from libphonenumber-js.

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.