WebUI: use static method for getting time
Some checks failed
CI - File health / Check (push) Waiting to run
CI - macOS / Build (push) Waiting to run
CI - Python / Check (push) Waiting to run
CI - Ubuntu / Build (push) Waiting to run
CI - WebUI / Check (push) Waiting to run
CI - Windows / Build (push) Waiting to run
cpp.yaml / WebUI: use static method for getting time (push) Failing after 0s
js.yaml / WebUI: use static method for getting time (push) Failing after 0s

Unify API usage across the code base.

PR #23077.
This commit is contained in:
Chocobo1 2025-08-11 16:47:37 +08:00 committed by GitHub
commit d6672abb94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -1505,7 +1505,7 @@ window.qBittorrent.DynamicTable ??= (() => {
td.title = "∞"; td.title = "∞";
} }
else { else {
const formattedVal = "QBT_TR(%1 ago)QBT_TR[CONTEXT=TransferListDelegate]".replace("%1", window.qBittorrent.Misc.friendlyDuration((new Date() / 1000) - val)); const formattedVal = "QBT_TR(%1 ago)QBT_TR[CONTEXT=TransferListDelegate]".replace("%1", window.qBittorrent.Misc.friendlyDuration((Date.now() / 1000) - val));
td.textContent = formattedVal; td.textContent = formattedVal;
td.title = formattedVal; td.title = formattedVal;
} }

View file

@ -767,7 +767,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
// calculate days since last match // calculate days since last match
if (rulesList[ruleName].lastMatch !== "") { if (rulesList[ruleName].lastMatch !== "") {
const timeDiffInMs = new Date().getTime() - new Date(rulesList[ruleName].lastMatch).getTime(); const timeDiffInMs = Date.now() - new Date(rulesList[ruleName].lastMatch).getTime();
const daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString(); const daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString();
document.getElementById("lastMatchText").textContent = " QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]".replace("%1", daysAgo); document.getElementById("lastMatchText").textContent = " QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]".replace("%1", daysAgo);
} }