Dear All,
I have an Event form in which the submitter adds Event Dates and times in a table. The Event dates must always be later than the Submission date.
I need a warning to be issued if the Event date is too early, and I have tried to achieve this in jscript. The following code is wrong as the IF statement is looking at the day and not the whole date. So in this example my code would give a warning for 16/06/2020.
I have tried to use Date.parse but my jscript experience is limited. Any help would be appreciated.
//where .eventDate is the Event Date column and .SubmitDate is the Submission Date $(document).ready(function () { $('.cf-table-block').on('change','.eventDate input',function() { $('.cf-table-block tr').each(function() { var eventdate = $(this).find('.eventDate input').val(); var subdate = $('.SubmitDate input').val(); if(eventdate <= subdate){ alert('The eventDate must be later than the SubmitDate'); } }); }); });