How save a Date from Google App Script to a Timestamp in Cloud Firestore?

Viewed 262

Can anyone help mw with writing a timestamp from google script to firestore. When I use "new Date()" in google script, it store as an empty map in firestore. If I stringify the Date, it stores as a String firestore, But i need this attribute to store a Timestamp.

enter image description here

Storing as JavaScript Object

1 Answers

To save as a timestamp, just make sure your date is actually a date, and not a String. I used DATEVALUE to convert my String to a date, then I let this library (FirestoreGoogleAppsScript) to take care of the rest.

Related