I'm writing a new document to Firestore. One of the fields must have some text, followed by the date, formatted like so 10/11/2020, 13:07
. What would be the simplest way to achieve this? I have an exceptionally convoluted way of achieving this with Moment.js in an old project. But I would like to see if there's a more elegant approach.
this.doc.set({
title: "A New Title " + ,
date: firebase.firestore.FieldValue.serverTimestamp(),
})
In the above snippet, the title would need to be something like title: "My New Title " + date"
so that the final result is something like: My New Title - 10/11/2020, 13:07
There is no way to merge a server-side timestamp with another value in a single write.
You will either have to:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.