Open jonathanbergson opened 7 years ago
To solve this error I had to create a new 'locale':
Dumb question, but does your project also reference the locales.js file? That seems to be where the optional locales are attached to the numeral object.
In my case I had to 'require' the locales I needed before using them.
In my case to make it work I just required both the numeral and the locales file:
let numeral = require('numeral');
let locales = require('numeral/locales');
I just don't think this is the best way. My opinion is that Numerals.js should try to load the locale once the user call numeral.locale('pt-br');
, in case it does not exist it should use the default locale.
I don't think it should ever raise an exception trying to change the locale.
The same problem.
I'm trying to implement number format by locale and ie: 6542.32
in pt-br
continues yet 6542.32
.
In an ES6 environment:
import numeral from 'numeral';
import 'numeral/locales';
numeral.locale('pt-br');
numeral(10000).format('0,0') // 10.000
numeral.locale('en-au');
numeral(10000).format('0,0') // 10,000
ES5 environment:
var numeral = require('numeral');
require('numeral/locales');
numeral.locale('pt-br');
numeral(10000).format('0,0') // 10.000
numeral.locale('en-au');
numeral(10000).format('0,0') // 10,000
When I use the 'locale' of lib I am returning the following error.
My function:
VS Code error:
Browser error: