X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59caadc58a0b7ffc92fa95c90b16c99a9af6d942..e51530db62c369733186003cc5f005e491f29373:/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) => {