diff --git a/packages/react/src/lib/formatTimestamp.js b/packages/react/src/lib/formatTimestamp.js index c9555ff15..298df2b97 100644 --- a/packages/react/src/lib/formatTimestamp.js +++ b/packages/react/src/lib/formatTimestamp.js @@ -1,5 +1,9 @@ const formatTimestamp = (timestamp) => { + if (!timestamp) return ''; + const date = new Date(timestamp); + if (Number.isNaN(date.getTime())) return ''; + const now = new Date(); const isDifferentDay = @@ -12,8 +16,10 @@ const formatTimestamp = (timestamp) => { return isDifferentDay ? `${date.toLocaleDateString('en-US', { - weekday: 'long', - })} ${formattedTime}` + month: 'short', + day: 'numeric', + year: 'numeric', + })}, ${formattedTime}` : formattedTime; };