-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parsing data from firestore #245
base: master
Are you sure you want to change the base?
Fix parsing data from firestore #245
Conversation
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! |
There was a problem hiding this 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 👇
const isJSDate = fieldValue instanceof Date; | ||
if(isJSDate){ | ||
return fieldValue; | ||
} |
There was a problem hiding this comment.
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:
react-admin-firebase/src/misc/translate-from-firestore.ts
Lines 47 to 50 in 5a6bdec
const isTimestamp = !!input.toDate && typeof input.toDate === "function"; | |
if (isTimestamp) { | |
return input.toDate(); | |
} |
There was a problem hiding this comment.
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.
This repo is not working for node version >=18. |
No description provided.