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

170
Vistas
date-fns parse for "/Date(1633421520000)/"

receiving string of date that looks like this "/Date(1633421520000)/",

with moment I could just use it as moment("/Date(1633421520000)/") whats the equivalent for date-fns ?

for example differenceInMilliseconds how would i use it with received argument as this string "/Date(1633421520000)/"

not sure how to create my date object from this string so ill be able to use date-fns functions.

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

0

You need to extract the number (which looks like milliseconds since unix epoch) from the string:

"/Date(1634717139973)/".match(/\d+/)[0]

Then use Date constructor like so:

var date = new Date(Number("/Date(1634717139973)/".match(/\d+/)[0]));
date.toISOString(); // 2021-10-20T08:05:39.973Z
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