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

149
Vistas
Date.parse() false positives

In code below, I don't want the string not_a_date to be whitelisted as a proper date, but rather as NaN or invalid date. but Date.parse returns a proper epoch value.

not_a_date = 'https://www.example.com/2021/03/03'
Date.parse(not_a_date)
// Expected: NaN
// Result: 1614709800000
  • Not looking for a exact format match, but a fuzzy match that still works the same as Date.parse for other cases such as 2020.01.01, 01/10/2020
  • Another function that achieves this also works for me.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Date.parse is still largely dependant on the browser you're using; your code DOES return NaN in Firefox v94 for example. You'll likely have to write your own parsing function before passing it to Date.parse().

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