I am trying to write a program that allows two dates to be separated using JavaScript. The two dates I want to compare are entered using an HTML form using a date format. I want to compare two entered dates using javaScript, in particular, to find the difference between the two dates in full weeks and then in the remaining days. I managed to compare two hardcoded dates in javaScript, but I was having problems with these two dates in the form. Any pointers would be much appreciated! The following is a javaScript program:
<!DOCTYPE html> <html> <title> Dates </title> <head>Class Test <script language="javascript"> function Ict5() { </script> </head> <body> <H1> An Example of Form </H1> <Form action="process.pl" method="POST" name="MyForm" onsubmit="return formValidation()"> <p>Enter Date:</p> <input type=date name="date1" id="date1"> <input type=date name="date2" id="date2"> <button type="button" onclick="Ict5()">Calculate Fare</button><br> </Form> </body> </html>
user4206269
source share