diff --git a/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java b/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java index 3cb96896..dd4e3626 100644 --- a/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java +++ b/android/src/main/java/io/invertase/firebase/firestore/FirestoreSerialize.java @@ -30,7 +30,7 @@ import io.invertase.firebase.Utils; public class FirestoreSerialize { private static final String TAG = "FirestoreSerialize"; - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); private static final String KEY_CHANGES = "changes"; private static final String KEY_DATA = "data"; private static final String KEY_DOC_CHANGE_DOCUMENT = "document"; diff --git a/tests/src/tests/firestore/documentReferenceTests.js b/tests/src/tests/firestore/documentReferenceTests.js index bc4a39e0..968cb28b 100644 --- a/tests/src/tests/firestore/documentReferenceTests.js +++ b/tests/src/tests/firestore/documentReferenceTests.js @@ -426,13 +426,15 @@ function documentReferenceTests({ describe, it, context, firebase }) { context('types', () => { it('should handle Date field', async () => { + const date = new Date(); const docRef = firebase.native.firestore().doc('document-tests/reference'); await docRef.set({ - field: new Date(), + field: date, }); const doc = await docRef.get(); doc.data().field.should.be.instanceof(Date); + should.equal(doc.data().field.toISOString(), date.toISOString()); }); });