Skip to content

Commit

Permalink
fix: use correct number formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Jul 1, 2024
1 parent da8bb35 commit 0efbbd8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/lib/formatters/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export function percentFormatter(value?: number | string | BigNumber) {
return `${value.lt(0.01) && value.gt(0) ? '<0.01' : value.toFixed(2)}%`;
}

const formatter8 = new Intl.NumberFormat('fr-FR', {
const formatter8 = new Intl.NumberFormat('en', {
maximumFractionDigits: 8,
});

export function numberWithSpacesFormatter(val?: number | string) {
export function numberWithCommasFormatter(val?: number | string) {
if (val === undefined) return '';

return formatter8.format(Number(val)).replace(',', '.');
return formatter8.format(Number(val));
}

export function bytesFormatter(val?: number | string) {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/DashboardPage/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { PropsWithChildren, useEffect, useMemo, useState } from 'react';

import {
bytesFormatter,
numberWithSpacesFormatter,
numberWithCommasFormatter,
percentFormatter,
tokenFormatter,
} from '@lib/formatters/formatters';
Expand Down Expand Up @@ -199,8 +199,8 @@ function Stats() {
<Box>
<ColumnLabel>Queries, 24h / 90d</ColumnLabel>
<ColumnValue>
{numberWithSpacesFormatter(data?.queries24Hours)} /{' '}
{numberWithSpacesFormatter(data?.queries90Days)}
{numberWithCommasFormatter(data?.queries24Hours)} /{' '}
{numberWithCommasFormatter(data?.queries90Days)}
</ColumnValue>
</Box>
<Box>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/WorkersPage/Worker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dateFormat } from '@i18n';
import {
bytesFormatter,
numberWithSpacesFormatter,
numberWithCommasFormatter,
percentFormatter,
tokenFormatter,
urlFormatter,
Expand Down Expand Up @@ -218,8 +218,8 @@ export const Worker = ({ backPath }: { backPath: string }) => {
<Stack direction="row">
<WorkerDescLabel>Queries, 24h / 90d</WorkerDescLabel>
<WorkerDescValue>
{numberWithSpacesFormatter(worker.queries24Hours)} /{' '}
{numberWithSpacesFormatter(worker.queries90Days)}
{numberWithCommasFormatter(worker.queries24Hours)} /{' '}
{numberWithCommasFormatter(worker.queries90Days)}
</WorkerDescValue>
</Stack>
<Stack direction="row">
Expand Down

0 comments on commit 0efbbd8

Please sign in to comment.