Invalid Date from an object

I’m fetching a document from firestore and I could already show it in the console too. This is what the data shows:

displayName: "Person1"
items:
  itemAcquired: t {seconds: 1631084326, nanoseconds: 617000000}
  itemName: "Book1"

[[Prototype]]: Object

I tried displaying the itemAcquired in the screen but it display an “Invalid Date”:

 <ListItem>
     <Typography>Item Acquired At : </Typography>
          <ListItemText
               primary={new Date(user.items?.itemAcquired).toLocaleDateString()}
             />
           </ListItem>

Answer

JavaScript Date doesn’t know about firestore timeStamp object, you can use toDate() function along with toDateString()

const date = itemAcquired.toDate().toDateString()

Also you can try

new Date(temAcquired.seconds * 1000).toUTCString()