[Feature request] Add two 'format' and 'unformat' methods
See original GitHub issueI frequently need to test formatted/unformatted data against values from an autoNumeric managed input.
I wish I could do something like :
let myOptions = { aSep: '.', aDec: ',', altDec: '.', aSign: ' €', pSign: 's', mRound: 'U' };
let autoNumInput = $(el).autoNumeric('init', myOptions);
let unformattedValueXXX = "2222.67";
let formattedValueXXX = autoNumInput.autoNumeric('format', unformattedValueXXX); //"2.222,67 €"
let formattedValueYYY = "678.000,32 €";
let unformattedValueYYY = autoNumInput.autoNumeric('unformat', formattedValueYYY); //678000.32
…using the autoNumericInput as a ‘factory’ to format/unformat given number/strings.
That would allow us to not have to code an unformat function to do that myself (and defeat the purpose of the multiple autoNumeric format options), and not reinventing the autoNumeric wheel.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Fully convert autoNumeric to an ES6 module · Issue #399
In the former case, we can use the AutoNumeric class directly to format/unformat numbers and strings, without having to use a DOM element....
Read more >String.Format Method (System) - Microsoft Learn
Replaces the format items in a string with the string representation of two specified objects. A parameter supplies culture-specific formatting information.
Read more >Feature Requests - DecoNetwork Help
Feature Requests ; Automatically recieved stock when an order is cancelled. Timothy Pipp ; Add option for additional area discounts to all decoration...
Read more >3 ways to manage software feature request - Amoeboids
Discover best practices to manage feature requests from different stakeholders. Practical tips to get you on top of the game.
Read more >How to Format SD Cards in All Devices - EaseUS
Method 2. Format SD Card Use Disk Management. Step 1. Insert your SD card into a card reader and connect it to your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Name spacing would require a major re-write which I am not prepared to do at this time.
I just finished the
$.fn.autoFormat("value", {options});
need to check for bugs.Next will be
$.fn.autoUnformat("value", {options});
You could always attach the options as data to some element - yes i know it’s not elegant.
Those functions are callable via the jQuery wrapper, or directly when aN is imported as a module. The work is done here, thanks @BobKnothe!
note: the IDE autocompletion will be improved in the near future