question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saving timestamp to firestore

See original GitHub issue

Hey that a really good library, helped me a lot. Thanks!

I’m trying to create a document with a timestamp in it and I’m keep getting an empty map on Firestore.

firestore.createDocument(USER_EXPIRATION_COLLECTION, { userId: userId, classId: classId, timestamp: new Date()});

and the output:

{ name: 'projects/.../usersClassesExpiration/...', fields: { userId: 'userId', timestamp: {}, classId: 'classId' }, createTime: Tue May 26 2020 11:11:09 GMT+0300 (Israel Daylight Time), updateTime: Tue May 26 2020 11:11:09 GMT+0300 (Israel Daylight Time) }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
LaughDonorcommented, Jun 22, 2020

Verified that instanceof fails for Date objects outside of the library.

https://github.com/grahamearley/FirestoreGoogleAppsScript/blob/13365c9156c752d52d10f82a3250cf7865d5434f/Document.ts#L140

This line will be updated to include additional checks. Thanks for bringing this up!

1reaction
rielzzappscommented, Jun 22, 2020

Bit of ugyl fix:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to save a timestamp in firestore - Stack Overflow
I would suggest converting it to epoch time as int store it in your cloud and re-convert to DateTime after fetching it. Example:...
Read more >
Firebase.Firestore.Timestamp Struct Reference - Google
Timestamp. bookmark_border. Stay organized with collections Save and categorize content based on your preferences. Dismiss
Read more >
Firestore: Storing Date as timestamp · Issue #1292 - GitHub
Saving objects with Date turns the date into string fields. Is it possible to save as timestamp fields?
Read more >
Saving Date in firestore : r/Firebase - Reddit
A better solution is to use the library's firebase.firestore.FieldValue.serverTimestamp() method to let Firebase take care of it, and when you ...
Read more >
Update a Firestore document Timestamp - Google Cloud
Was this helpful? Update a Firestore document Timestamp. bookmark_border. Stay organized with collections Save and categorize content based on your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found