How to check if two dates not on the same calendar day

Another option is using .toDateString() function to parse both dates into strings. The function formats output to: “Wed Jul 28 1993.” Then you can compare both date strings.

actualDate.toDateString() === dateToCheck.toDateString()
// returns true if actualDate is same day as dateToCheck

Here’s a Plunker:

http://plnkr.co/edit/J5Dyn78TdDUzX82T0ypA

And more from MDN:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)