var d=(new Date()).getDate();
var z = new Date(new Date().getTime()+(1*24*60*60*1000)).getDate(); // +1 День
if(d==localStorage.getItem('uActDate')) {
localStorage.setItem('uActDate',z);
localStorage.setItem('uActDays',Number(localStorage.getItem('uActDays'))+Number(1));
} else {
localStorage.setItem('uActDate',z);
localStorage.setItem('uActDays','1');
};
const KEY = 'myLSkey';
const ymd = date =>
new Date(date.setTime(date.getTime() - date.getTimezoneOffset() * 6e4))
.toISOString()
.substring(0, 10);
const today = ymd(new Date()); // '2022-06-23'
const data = {
date: today,
count: 1,
...JSON.parse(localStorage.getItem(KEY)),
};
if (data.date !== today) {
data.date = today;
data.count++;
}
localStorage.setItem(KEY, JSON.stringify(data));