From 70008311384a3390b87538d8705a2f387bd54f7d Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Thu, 18 Sep 2025 19:07:53 -0700 Subject: [PATCH] make `whoami` return `last_activity_ts` --- src/backend/src/routers/whoami.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/backend/src/routers/whoami.js b/src/backend/src/routers/whoami.js index d58591ffd..9898fc03e 100644 --- a/src/backend/src/routers/whoami.js +++ b/src/backend/src/routers/whoami.js @@ -55,6 +55,26 @@ const whoami_common = ({ is_user, user }) => { } } + if(user.last_activity_ts){ + let dateString = user.last_activity_ts; + + // Replace the space with 'T' to make it ISO 8601 compliant + const isoString = dateString.replace(' ', 'T'); + + // Create a Date object and get the epoch timestamp + let epoch; + try{ + epoch = new Date(isoString).getTime() / 1000; + // round to 1 decimal place + epoch = Math.round(epoch); + }catch(e){ + console.error('Error parsing last_activity_ts', e); + } + + // add last_activity_ts + details.last_activity_ts = epoch; + } + return details; };