question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Phone lib addon - parentheses

See original GitHub issue

I wasn’t able to find any issues around this, but wanted to know if there was ever any talk about adding more formatting options around a specific country code’s formatting. For example, a US number looks like this currently: 555 555 5555 but it’d be great if there was an option to surround that text like so (555) 555-5555.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

13reactions
stephenjwatkinscommented, Jun 4, 2018

Until #348 is addressed, I’m adding an extra block and delimiter for the space. It’s not the ideal aesthetic (since the space is inserted only when the next number is inputted), but I found it more important to have the ability to backspace.

new Cleave(this.el, {
  numericOnly: true,
  blocks: [0, 3, 0, 3, 4],
  delimiters: ["(", ")", " ", "-"],
});
8reactions
nosircommented, Aug 7, 2018

@Schw2iizer To use custom blocks or phone: true, you can only choose one option, they don’t work together, by using phone: true, it resolves blocks automatically for you, and in that case, you can only define single delimiter. TLDR; either:

options={{
blocks:[0, 3, 0, 3, 4],
delimiters: ['(', ')', ' ', '-']
}}

or

options={{
phone: true,
phoneRegionCode: 'US',
delimiter: '-'
}}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting Phone Number Inputs - YouTube
Start learning with the Covalence community at https://covalence.ioThis video is a response to a great YouTube comment I got an a very old ......
Read more >
Brackets - A modern, open source code editor that ...
Modern, Powerful & Open source. With focused visual tools and preprocessor support, Brackets is a modern text editor that makes it easy to...
Read more >
NET Phone Number Parsing Library - formatting
Of course, you could always start with an existing library and add on to it, and depending on the license of the original...
Read more >
Libphonenumber : Javascript Phone Number Parsing and ...
Doesn't use hyphens and brackets when formatting international phone numbers (looks cleaner). Install. via npm. $ npm install libphonenumber-js --save. via yarn.
Read more >
The 20 Best Brackets Extensions for Front End Developers
This extension allows you to create your own library of code templates that you can use as starting points when working on a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found