use 'toLocaleDateString()'

This commit is contained in:
Régis Hanol 2017-03-13 16:11:49 +01:00
parent 64680286f4
commit 30d5d61158

View File

@ -51,8 +51,7 @@ export default {
// don't update counts in category badge nor in oneboxes (except when we force it) // don't update counts in category badge nor in oneboxes (except when we force it)
if (isValidLink($link)) { if (isValidLink($link)) {
const html = $badge.html(); const html = $badge.html();
const d = new Date(); const key = `${new Date().toLocaleDateString()}-${postId}-${href}`;
const key = `${d.getFullYear()}-${d.getMonth()}-${d.getDay()}-${postId}-${href}`;
if (/^\d+$/.test(html) && !sessionStorage.getItem(key)) { if (/^\d+$/.test(html) && !sessionStorage.getItem(key)) {
sessionStorage.setItem(key, true); sessionStorage.setItem(key, true);
$badge.html(parseInt(html, 10) + 1); $badge.html(parseInt(html, 10) + 1);