I am trying to add Timestamp
in Firestore document on Firebase Cloud functions.
I had tried firestore.Timestamp.fromDate(new Date())
, but its not working.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const firestore = admin.firestore();
const createdAt = firestore.Timestamp.fromDate(new Date());
console.log(createdAt);
Value of createdAt
should return the server timestamp, but its throwing error.