|
@@ -11,7 +11,7 @@ const BytesFormatted: React.FC<Props> = ({ value, precision = 0 }) => {
|
|
|
const formatedValue = React.useMemo((): string => {
|
|
|
try {
|
|
|
const bytes = typeof value === 'string' ? parseInt(value, 10) : value;
|
|
|
- if (Number.isNaN(bytes)) return `-Bytes`;
|
|
|
+ if (Number.isNaN(bytes) || (bytes && bytes < 0)) return `-Bytes`;
|
|
|
if (!bytes || bytes < 1024) return `${Math.ceil(bytes || 0)}${sizes[0]}`;
|
|
|
const pow = Math.floor(Math.log2(bytes) / 10);
|
|
|
const multiplier = 10 ** (precision < 0 ? 0 : precision);
|