Skip to content

Instantly share code, notes, and snippets.

@rwoloszyn
Created June 19, 2018 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwoloszyn/6eb000ab2d3b7845e590776379432a82 to your computer and use it in GitHub Desktop.
Save rwoloszyn/6eb000ab2d3b7845e590776379432a82 to your computer and use it in GitHub Desktop.
Calculate days left in js (React native)
_getLeftActivationDays = (finishDate) => {
var endDate = new Date(finishDate);
var today = new Date();
var oneDay = 24 * 60 * 60 * 1000;
return Math.round(Math.abs((today.getTime() - endDate.getTime())/ oneDay));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment