0

I have a chat app where conversations are deleted within 7 days if they don't meet certain requirements. So when the conversation is created I save the current time which goes as the creation time and later on I compare it to the current time the moment of the comparison to find out how much time it has been. I do that using Date.now() but I noticed that other developers use Firebase current timestamp. Question is why ?

Update: I understand now that Date.now() can't be trusted with the app side of things as it is manipulable by the user. So what about the cloud functions ... Date.now() is good enough in there ?

Ahmed Samy
  • 1,006
  • 2
  • 11
  • 24
  • Thank you so much George. I get it now but to make clearer. If I stick to Date.now() and the user lets say created a conversation on Friday 1:00 pm and changed the clock to be seven days later 1:00 pm, the conversation should be deleted right ? – Ahmed Samy Jan 08 '18 at 12:12
  • 1
    I don't use firebase, but from reading that answer, I'd say yes, you're correct – George Jan 08 '18 at 12:13
  • So there is no point of using Firebase timestamp in the cloud functions (server functions) right ? – Ahmed Samy Jan 08 '18 at 12:23
  • 1
    Looks like you're [correct again!](https://stackoverflow.com/questions/46206593/cloud-functions-for-firebase-get-actual-timestamp-of-database) – George Jan 08 '18 at 12:26

0 Answers0