question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Locales broken or documentation on main page wrong.

See original GitHub issue

Locales according to the documentation on the main page do not work:

>var numeral = require("numeral")
> numeral.locale('de')
'de'
> numeral("12.2000.0065,9812")
TypeError: Cannot read property 'delimiters' of undefined
    at stringToNumber (/home/schultes/tpf/baenk-web/server/node_modules/numeral/numeral.js:284:27)
    at numeral (/home/schultes/tpf/baenk-web/server/node_modules/numeral/numeral.js:84:25)
    at repl:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at REPLServer.defaultEval (repl.js:339:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:536:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:191:7)

While this works:

>var numeral = require("numeral")
> var de = require('numeral/locales/de')
undefined
> numeral.locale('de')
'de'
> numeral("12.2000.0065,9812")
{ _input: '12.2000.0065,9812', _value: 1220000065.9812 }
> 

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

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

10reactions
jbreckmckyecommented, Aug 1, 2017

For anyone just coming across this, simply import the necessary locales along with the library:

var numeral = require("numeral");
require('numeral/locales/en-gb');
1reaction
jbreckmckyecommented, Jul 27, 2022

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I fix my locale issue? - Ask Ubuntu
First run locale to list what locales currently defined for the current user ... Then generate the missing locale and reconfigure locales to...
Read more >
Open a document after a file corruption error - Microsoft Support
The Open and Repair command might be able to recover your file. Click File > Open > Browse and then go to the...
Read more >
How to Fix the "There Has Been a Critical Error on Your ...
The quickest way to fix the problem is to roll back your website if you have a backup, but there are a variety...
Read more >
Error 404: 4 Ways to Fix It - Hostinger
Ensure the domain points to the web host · Fix file permissions · Disable the broken .htaccess file · Restore the website backup...
Read more >
locale — Internationalization services — Python 3.11.1 ...
Source code: Lib/locale.py The locale module opens access to the POSIX locale ... If the modification of the locale fails, the exception Error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found