1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Added date and time to the settings export file

Fixes #352
This commit is contained in:
kkapsner 2019-05-28 23:59:43 +02:00
parent 036c7cdbd0
commit b7d888dee1
2 changed files with 15 additions and 3 deletions

View file

@ -51,7 +51,19 @@
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.target = "_blank";
link.download = "CanvasBlocker-settings.json";
const now = new Date();
function format(number, digits){
var str = number.toFixed(0);
return "0".repeat(digits - str.length) + str;
}
link.download = "CanvasBlocker-settings_" +
format(now.getFullYear(), 4) + "-" +
format(now.getMonth() + 1, 2) + "-" +
format(now.getDate(), 2) + "_" +
format(now.getHours(), 2) + "-" +
format(now.getMinutes(), 2) + "-" +
format(now.getSeconds(), 2) +
".json";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);