make whoami return last_activity_ts

This commit is contained in:
Nariman Jelveh
2025-09-18 19:07:53 -07:00
parent 31fffb087d
commit 7000831138
+20
View File
@@ -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;
};