Handle numbers when they are passed using toLocaleString function or provide a prop to format displayed numbers
See original GitHub issueDescribe the issue. What is the expected and unexpected behavior?
The Pagination component
<Pagination
itemCount={props.itemCount}
widgetId="pagination-options-menu-top"
perPage={perPage}
page={currentPage}
variant={PaginationVariant.bottom}
onSetPage={onSetPage}
onPerPageSelect={onPerPageSelect}
/>
If I try to pass the itemCount as itemCount={props.itemCount.toLocaleString()}
to display large numbers in human readable format, it shows the number correctly at one place but shows NaN
at the second place.
It’s understandable as the toLocaleString converted it to string and component is not able to handle it However, it would be great if it can handle that.
Is this a bug or enhancement? If this issue is a bug, is this issue blocking you or is there a work-around? Not blocking but there is no workaround either.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Number.prototype.toLocaleString() - JavaScript | MDN
This tests for a global Intl object, checks that it's not null and that it has a NumberFormat property that is a function....
Read more >JavaScript: Number toLocaleString() method - TechOnTheNet
Determines the maximum number of fractional digits to display. It can be a value between 0 and 20.
Read more >The complete guide to toLocaleString in Node.js
With the toLocaleString method, you can format numbers as currencies using the convention of the language you pass as the first argument.
Read more >In React, how to format a number with commas?
I have a class which converts a number to either 31,312 or 31,312.00 . return value. toLocaleString(navigator. language, { ...
Read more >typescript-cheatsheet - GitHub Pages
As in JavaScript, all numbers in TypeScript are floating point values. ... Think of abstract methods as methods that won't be passed down...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tlabaj Yes, I can send a MR.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.