[firestore][android] Correctly process date time zones
This commit is contained in:
parent
bc1e827273
commit
fc3fc6d0d2
@ -30,7 +30,7 @@ import io.invertase.firebase.Utils;
|
|||||||
|
|
||||||
public class FirestoreSerialize {
|
public class FirestoreSerialize {
|
||||||
private static final String TAG = "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_CHANGES = "changes";
|
||||||
private static final String KEY_DATA = "data";
|
private static final String KEY_DATA = "data";
|
||||||
private static final String KEY_DOC_CHANGE_DOCUMENT = "document";
|
private static final String KEY_DOC_CHANGE_DOCUMENT = "document";
|
||||||
|
@ -426,13 +426,15 @@ function documentReferenceTests({ describe, it, context, firebase }) {
|
|||||||
|
|
||||||
context('types', () => {
|
context('types', () => {
|
||||||
it('should handle Date field', async () => {
|
it('should handle Date field', async () => {
|
||||||
|
const date = new Date();
|
||||||
const docRef = firebase.native.firestore().doc('document-tests/reference');
|
const docRef = firebase.native.firestore().doc('document-tests/reference');
|
||||||
await docRef.set({
|
await docRef.set({
|
||||||
field: new Date(),
|
field: date,
|
||||||
});
|
});
|
||||||
|
|
||||||
const doc = await docRef.get();
|
const doc = await docRef.get();
|
||||||
doc.data().field.should.be.instanceof(Date);
|
doc.data().field.should.be.instanceof(Date);
|
||||||
|
should.equal(doc.data().field.toISOString(), date.toISOString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user