From e04c723de594c3f842e55dd8e3880f123d30de54 Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 28 Apr 2024 08:09:56 +0200 Subject: [PATCH] Extend statistics over the whole time range (#1626) --- pages/statistics/statistics.html | 1 + pages/statistics/statistics.js | 12 +++++++++++- pages/updates/updates.html | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pages/statistics/statistics.html b/pages/statistics/statistics.html index b260b82e..9feea7da 100644 --- a/pages/statistics/statistics.html +++ b/pages/statistics/statistics.html @@ -23,6 +23,7 @@ +
Delete
diff --git a/pages/statistics/statistics.js b/pages/statistics/statistics.js index 02003218..0408509e 100644 --- a/pages/statistics/statistics.js +++ b/pages/statistics/statistics.js @@ -127,6 +127,8 @@ statistics._setDateRange = function () { days = 30; } else if (type === 'year') { days = 365; + } else if (type === 'all') { + days = statistics._daysSinceFirstRelease(); } else { statistics._dateRange = [new Date().toISOString().slice(0, 10)]; } @@ -238,7 +240,7 @@ statistics._displayNameOfFramework = function (str, type) { statistics._handlerDateRange = function ({target}) { let type = target.value; - if (type === 'day' || type === 'week' || type === 'month' || type === 'year') { + if (type === 'day' || type === 'week' || type === 'month' || type === 'year' || type === 'all') { statistics._dateUnit = type; statistics._saveDefaultRange(type); } else if (type === 'delete') { @@ -270,6 +272,14 @@ statistics._registerListener = function () { }); }; +statistics._daysSinceFirstRelease = function () { + let timeDifference, millisecondsPerDay; + + timeDifference = new Date() - new Date('2020-01-01'); + millisecondsPerDay = 24 * 60 * 60 * 1000; + return Math.floor(timeDifference / millisecondsPerDay); +}; + /** * Initializations diff --git a/pages/updates/updates.html b/pages/updates/updates.html index e4999781..53dc0353 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -32,6 +32,7 @@

Improved

Fixed