How to compare dates without time in JavaScript?

9 months ago
Anonymous $rc1z7tsipX

let date1 = new Date("2024-01-29T03:34:48.000Z"); // Tue Jan 29 2024 03:34:48 GMT+0000

let date2 = new Date("2024-01-29T15:00:00.000Z"); // Tue Jan 29 2024 15:00:00 GMT+0000

let date1String = date1.toDateString(); // "Tue Jan 29 2024"

let date2String = date2.toDateString(); // "Tue Jan 29 2024"

console.log(date1String === date2String); // Output: true

console.log(date1String < date2String); // Output: false

console.log(date1String > date2String); // Output: false

Last Seen
13 minutes ago
Reputation
0
Spam
0.000
Last Seen
10 minutes ago
Reputation
0
Spam
0.000
Last Seen
27 minutes ago
Reputation
0
Spam
0.000
Last Seen
27 minutes ago
Reputation
0
Spam
0.000
Last Seen
2 hours ago
Reputation
0
Spam
0.000
Last Seen
about an hour ago
Reputation
0
Spam
0.000
Last Seen
a few seconds ago
Reputation
0
Spam
0.000