JSFiddle - React, Tailwind, and code Playground
JavaScript
var mydate = new Date();//Todays date
var theyear = mydate.getFullYear();
var themonth = mydate.getMonth() + 1;
var thetoday = mydate.getDate();
var txtDate = {};
txtDate.value='12-Jul-2012'; //SET THIS TO LESS THAN 7 DAYS FROM NOW TO CHECK FUNCTION
var newDate = new Date(txtDate.value); //make date object
var difference = Math.ceil((newDate-mydate) / (60*60*24*1000));
if (difference > 7) alert('more than 7 days');