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>
How about this?
DateTime DateToValue = $("#DateTo").val();
DateTime DateFromValue = $("#DateFrom").val();
if (Date.parse(DateToValue) <= Date.parse(DateFromValue)) {
$("#DateFrom").val(DateToValue)
}
The Easy Way to Do is
var start= new Date($('#txtstart').val());
var end= new Date($('#txtend').val());
if (start < end) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With