In our code, we display records with the date they were created. We are using the CreatedAt field to do this. When switching over to use offline sync, a new local record does not have the CreatedAt field populated until after a PushAsync is called. To address this issue we are setting the CreatedAt value to DateTime.Now; so we have a value in the local DB before the push. In our testing, however, the CreatedAt date is overwritten with the time the sync occurs.
Is it fair to say that the CreatedAt should not be used in this manner? If we want to store the date the user created the record, we would need to store it in our own field? I'm guessing this is the case. It would be good to have this documented somewhere.
We have observed the same behavior and are using our own field to store the record creation time. CreatedAt / UpdatedAt are always updated / overridden post Push.
+1, could be helpful if we can save CreatedAt to local table, then let the server overrides it when we Sync (to avoid malicious things/invalid device Date/Time)
@renzska CreatedAt cannot be used in this way. If you need the value of the local created at, you will need to create a new field. You can create it only locally, if you use the JsonIgnore attribute.