X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/cf9e11013710478809fe44b5cad7d3b77f6d5a1f..c276ce4c8dd3cf27ad6d17eca9af473f353fda55:/src/common/formatters.ts diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 0402f390..e2097878 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -2,10 +2,13 @@ // // SPDX-License-Identifier: AGPL-3.0 -export const formatDate = (isoDate: string) => { - const date = new Date(isoDate); - const text = date.toLocaleString(); - return text === 'Invalid Date' ? "" : text; +export const formatDate = (isoDate?: string) => { + if (isoDate) { + const date = new Date(isoDate); + const text = date.toLocaleString(); + return text === 'Invalid Date' ? "" : text; + } + return ""; }; export const formatFileSize = (size?: number) => {