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

156
Views
¿Por qué Moment me da la fecha de hoy y no formatea mi fecha?

estoy usando este filtro

 Vue.filter("toDate", function (value) { if (value) { return moment(Date(value)).format("yyyy-MM-DD HH:mm"); } });

El contenido de valor es 1529416634

Entonces el valor debería ser 2018-06-19 15:57

Pero cuando paso la fecha

 return moment(value).format() //1970-01-18 17:50

Y con la función Date()

 return moment(Date(value)).format("yyyy-MM-DD HH:mm"); //2021-09-18 11:16

Me da la fecha de hoy.

¿Qué estoy haciendo mal?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

moment y Date toma el tiempo en milisegundos desde la época de Unix (1 de enero de 1970 12 a. m. UTC).

Actualmente lo está pasando como el número de seconds desde la época de Unix.

Tu puedes hacer

return moment(value * 1000).format() //2018-06-19T14:57:14+01:00

o

return moment.unix(value).format() //2018-06-19T14:57:14+01:00

o

return moment(new Date(value * 1000)).format() //2018-06-19T14:57:14+01:00

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!