Created
August 9, 2019 14:20
-
-
Save LFTroya/a4cf8fd61f4de042239b5867780636de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let number = '1234568,65'; | |
number = number.replace(/,/g, '.'); | |
const parsedNumber = numeral(number); | |
console.log(number); | |
console.log('Format', parsedNumber.format('0,0.00')) | |
console.log('Value', parsedNumber.value()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numeral = require("numeral"); | |
numeral.register('locale', 'cop', { | |
delimiters: { | |
thousands: ',', | |
decimal: '.' | |
}, | |
abbreviations: { | |
thousand: 'k', | |
million: 'm', | |
billion: 'b', | |
trillion: 't' | |
}, | |
ordinal : function (number) { | |
return ''; | |
}, | |
currency: { | |
symbol: '$' | |
} | |
}); | |
// switch between locales | |
numeral.locale('cop'); | |
exports = {numeral} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment