TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Firestore DateTime retrieval #294

Closed rezamohamed closed 5 months ago

rezamohamed commented 6 months ago

I can save dates into a Firestore doc just fine

image

however, when I retrieve the date, it doesn't convert correctly:

image

I have the data defined in the model as so currently [FirestoreProperty("CreatedDate")] public DateTime CreatedDate { get; set; }

If I were to change the type to DateTimeOffset then it would retrieve the date, but it's not the local time that I saved (it's about 5 hours ahead). [FirestoreProperty("CreatedDate")] public DateTimeOffset CreatedDate { get; set; }

image

Is this a bug that the DateTime type doesn't work properly?

AdamEssenmacher commented 6 months ago

Reading a server timestamp into a model property with the DateTime type just isn't currently supported. Not that it couldn't be--the code just hasn't been written for it.