Adding time to Firestore serverTimestamp()

前端 未结 2 1343
深忆病人
深忆病人 2021-01-20 05:48

Is there a way to add time to a server timestamp without using cloud functions?

What I want is to update a timestamp from a panel, and have the user side check if th

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-20 06:28

    I'm a pretty old newb, and this is the first question I've read where I might be able to offer something. I really appreciate everything I've leaned here...

    You can't alter timestamps but you can change the timestamps to UNIX time and manipulate them on the server side during doc creation.

    ref.add({expires: firebase.firestore.Timestamp.now().toMillis() + 5000})
    

    Then query based on expires from the front end. Probably not ideal, but when you only have the front end to work with...

提交回复
热议问题