I am trying to figure out how to display a firestore timestamp in a react app.
I have a firestore document with a field named createdAt.
I am trying to inc
I've encountered problems in the past with nested object properties not rendering properly in lists where item.someProp is considered an object, but item.someProp.someSubProp won't resolve with the value of someSubProp in item.someProp.
So to skirt around the issue, why not evaluate Timestamp to a plain date object (or the desired display format) when creating the user object?
this.unsubscribe = this.props.firebase
.users()
.onSnapshot(snapshot => {
let users = [];
snapshot.forEach(doc =>
let docData = doc.data();
docData.createdAt = docData.createdAt.toDate();
users.push({ ...docData, uid: doc.id }),
);
this.setState({
users,
loading: false,
});
});