Skip to content

Commit

Permalink
feat(number): FLUI-65 manage locale in number
Browse files Browse the repository at this point in the history
  • Loading branch information
AltefrohneGaelle committed Jun 2, 2023
1 parent 48c8d64 commit 79aa723
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ferlab/ui",
"version": "7.6.0",
"version": "7.7.0",
"description": "Core components for scientific research data portals",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/utils/numberUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ export const getDefaultDigits = (num: number) => {
export const numberFormat = (num: number, digits = 0) => {
if (!num) return 0;

const locale = localStorage.getItem('locale') === 'fr' ? 'fr-CA' : 'en-US';

let index: number;
digits = digits ? digits : getDefaultDigits(num);

if (BLACK_LIST_LENGTH.includes(num.toString().length)) {
return num.toLocaleString();
return num.toLocaleString(locale);
} else {
VALUE_SYMBOLE_LIST.forEach((si: any, i) => {
if (num >= si.value) {
Expand Down

0 comments on commit 79aa723

Please sign in to comment.