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.

Don't strip `.0`-suffix when `secDecimalDigits` is set to `1`

See original GitHub issue

I find it kind of confusing that specifying secDecimalDigits: 1 and formatting 1000 will lead to 1s. If I’m specifying that I want one decimal, I don’t feel like stripping the decimal point makes sense. Especially since it seems that specifying secDecimalDigits: 2 will show .00.

Is this a concious decision, or an oversight, or somewhere between? 😃 Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rexxarscommented, Sep 22, 2017

@sindresorhus Would you accept a PR that takes an option to keep the decimals on whole numbers? I’m using this library for a progress indicator thingy which keeps updating the time spent every ~60ms or so, and it keeps flickering in the terminal when it hits a whole number - I’d prefer if it just kept the fixed length as specified.

Read more comments on GitHub >

github_iconTop Results From Across the Web

number_format - Manual - PHP
The number being formatted. decimals. Sets the number of decimal digits. If 0 , the decimal_separator is omitted from the return value.
Read more >
regex - Decimal number regular expression, where digit after ...
If there are any digits present before the decimal sign, then the decimal and the digits following it are optional.
Read more >
Using the GNU Compiler Collection
Don't recognize built-in functions that do not begin with '__builtin_' as prefix. See Section 5.50 [Other built-in functions provided by GCC], page 359,...
Read more >
Place Value: Decimals - Varsity Tutors
The second digit to the right of the decimal point indicates the number of ... 10 strips of equal size, then each of...
Read more >
The OPTMODEL Procedure - SAS Support
OPTMODEL language in SAS data sets that can be submitted to other SAS/OR optimization ... See also the description of the .label suffix...
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