I am having the following codes and it though i'm having 01-Jan-2009
for DateTo
and 03-Jan-2009
for DateFrom
it's reading the values as NAN
. Am I missing anything? I`m referencing
var DateToValue = $("#DateTo").val();
var DateFromValue = $("#DateFrom").val();
if (Date.parse(DateToValue) <= Date.parse(DateFromValue)) {
$("#DateFrom").val(DateToValue)
}
<script src="@Url.Content("~/Scripts/jquery-1.4.2.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.datePicker.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
Use DateJS for parsing your date. http://www.datejs.com/ just include the script in your html.