Open anselms opened 7 years ago
If I'm understanding your question correctly, then the error you're seeing is due to the locales being split into a separate file from the main numeral.js file. You have to also load locales.js for anything other than the US English locale to work. Both locales.js and locales.min.js (in the /min folder) contain a combination of all currently implemented locales, or (as your second example shows), you can load them individually.
The http://numeraljs.com/ site doesn't really mention this, so I suppose you're correct in saying the documentation is broken - I don't think it's been updated since @adamwdraper split the locales out into their own file(s).
Thanks for explaining this. Yes, the homepage does not mention this and the locales examples as present there will not work.
For anyone just coming across this, simply import the necessary locales along with the library:
var numeral = require("numeral");
require('numeral/locales/en-gb');
It could be usefull to update the documentation, is the website code open-source ?
any updates on this?
@linkb15 I don't think this repository is under active maintenance.
Instead, consider using https://github.com/BenjaminVanRyseghem/numbro, which is a fork under active development. I don't know if the locales are fixed though!
Locales according to the documentation on the main page do not work:
While this works:
Does anyone know what the right way to use this is?
Actually I'm surprised this works at all, as the German locale is not correctly specified #533