It is good to see that you got your answer.
For other guys who really want to learn how to setup Datepicker in React and Angular, check out the following tutorials. It has really helped me a lot.
Original Message:
Sent: 08-27-2019 09:53 PM
From: Kyle R
Subject: Help with validation Dates using JavaScript
Excellent!
Thanks for the confirmation.
Kyle_R.
Original Message:
Sent: 08-27-2019 09:10 PM
From: Isaque Almeida
Subject: Help with validation Dates using JavaScript
Solved. As you mentioned the values are string and are compared as string and not as date. With both values, did : zstart_date = new Date(document.......)
Original Message:
Sent: 08-27-2019 09:05 PM
From: Kyle R
Subject: Help with validation Dates using JavaScript
Hello Isaque,
Is JavaScript treating this as a string rather than a date?
Try searching the web for "JavaScript convert string to datetime" and see what comes up.
Eg:
https://www.geeksforgeeks.org/how-to-convert-javascript-datetime-to-mysql-datetime/
https://stackoverflow.com/questions/5510580/convert-string-to-datetime/24642753
Thanks, Kyle_R.
Original Message:
Sent: 08-27-2019 05:36 PM
From: Isaque Almeida
Subject: Help with validation Dates using JavaScript
Hi all.
I developed a JavaScript function to prevent that call_back_date field be less than alg.time_stamp date (activity date). Date is in format DD/MM/YYYY
The problem is that it's seems like comparing if the day of call back date is greater than day of activity date. Even if the month is greater, if the day is minor it's considering call back less than activity date.
I attached a screenshot with an example. I appreciate any help that let me to solution.
Thanks and regards.
function zValidateSchedDate(){
var zStartDate, zSchedDate;
var zSatus = document.main_form.elements["SET.status"].value;
zStartDate = document.main_form.elements['SET.alg.time_stamp'].value;
zSchedDate = document.main_form.elements['SET.call_back_date'].value;
if((zSchedDate <= zStartDate) && (zSatus == "atdschedule")){
zDisplayMessage("Schedule date needs to be a future date!");
return false;
}else{
return true;
}
}