I try to compare date from MySQL:DATENOW and compare it with date now in angular.
This is my function
getReports(onSuccessCallback: Function) {
this.http.getReports(Globals.userID).subscribe(data => {
data.map((report) => {
const nowDay = new Date().toLocaleDateString();
report.deadLine = new Date(report.deadLine).toLocaleDateString();
if (report.deadLine === nowDay) {
console.log(true);
}
});
onSuccessCallback(data);
}, error => {
console.log(error);
});
}
}
When i do this is work fine and take whats equal and console true, but the problem is whan i try to console true if Date already passed I try:
if (report.deadLine < nowDay){
console.log(true);
}
and its not work