How to use 'javascript date equality' in JavaScript

Every line of 'javascript date equality' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
45export function datesAreEqual(date1: Date, date2: Date) {
46 if (date1 instanceof Date && date2 instanceof Date) {
47 return (
48 date1.getFullYear() === date2.getFullYear() &&
49 date1.getMonth() === date2.getMonth() &&
50 date1.getDate() === date2.getDate()
51 );
52 } else {
53 return false;
54 }
55}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets