I have a date timestamp stored in mysql which is like 2017-06-29 08:37:31
I am getting it through AJAX and I want to compare it with current date, whether it is same or not.
My code is
let dateStamp = moment(this.notificationData[0].notification_timestamp).format('LL');//date/timestamp from mysql received in json
let dateToday = moment().format('LL');//current date
console.log(dateStamp,dateToday)
console.log(moment(dateToday).diff(dateStamp,'days'))//comparison
Though I am getting the result in .diff(). I want to know if there is any other correct way of doing this.
Timezone is not an issue I think for me. Just date comparison.
Thanks