Find different between start date and current date in Local Storage using Javascript
if (localStorage.getItem('bookname_1') == null) {
var coeff = 1000 * 60 * 5;
var date = new Date(); //or use any other date
var rounded = new Date(Math.round(date.getTime() / coeff) * coeff)
console.log(rounded)
localStorage.setItem('bookname_1' , rounded);
}else{
var regDate=localStorage.getItem('bookname_1')
regDate=new Date(regDate)
var now = new Date();
var one_day=1000*60*60*24;
var diffDays = Math.round(Math.abs((now.getTime() - regDate.getTime())/(one_day)));
alert(diffDays)
if(diffDays>=2){// change days here
document.getElementById('black').style.display = 'block';
}
}