#✅ - datastore save() change createdat and updatedat to null

6 messages · Page 1 of 1 (latest)

rain vector
#

Hi Guys,

I’m using datastore save() to update the data. All data can be edited except createdat and updatedat. These two fields updated to null, I'm doing it on Flutter. Thanks.

stuck frost
rain vector
#

Thanks.
But when I use save() to datastore, the createdAt, and updatedAt are both saved to null; my list builder needs to sort the data by updatedAt before building it, so when the data have no updatedAt, I can't sort it.😭

stuck frost
#

Are you using offline mode only?

If you override timestamp fields in the model schema, the generated model will include those fields, with which you can assign values to them when creating a record. Can you give it a try?

rain vector
#

I know the reason is that the datastore triggers the local datastore by default, and the creaetedAt and updatedAt are managed by amplify, so the local data will get a null value.
I have created another timestamp by myself to fix my issue.😁

plush surgeBOT
#

✅ - datastore save() change createdat and updatedat to null