Skip to content

Instantly share code, notes, and snippets.

@kironroy
Created July 7, 2023 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kironroy/0de946455a5ed487b3e59bc147feb035 to your computer and use it in GitHub Desktop.
Save kironroy/0de946455a5ed487b3e59bc147feb035 to your computer and use it in GitHub Desktop.
date operators
const calcdaysPassed = (date1, date2) =>
Math.abs((date2 - date1) / (1000 * 60 * 60 * 24));
const days1 = calcdaysPassed(new Date(2037, 3, 4), new Date(2037, 3, 14));
console.log(days1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment