Skip to content

Fix parsing data from firestore #245

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pranko17
Copy link
Contributor

No description provided.

@MatheusMoura17
Copy link
Contributor

Works fine for me and fix #250 , i'm closing #251 and voting to merge this.

@benwinding you can merge this? My project it's currently broken.

Thanks!

Copy link
Owner

@benwinding benwinding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort 🙏 Just a quick question below 👇

Comment on lines +133 to +136
const isJSDate = fieldValue instanceof Date;
if(isJSDate){
return fieldValue;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What version of firebase are you using? I didn't think the firestore API would ever return a Date field 🤔

It is only meant to return a Timestamp which should be handled by this part here:

const isTimestamp = !!input.toDate && typeof input.toDate === "function";
if (isTimestamp) {
return input.toDate();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my project, the fields createdAt and updatedAt are of this type. I don't know why but it fix my problem.

@vandan-khamkar-us
Copy link

This repo is not working for node version >=18.
when I upgrade version to newer, It's giving me an error for setDoc & addDoc (as it is not handling empty data).
Please fix or give any clue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants