javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

javascript

Help me, i started doing javascript recently and im trying out stuff. For the date of birth text field,a valid date must be entered in valid dd/mm/yyyy format. Applicants must be at between 15 and 80 years old at the time they fill in the form.

18th Aug 2018, 1:14 PM
Amyaz Zarook
2 Answers
+ 2
I think that can help you: 1) to check format: /([0-3][0-9]\/[0-1][1-9]\/[1-2][0-9]{3})/ 2) current date: new Date(); getDate(); getMonth(); getFullYear(); 3) you check if current year minus year from user is bigger than 15 when is equal you check month when this is also equal you check day the same with 80 but you check or is less
18th Aug 2018, 2:57 PM
Dawid
Dawid - avatar
+ 1
Welcome! We're happy to hear that you are trying out stuff. Would you mind posting one of your tries to the Code Playground (curly braces if you're on the app, green circle with plus sign to add project, select Web for project type) and providing the project link to this thread so we can take a peek under the hood?
18th Aug 2018, 1:28 PM
Janningā­
Janningā­ - avatar