pretty print subdollar values for sku costs

This commit is contained in:
Ryan Vazquez
2020-11-18 15:05:21 -05:00
parent 07d33bc352
commit 9d792a435b
2 changed files with 7 additions and 2 deletions
@@ -20,7 +20,7 @@ import { Table, TableColumn } from '@backstage/core';
import { Dialog, IconButton, Typography } from '@material-ui/core';
import { default as CloseButton } from '@material-ui/icons/Close';
import { CostGrowthIndicator } from '../CostGrowth';
import { currencyFormatter, formatPercent } from '../../utils/formatters';
import { costFormatter, formatPercent } from '../../utils/formatters';
import { useEntityDialogStyles as useStyles } from '../../utils/styles';
import { BarChartOptions, Entity } from '../../types';
@@ -38,7 +38,7 @@ function createRenderer(col: keyof RowData, classes: Record<string, string>) {
case 'current':
return (
<Typography className={rowStyles}>
{currencyFormatter.format(row[col])}
{costFormatter.format(row[col])}
</Typography>
);
case 'ratio':
@@ -24,6 +24,11 @@ export type Period = {
periodEnd: string;
};
export const costFormatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
export const currencyFormatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',