firecmsco / firecms

Awesome Firebase/Firestore-based CMS. The missing admin panel for your Firebase project!
https://firecms.co
Other
1.12k stars 184 forks source link

Allow to set date/time fields manually #650

Closed Brackyt closed 1 month ago

Brackyt commented 1 month ago

I have a few collections where the documents have a "createdAt" field, I'm using this field to order them in my app. I would like to be able to manually edit the date in FireCMS but it only allows me to keep it in automatic mode with On Create or On any update. When I select "None" (which I think should remove the read only thing ?) I get the following error: Error persisting property: Cannot convert undefined or null to object. I don't know where this error originates from, none of the documents have this field undefined or null. I don't know if this is a bug or if it's intended but I think we should be able to change date fields how we want and not only in these automatic ways.

fgatti675 commented 1 month ago

Hi, the on create or on update props are meant to work automatically, as they are. If you would like to be able to edit those dates, I would suggest not using the auto fields, and implementing your own logic. You can use pre save callbacks to modify the values as you consider :) https://firecms.co/docs/collections/callbacks