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

237
Views
validacion de fecha de nacimiento en javascript

Quiero la validación de la fecha de nacimiento. He usado el nuevo método Fecha para que no obtenga la fecha después de hoy. Pero aunque inserto una fecha posterior a hoy, no muestra una fecha no válida.

 var pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/ var date= new Date(); if (dateofbirth == "" || dateofbirth == null||!pattern.test(dateofbirth)) { alert("invalid date of birth should in yyyy-mm-dd"); return false; } else if(dateofbirth >date){ alert("invalid date"); return false; } else{ alert("valid date"); }
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puedes ver mi código:

 var validation = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/ var date= new Date(); if (dateofbirth == "" || dateofbirth == null||!validation.test(dateofbirth)) { alert("Date of Birth is Invalid it should in yyyy-mm-dd"); return false; } else if(dateofbirth >date.getFullYear()){ alert("Invaid Date"); return false; } else{ alert("Your Date is Valid"); }
about 4 years ago · Juan Pablo Isaza Report

0

var pattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/ var date= new Date(); if (dateofbirth == "" || dateofbirth == null||!pattern.test(dateofbirth)) { alert("invalid date of birth should in yyyy-mm-dd"); return false; } else if(dateofbirth >date.getFullYear()){ // get full year give current year you can compare with that year // to date of birth alert("invalid date"); return false; } else{ alert("valid date"); }
about 4 years ago · Juan Pablo Isaza Report

0

dateofbirth no está definida. Intenta agregar una entrada.

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!