I build chat application using firestore as backend. Now I want when some user send a message there should be a time of that message.
there is some error ie.
react-dom.development.js:14887 Uncaught Error: Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead. at throwOnInvalidObjectType (react-dom.development.js:14887:1)
react_devtools_backend.js:4012 The above error occurred in the component:
I wrote this code to send data on firebase
messages: arrayUnion({
id: uuid(),
text,
img: downloadURL,
senderId: currentUser.uid,
date: Timestamp.now(),
// time: Date().get
});
and when a fetch data from firebase
<div>
<p>
{message.text}
<span>{message.date && <span>{message.date}</span>}</span>
</p>
{message.img && <img src={message.img} alt="" />}
</div>;
I want to show message time with message. Note: I map through messages like :
messages.map(message => {})