Hi,
I'm struggling with an apparently easy task : compare 2 dates with :
if (dt < dt1) {
...
It doesn't work. I have been looking in some JS forums, but nothing works. My date variables are declared as Objects with new Date(). I tried :
if (dt.getTime() < dt1.getTime()) {
which returns a "getTime() is not a function" error message
if (new Date(dt).getTime() < new Date(dt1).getTime()) {
does not work either
Here is the code :
let tableRows = $w('#table1').rows;
var dt = Date(tableRows[0]['dateTime'].valueOf());
var Year = dt.substring(11,15);
dt = new Date(tableRows[0]['dateHeure'].valueOf());
var dt1 = new Date(Year,8,1);
console.log('dt='+dt+' dt1='+new Date(Year,8,1));
if (dt.getTime() < dt1.getTime()) {
...
here are the actual dt and dt1 returned by console.log:
dt=Tue Oct 29 2019 19:15:00 GMT+0100 dt1=Tue Sep 01 2020 00:00:00 GMT+0200
Any idea ? Thanks for the help !
Have you tried simply searching the forum for previous posts about similar as you would have found...
https://www.wix.com/corvid/forum/community-discussion/date-difference-in-date-picker
https://www.wix.com/corvid/forum/community-discussion/find-the-difference-in-hours-between-2-dates