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

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

Upvotes: 2

Views: 474

Answers (1)

João Apura
João Apura

Reputation: 11

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.

Upvotes: 1

Related Questions