Im trying to create a new document in firestore using a cloud function. However i am unable to save the date as a timestamp rather, it's saved as a string currently.
How it is right now
What i need to achieve
Snippet of my cloud function
await admin.firestore()
.doc('/buyerProfile/'+response.buyerId)
.collection('notifications')
.add({
'type':'New response',
'responseId':response.responseId,
'requestId':response.requestId,
'date': Date(Date.now()),
'compressedImgUrl':response.compressedImgUrl,
'description':response.description,
'requestPaidFor':request.data().isPaidFor
}).then(()=>console.log('Notification created'));