Questions tagged [numeral.js]

A javascript library for formatting and manipulating numbers.

Homepage

49 questions
0
votes
0 answers

Force numeral.js to use higher unit? Format 100000 as 0.1m instead of 100k

When using code like var out = numeral(100000).format('0.[000]a') I want to see '0.1m', not '100k' ('0.[000]a') nor '100.000k' ('0.000a') nor 'k' ('.[000]a'). The values in parenthesis are the format string I tried for each result. Said another…
0
votes
2 answers

Convert Apostrophe to Comma by using numerljs formatter

I am using http://numeraljs.com/#format I need formatter, which can covert number with apostrophe to comma. Eg: 2'910'724'242 must change to 2,910,724,242 Is there any formatter available. Or we have to manually convert apostrophe to comma.
Mike Phils
  • 3,475
  • 5
  • 24
  • 45
0
votes
1 answer

Using Numeral.js to round JSON numbers in %

I am fetching json data from a API and I have to display some of the numbers as %. The json data displays them as 0.00. I tried this method, but it didn't work. I want to use a url to fetch my data, and then use Numeral.js to make the filtered data…
0
votes
0 answers

i am trying to format numbers using the react numeral packages, but i am getting the error (Numeral cannot be invoked without 'new')

import React from "react"; import numeral from "react-numeral"; import {Circle, Popup} from "react-leaflet"; export const showDataOnMap = (data, casesType = "cases") => ( data.map((country) => ( center =…
Swizz 6ix
  • 23
  • 1
  • 5
0
votes
0 answers

Numeral.js formatting extremely large numbers

I'm a beginner programmer, I've just been making a game to play on Discord. It's working fine so far, but so far as fine-tuning, I've come into a problem with numeral.js that I can't seem to find any good references so far as how to fix. In the…
Larry
  • 1
  • 1
0
votes
1 answer

Failed to compile (react javascript)

this is my problem i hope there is a solution ./src/LineGraph.js Syntax error: D:/programming/corona-tracker-app/covid-19-tracker/src/LineGraph.js: Unexpected token (88:12) 86 | return ( 87 |
> 88 | {data?.length > 0 && ( …
0xlukc
  • 13
  • 5
0
votes
1 answer

Numeral.js File Not Found

I am following the instruction to use Numeral.js. I insert before the end of my . when I reload the page i get the following error: GET file:////numeral.min.js net::ERR_FILE_NOT_FOUND And…
user3755529
  • 1,050
  • 1
  • 10
  • 30
0
votes
1 answer

NumeralJS No decimal formatting/rounding

I use NumeralJS for formatting amounts as below; numeral(unformattedValue).format(amtFormat); So if the amtFormat is set as "0,0.00", then if the amount is entered as "123.1", I get it as "123.10" But what I want is no formatting/rounding, etc to…
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
0
votes
1 answer

Numeral Formatting on amounts

I use NumeralJS for formatting amounts as below; numeral(unformattedValue).format(amtFormat) Now if the amtFormat is set as "0,0.00", then if the amount is entered as "123.1", I get it as "123.10" Now I have certain cases where I do not want to…
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
0
votes
1 answer

Formating string using Numeral.js

How can I format a number respecting the last two number as decimals? 1000 -> 10,00 123456 -> 1.234,56 I am trying the code below but it won't work keeping the last two places as decimals. fromat(value) { return value === null ?…
Low Rider
  • 183
  • 1
  • 1
  • 11
0
votes
1 answer

Converting any numbers to same scale using Numeral JS

Currently when using numeral(1000000).format('0a') will return 1m, however is it possible to set a scale, for example thousands, so any number will get converted to a number in thousands? For instance 1000000 will become 1000k, and 100 would become…
Alex T
  • 3,529
  • 12
  • 56
  • 105
0
votes
2 answers

Formatting input value as user types

I am having difficulty updating an input fields value to currency while a user types. When I use the input event change I am able to successfully update the value to currency. But when I use keyup event the input value and interaction behavior is…
Galactic Ranger
  • 851
  • 3
  • 14
  • 30
0
votes
0 answers

How do I get 1M instead of 1m using numeral.js?

import numeral from 'numeral' formatNumber (x) { return numeral(rawOnlineTotal).format('0a'); } formatNumber(10000000); expected output: 1M Actual Output: 1m formatNumber(1000); expected output: 1K Actual…
Author
  • 153
  • 1
  • 3
  • 11
0
votes
0 answers

How to use numeral.JS in this situation?

I am trying to use numeral.js to format my listener variable so numbers could be easily readable. But after I tried to use numeral.js the way it is, my function stops working. Can anyone please advise on what's wrong? Trackster.renderTracks =…
Terence
  • 27
  • 3
0
votes
1 answer

Format y-axis values using numeral JSHighCharts

I want to format my values on the y-axis using HighCharts. Suppose I pass 14000, it should print "14K" on the y-axis. How can I do that? I've benn trying using numeral.js, but to no avail. Charts demo…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/highcharts" class="post-tag grid--cell" title="show questions tagged 'highcharts'" rel="tag">highcharts</a> <a href="../../questions/tagged/numeral.js" class="post-tag grid--cell" title="show questions tagged 'numeral.js'" rel="tag">numeral.js</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 28 '18 at 17:00">asked Jan 28 '18 at 17:00</time> <a href="../../users/3952638/user46663" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3952638.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="user46663" /> </a> <div class="s-user-card--info"> <a href="../../users/3952638/user46663" class="s-user-card--link">user46663</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">11</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="3 silver badge">3</li> <li class="s-award-bling s-award-bling__bronze" title="8 bronze badge">8</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/numeral.js_page=2" rel="prev" title="Go to page 2">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/numeral.js_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/numeral.js_page=2" rel="" title="Go to page 2">2</a> <div class="s-pagination--item is-selected">3</div> <a class="s-pagination--item" href="../../questions/tagged/numeral.js_page=4" rel="" title="Go to page 4">4</a> <a class="s-pagination--item" href="../../questions/tagged/numeral.js_page=4" rel="next" title="Go to page 4"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>