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.

Parsing behavior is weird, invalid numeral values aren't always NaN

See original GitHub issue

I’m playing around with sanitizing some bulk data and came across this:

numeral('2:23:57').value()
8637
numeral('hello').value()
null
isNaN(numeral('hello').value())
false

This contradicts the documentation here which asserts two things:

  1. numeral('2:23:57') should be invalid, but it isn’t. Not sure how it’s coming up with a value of 8637. Could this be a bug?
  2. numeral('some invalid string').value() should equal NaN, but is instead null. This is a breaking issue because validating numerals using isNaN() no longer works!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
liubkocommented, Jun 8, 2018

screen shot 2018-06-08 at 1 29 38 pm example from docs is broken numeral('2:23:57').value() returns 8637

1reaction
Remixfulcommented, Feb 1, 2018

Same with 1-18, value comes up as -118.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Big-query does now cast automatically long decimal values to ...
According to the documentation, BigQuery's NUMERIC type has a limit of 9 decimal digits: Decimal values with 38 decimal digits of precision ...
Read more >
NaN - JavaScript - MDN Web Docs
The global NaN property is a value representing Not-A-Number. ... NaN and its behaviors are not invented by JavaScript.
Read more >
Navigating The Hell of NaNs in Python - Towards Data Science
NaN stands for Not A Number and is a common missing data representation. It is a special floating-point value and cannot be converted...
Read more >
NaN - Wikipedia
In computing, NaN standing for Not a Number, is a member of a numeric data type that can be interpreted as a value...
Read more >
parseFloat alternative? · Issue #11 · tc39/proposal-numeric ...
However, let's be very clear that Number.parse cannot exhibit the exact same behavior as Number . The latter should never return anything but ......
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