Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Fecha no válida de un objeto

Estoy obteniendo un documento de firestore y ya podría mostrarlo en la consola también. Esto es lo que muestran los datos:

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

Intenté mostrar el itemAcquired en la pantalla pero muestra una "Fecha no válida":

 <ListItem> <Typography>Item Acquired At : </Typography> <ListItemText primary={new Date(user.items?.itemAcquired).toLocaleDateString()} /> </ListItem>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JavaScript Date no conoce el objeto timeStamp de firestore, puede usar la función toDate() junto con toDateString()

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

También puedes probar

 new Date(temAcquired.seconds * 1000).toUTCString()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!