Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Why is Moment giving me the date of today and not formatting my date?

I'm using this filter

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

The value content is 1529416634

So the Value should be 2018-06-19 15:57

But when I pass the date

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

And with the Date() function

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

It gives me the date of today.

What Am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

moment and Date takes the time in the number of milliseconds since the Unix Epoch (Jan 1 1970 12AM UTC).

You are currently passing it as the number of seconds since the Unix Epoch.

You can do

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

or

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

or

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda