mirror of
https://github.com/Equicord/Equicord.git
synced 2025-03-30 12:11:58 -04:00
MessageLatency: Fix off by one error on some deltas (#3297)
This commit is contained in:
parent
dcb7a593e5
commit
48868f01fe
1 changed files with 5 additions and 5 deletions
|
@ -63,11 +63,11 @@ export default definePlugin({
|
|||
|
||||
stringDelta(delta: number, showMillis: boolean) {
|
||||
const diff: Diff = {
|
||||
days: Math.round(delta / (60 * 60 * 24 * 1000)),
|
||||
hours: Math.round((delta / (60 * 60 * 1000)) % 24),
|
||||
minutes: Math.round((delta / (60 * 1000)) % 60),
|
||||
seconds: Math.round(delta / 1000 % 60),
|
||||
milliseconds: Math.round(delta % 1000)
|
||||
days: Math.floor(delta / (60 * 60 * 24 * 1000)),
|
||||
hours: Math.floor((delta / (60 * 60 * 1000)) % 24),
|
||||
minutes: Math.floor((delta / (60 * 1000)) % 60),
|
||||
seconds: Math.floor(delta / 1000 % 60),
|
||||
milliseconds: Math.floor(delta % 1000)
|
||||
};
|
||||
|
||||
const str = (k: DiffKey) => diff[k] > 0 ? `${diff[k]} ${diff[k] > 1 ? k : k.substring(0, k.length - 1)}` : null;
|
||||
|
|
Loading…
Add table
Reference in a new issue