When a date object is created and set into firestore document using below
Firebase function:
var updateData = {status: 'closed', closedOn: new Date()};
db_fs.collection("bookings").doc(bookingDocId).update(updateData).then(async () => {console.log("Document successfully updated!");});
then it goes into firebase like below
But if I set the date in the request (i.e. angular) instead of setting date inside firebase functions
Angular:
var updateData = {status: 'closed', createdOn: firebase.firestore.Timestamp.fromDate(new Date())};
Firebase function:
const data = req.body;
var updateData = data.updateData;
db_fs.collection("bookings").doc(bookingDocId).update(updateData).then(async () => {console.log("Document successfully updated!");});
then it goes like below
So is there a way in angular/javascript to set the date such that it comes into firebase like shown in the first pic?