Questions tagged [numeral.js]

A javascript library for formatting and manipulating numbers.

Homepage

49 questions
37
votes
2 answers

Is there a format for numeral.js that will show decimals only when needed?

tests: http://jsfiddle.net/su918rLv/ This is the how the existing formats work: numeral(1234.567).format('0,0'); //output: 1,235 numeral(1234.567).format('0,0.00'); //output: 1,234.57 numeral(1234).format('0,0.00'); //output: 1,234.00 Is…
Homer
  • 7,594
  • 14
  • 69
  • 109
5
votes
2 answers

How to use Numeral.js library in angular2/ionic 2 typescript app?

I have been successful using Numeral.js library in my angularJs(1.x) applications to format my numbers in different formats. This is how I use angular1 filters: filter.js .filter('numeral', function () { return function (count) { var…
Sukumar MS
  • 748
  • 1
  • 11
  • 42
4
votes
0 answers

Angular/Typescript numeral.js

I want to format a number to also display the Romanian format for decimals and thousands like this: 1.000,23 . I am using the numeral.js library. Here is my pipe code: constructor(private session: SessionService) { numeral.register('locale',…
4
votes
1 answer

Use a specific format to display numbers with Handsontable

I need to force Handsontable to display numbers with a specific format (1.000,01 for example) but it seems to ignore what I try to use as thousands separator. I tried several ways to do that but none worked : Setting a format to cells that will…
3
votes
1 answer

numeral.js - negative number rounding/formatting issue

I'm getting formatting issues with numeral.js when rounding to the nearest negative 100th. Thoughts on why it's putting the zero before the dollar sign for the zero value? FIDDLE var num1 = numeral(-0.006).format('$0,0.00'); var num2 =…
Kirk Ross
  • 6,413
  • 13
  • 61
  • 104
3
votes
1 answer

Formatting large numbers using numeral.js

In my app, I want to format various numbers using a library, and I have a couple of related questions (which I don't submit separately because I think they might represent a very common set of problems) Format a number using a format string…
user776686
  • 7,933
  • 14
  • 71
  • 124
3
votes
1 answer

import all languages for numeral.js in es2016 for an Aurelia app

I want to use a CurrencyValueConverter like the one in the aurelia.io documentation, but localizing the result to Dutch or German, but I don't know how to make all languages available to numeral. I am able to import the Ducth locale en load it…
Sergi Papaseit
  • 15,999
  • 16
  • 67
  • 101
2
votes
2 answers

Using NumeralJS, how can I determine the format based on whether a number is thousands or millions

My header pretty much sums it up, in my application Im formatting a value only when the value is greater than 6 digits. When the value is thousands, e.g. 210,500, I want to display it as 210.5k, if the value is in the millions, e.g. 2,120,000, I…
Jill
  • 35
  • 1
  • 9
2
votes
1 answer

Using Numeral.js from HTML in Aurelia

I have the following working Aurelia code: total = 9000;
Amount is
${total}
What I want to do is use the Numeral.js library in HTML to…
sbattou
  • 319
  • 3
  • 18
2
votes
1 answer

numeric input component for vue js

Here is my implementation using Numeral.js: Vue.filter('formatNumber', function (value) { return numeral(value).format('0,0.[000]') }) Vue.component('input-number', { template: '\
\ …
Afshin Gh
  • 7,918
  • 2
  • 26
  • 43
2
votes
1 answer

convert locale format back to default with numeral.js

I'm storing the number and currency formats in the default numeral js format. I allow the user to have their own formatting based on their locale setting. I'm trying to figure out how I can convert their custom formatting back to the default…
YCuvelie
  • 87
  • 1
  • 5
2
votes
3 answers

How to use locale from Numeral.js in react-native?

I want to change currency format in Numeral.js with another country. How to do that?
fufu
  • 99
  • 3
  • 13
1
vote
2 answers

Can't resolve 'numeral' in Angular app model

I npm i numerals, then npm i @types/numeral. I am trying to use numeral inside my price.model.ts file. So, I imported it: import * as numeral from 'numeral'; But, I'm getting this error: ./src/app/shared/models/price.model.ts:1:0-35 - Error: Module…
ScubaSteve
  • 7,724
  • 8
  • 52
  • 65
1
vote
1 answer

custom format in numeral.js negative number (-20) to be 20(-)

I use the numeral.js library I am interested in Do custom format That wherever there is a negative number (like - 20) the library will show it to me so 20 (-) I need the minus sign to be in parentheses How can I do this?
Yoel
  • 7,555
  • 6
  • 27
  • 59
1
vote
0 answers

Issue with formatting for United Arab Emirates Dirham in Numeral.js

I am trying to use Numeral.js to update both the currency symbol and format of a given number. It looks like it's working but when I select United Arab Emirates Dirham the formatting seems strange. numeral.register("locale", 'ar-ae', { …
Matt Croak
  • 2,788
  • 2
  • 17
  • 35
1
2 3 4