1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 export const formatDate = (isoDate: string) => {
6 const date = new Date(isoDate);
7 const text = date.toLocaleString();
8 return text === 'Invalid Date' ? "" : text;
11 export const formatFileSize = (size?: number) => {
12 if (typeof size === "number") {
13 for (const { base, unit } of FILE_SIZES) {
15 return `${(size / base).toFixed()} ${unit}`;