I am trying to check a timestamp in the firestore document. However I am getting the error:
“Error in hourly event summary function: TypeError: Cannot read properties of undefined (reading ‘fromDate’)”
In my functions file I have the following declared at the top:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
and I am trying to call it like so:
const startTimestamp = admin.firestore.Timestamp.fromDate(Date.now())
I have tried
const firestore = admin.firestore;
const createdAt = firestore.Timestamp.fromDate(new Date());
from How to add Timestamp in firebase cloud functions
but still no luck.