If you date is in string, then you have to split them out into the various date parts by using
split[
^]method. To avoid this hassle, you should consider using a datepicker like
https://jqueryui.com/datepicker/[
^]
Next, use the appropriate
Date[
^] methods to create the date objects.
Try this example and adapt:
<script>
var somedayString = "16/4/2015";
var dateParts= somedayString.split("/");
var day = dateParts[0];
var month = dateParts[1] - 1;
var year = dateParts[2];
someday = new Date(year, month, day);
alert("someday is " + someday);
var today = new Date();
today.setHours(0,0,0,0);
alert("today is " + today);
if (today < someday) {
text = "Today is before someday.";
} else if (today > someday) {
text = "Today is after someday.";
} else {
text = "Someday is today.";
}
alert(text);
</script>
Note that the month numbers start from 0 which represents January.