From 41e3eb5cc3f2a2bbe0269c5e412118677156482a Mon Sep 17 00:00:00 2001 From: swarnendusahu10-dotcom Date: Sat, 24 Oct 2026 09:41:59 +0530 Subject: [PATCH] fix: format last login timestamp with date and input guards --- packages/react/src/lib/formatTimestamp.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react/src/lib/formatTimestamp.js b/packages/react/src/lib/formatTimestamp.js index c9555ff155..298df2b97f 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; };