Wrong lastActiveAt in user detail

We are receiving old lastActiveAt in below API

                res => {})

Hello @mubashshir,

Can you please share the exact code snippet of how you are converting the timestamp into the Date?

I did run a few tests and the last active at seems to be working fine on my end. I am sharing a code snippet to get the last active at of a user below.

    res => {
        console.log('lastActiveAt', res.getStatus() === 'offline' ? new Date(res.getLastActiveAt() * 1000) : 'active');

I hope this helps. Please let us know if you face any issues.

Warm Regards,

CometChat Pro
Mayur Bhandari

I am using the property ‘lastActiveAt’ like this
new Date(res.lastActiveAt * 1000)
and it brings some old date while the user is active at the moment.

Hello @mubashshir,

If the user is active then you will get the lastActiveAt as his older lastActiveAt. Since the user is active/online, using the lastActiveAt doesn’t make any sense. I am unable to understand what issue you are facing exactly or what are you trying to achieve by using lastActiveAt of an active user. Please elaborate more on the issue and your use case, so that i can help you better.

Warm Regards,

CometChat Pro
Mayur Bhandari

I want to show the last seen of user.
The scenario is as.
A user comes everyday online so he is active everyday. but when i get his details then it shows sometime correct date but sometime it brings old date

Hows lastActiveAt work, what is the logic behind it.
If i am using wrong way then what is the other option to get the last seen of any user

Hello @mubashshir
Can you please share the UID of the user/users for whom you are getting incorrect values of lastActiveAt so that we can check this at our end. It would really help us investigate this in a better way and provide you with a solution at the earliest.


Please find below userid for user Aditya Kumar
uid: “17386”