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.
you can use below code to parse through the dates, using the millisecond approach (adding milliseconds present in a day) will not work properly for the daylightsaving.
I think my answer is late, tell me if it is better or not as only this worked for me in v1.10:
My Comparison with the current date
The Easy Way to Do is
How about this?