Skip to content

Commit

Permalink
fix: Decimal display error
Browse files Browse the repository at this point in the history
  • Loading branch information
l1xnan committed Aug 16, 2024
1 parent 371573b commit 5a4a66b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/tables/CanvasTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,11 @@ export const CanvasTable = React.memo(function CanvasTable({
return '<null>';
}
if (DataType.isDecimal(dataType)) {
// return value.toString().split('').toSpliced(-dataType.scale, 0, '.').join('');
const { scale } = dataType;
return value
.toString()
.replace(new RegExp(`(.{${dataType.scale}})$`), '.$1');
.padStart(scale + 1, '0')
.replace(new RegExp(`(.{${scale}})$`), '.$1');
}
if (DataType.isDate(dataType)) {
return dayjs(value).format('YYYY-MM-DD');
Expand Down

0 comments on commit 5a4a66b

Please sign in to comment.