aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2023-10-15 21:36:05 -0400
committerGitHub <[email protected]>2023-10-15 21:36:05 -0400
commit0f0e404920fd971e51ceff0acea6acd5c9cc1d51 (patch)
tree7cbcda4c328fa875febd461638700adc5bb5ff45
parente4c9afecbd41721cc009034a241c581821ce7dbf (diff)
parentf34fe5a0322c752bc8c01e0b89b62dc4025cd00f (diff)
downloadSponsorBlock-0f0e404920fd971e51ceff0acea6acd5c9cc1d51.tar.gz
SponsorBlock-0f0e404920fd971e51ceff0acea6acd5c9cc1d51.zip
Merge pull request #1878 from Choromanski/feature/add-years-to-time-saved
Added years to time saved display
-rw-r--r--src/popup.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/popup.ts b/src/popup.ts
index ac2eba75..234096fe 100644
--- a/src/popup.ts
+++ b/src/popup.ts
@@ -1052,9 +1052,10 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
*/
function getFormattedHours(minutes) {
minutes = Math.round(minutes * 10) / 10;
- const days = Math.floor(minutes / 1440);
+ const years = Math.floor(minutes / 525600); // Assumes 365.0 days in a year
+ const days = Math.floor(minutes / 1440) % 365;
const hours = Math.floor(minutes / 60) % 24;
- return (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1);
+ return (years > 0 ? years + chrome.i18n.getMessage("yearAbbreviation") + " " : "") + (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1);
}
function contentConfigUpdateListener(changes: StorageChangesObject) {