Created
March 22, 2023 10:36
-
-
Save blackspike/7c57b80fc747721e739b88b11256e50c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TWO_WEEKS_IN_MS = 14 * 24 * 60 * 60 * 1000; // 14 days in milliseconds | |
const targetDate = new Date('2023-03-10T14:45:04Z'); | |
const currentDate = new Date(); | |
if (currentDate.getTime() - targetDate.getTime() >= TWO_WEEKS_IN_MS) { | |
console.log('The target date is two weeks or older than the current date.'); | |
return true; | |
} else { | |
console.log('The target date is less than two weeks older than the current date.'); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment