So I have a date being pulled from a database called preCountDate
for this example preCountDate = 2017-10-12
I need to check if this is bigger than todays date which I am setting like this preToday = new Date(); now I can see that they are returning different formats which I assume to the issue and why this isn't working:
if(preCountDate > preToday){
preToday = [preCountDate, preCountDate = preToday][0];
preCountDate = moment(preCountDate).subtract(1, 'day');
}
I use the above to check is the preCountDate is bigger, if yes then swap them around.
This doesn't get run with the above. I think its to do with the format that preToday returns but not sure how to format in a way that will work
help appreciated
Different to the one suggested as I am not using unix time