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

244
Views
Al verificar si la fecha es válida en javascript, obtenga `RangeError: Valor de tiempo no válido` probándolo

Creé esta función para verificar si la fecha es válida o no:

 function isValidDate(dateObject){ if(!dateObject) return; return new Date(dateObject).toString() !== 'Invalid Date'; } console.log(isValidDate('not valid time')) // false

Esta función funciona bien, pero al intentar probarla con broma me sale este error: RangeError: Invalid time value , supongo que esto sucede porque el argumento es una cadena y pasa el if(!dateObject) return; .
Pregunta: ¿Cómo evitar este error en mi caso?

about 4 years ago · Juan Pablo Isaza
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!