Skip to content

Commit

Permalink
[firestore][android] Correctly process date time zones
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbianca committed Oct 18, 2017
1 parent bc1e827 commit fc3fc6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

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";
Expand Down
4 changes: 3 additions & 1 deletion tests/src/tests/firestore/documentReferenceTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});

Expand Down

0 comments on commit fc3fc6d

Please sign in to comment.