Questions tagged [numeral.js]

A javascript library for formatting and manipulating numbers.

Homepage

49 questions
1
vote
1 answer

how can I format number with at least one decimal in numeraljs

In numeraljs, I want to do that : I need has thousand separator, in addition, if one number has one or more decimal, just print all decimal. How many decimals is not sure. if one number has no decimal, just add one zero as its decimal. e.g. I want…
frank
  • 1,169
  • 18
  • 43
1
vote
1 answer

I need a TypeScript library to, format money and numbers, perform localization operations

I'm developing a mobile application using React-Native and TypeScript super-set. I am looking for a format library in which I can perform numbers, currencies, dates, numbers and localizations. I've used the Numeral JS library before, but the format…
1
vote
1 answer

Bootstrap TouchSpin + NumeralJS using locale pt-br is not working

I'm trying to use bootstrap touchspin + numeraljs to set the location of my currency input to pt-br. For this I registered a custom locale through the NumeralJS, so when I use the locale that created the increment and decrement functions do not work…
Nicolas Dias
  • 641
  • 11
  • 22
1
vote
1 answer

How to use Numeral.js or any JS plugins in React-Native App?

I need to change a number to currency format in React-Native this doesn't work in my case: import Numeral from "numeral"; Numeral(100).format("$0.00") it outputs: Metro Bundler has encountered an internal error. I know Numeral is not built for…
DennyHiu
  • 4,861
  • 8
  • 48
  • 80
1
vote
2 answers

React input position with numeral format state

I use numeral to format my numbers from 4500000 to 4 500 000. The problem comes with cursor position - it gets wrong when the number of spaces is changing. I tried to save cursor position when my input is change, but something is wrong with…
Mad Max
  • 283
  • 1
  • 7
  • 19
1
vote
1 answer

Need to format number only k(thausand) not m(million) or b(billion) numeraljs

We need to format number only k(thousand) not m(million) or b(billion) with numeraljs currently its converting all formats var number = 2000000; console.log(numeral(number).format('0a'));
Govind Samrow
  • 9,981
  • 13
  • 53
  • 90
1
vote
1 answer

'numeral is not defined' error is appearing if numeral is in html function

I use numeral.js in both the viewmodels and sometimes in the html of my knockout components.
I am using webpack to package my html and js together which seem to work great,…
Jason Coley
  • 125
  • 9
1
vote
0 answers

User-friendly dynamically formatted numbers in javascript

I'm trying to format numbers dynamically when user enters or changes an input string field. I'm using React and a library NumeralJS for number formatting. I also use react-jsonSchema-form and I override theirs' number field. I am stuck with the…
elenaHristova
  • 611
  • 1
  • 8
  • 16
1
vote
1 answer

Numeral.JS zeroFormat includes $ and % symbol at end result

Why does zero formatting include $ and % symbols in the formatted result? numeral.js version is 1.5.3 var number = numeral(0); numeral.zeroFormat('N/A'); var zero = number.format('0.0%') // 'N/A%' var zero = number.format('$0.0') // '$N/A' //…
AntonIva
  • 597
  • 1
  • 6
  • 22
1
vote
1 answer

Aurelia Value Converter Buggy Behavior with percentage

I am trying to convert a user input to a percentage using aurelia converter and Numeral.js. Here is the gist: https://gist.run/?id=5bbfa902b1d14bff6f506dfcf2045370 The conversion is buggy. Basically, when I am entering the number, it does not…
software_writer
  • 3,941
  • 9
  • 38
  • 64
1
vote
1 answer

numeral.js live formatting

I would like to live format an input box with Numeral.js. I tried something like this. $('#exchangeInputFirst').keyup(function () { //eur formatting numeral.language('sk'); …
Adrian
  • 2,576
  • 9
  • 49
  • 97
1
vote
0 answers

How to convert german number to english using Numeral.js

I have used below mentioned code for converting German number to English no using Numeral.js var numeral = require('numeral'); var numeralDE = require('numeral/languages/es'); numeralDE.delimiters.thousands = '.'; numeral.language('es',…
Dhaval Patel
  • 7,471
  • 6
  • 37
  • 70
1
vote
2 answers

Converting float to currency Argentine Peso

It seems that the Argentine Peso (ARS) notation for currency is complete the opposite from what the Dollar is in the US. The , is used as a decimal separator, and the . is used as a thousands separator. 1121 => $1.121,00 1000.5 => $1.000,50 85.72…
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
1
vote
1 answer

Format a calculation value as currency

I have the following calculation that I would like to format as a currency: jQuery(function () { $("#weight").change(function () { var iva = $("#iva").val(); var subtotal = $("#subtotal").val(); var total = parseFloat(iva) +…
penone
  • 742
  • 1
  • 10
  • 27
0
votes
0 answers

If value is zero, numeral.js prints space instead of zero

When the value is zero, numeral.js prints a space instead of 0.00. I need this case to print 0.00. This prints space: let x = numeral(0).format('0.00'); console.log(x); if the value is not zero, this works fine. Any ideas how to fix this?
ps0604
  • 1,227
  • 23
  • 133
  • 330