micinie2020, the shared code is incomplete. The View, Action, and decimalToTime() function are missing, The community cannot review the most important parts of the code.
Can you share the input values? If you are not sure, set a break point and single step over your JavaScript code to find the input values. You can also view the HTML source. Is decimaltoTime() a custom function you wrote? Have you properly tested the
function?
It seems you are not using standard debugging tools because you have not drilled down far enough into the code. You shared source of the error but did not take the time to investigate the source of the data to make sure the data is a valid date.
Member
126 Points
801 Posts
Jquery Comparison Date
Mar 31, 2020 09:17 AM|micnie2020|LINK
Hi,
I have 24 Hr Date format:-
var dtPredLateCurrent = new Date($('input[name="ReferDate_' + idx + '"]').val() + " " + $('input[name="Start_' + idx + '"]').val()+":00"); //2019-12-10 00:00:00
var dtPredLateSt = new Date($('input[name="ReferDate_' + idx + '"]').val() + " " + decimalToTime("@ViewData["LATEOTStart"]")+":00"); //2019-12-10 22:00:00
var dtPredLateEnd = new Date($('input[name="ReferDate_' + idx + '"]').val() + " " + decimalToTime("3")+":00"); //2019-12-10 03:00:00
if (dtPredLateSt < dtPredLateCurrent < dtPredLateEnd) {
...do something
}
I getting error: Invalid Date
Please help.
Regards,
Micheale
All-Star
53631 Points
23986 Posts
Re: Jquery Comparison Date
Mar 31, 2020 12:02 PM|mgebhard|LINK
micinie2020, the shared code is incomplete. The View, Action, and decimalToTime() function are missing, The community cannot review the most important parts of the code.
Can you share the input values? If you are not sure, set a break point and single step over your JavaScript code to find the input values. You can also view the HTML source. Is decimaltoTime() a custom function you wrote? Have you properly tested the function?
It seems you are not using standard debugging tools because you have not drilled down far enough into the code. You shared source of the error but did not take the time to investigate the source of the data to make sure the data is a valid date.
All-Star
58444 Points
15764 Posts
Re: Jquery Comparison Date
Apr 02, 2020 03:01 PM|bruce (sqlwork.com)|LINK
your date format is invalid. should be '2019-12-10T00:00:00' or '2019/12/10 00:00:00'