mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fix error at time unit boundary
This commit is contained in:
parent
47d9773fc8
commit
a278086c37
@ -84,15 +84,15 @@ export class TimeFormatter implements ITimeFormatter {
|
|||||||
let days = 0;
|
let days = 0;
|
||||||
let hours = 0;
|
let hours = 0;
|
||||||
let minutes = 0;
|
let minutes = 0;
|
||||||
if (milliseconds > DAYS_IN_MS) {
|
if (milliseconds >= DAYS_IN_MS) {
|
||||||
days = Math.floor(milliseconds / DAYS_IN_MS);
|
days = Math.floor(milliseconds / DAYS_IN_MS);
|
||||||
milliseconds -= days * DAYS_IN_MS;
|
milliseconds -= days * DAYS_IN_MS;
|
||||||
}
|
}
|
||||||
if (milliseconds > HOURS_IN_MS) {
|
if (milliseconds >= HOURS_IN_MS) {
|
||||||
hours = Math.floor(milliseconds / HOURS_IN_MS);
|
hours = Math.floor(milliseconds / HOURS_IN_MS);
|
||||||
milliseconds -= hours * HOURS_IN_MS;
|
milliseconds -= hours * HOURS_IN_MS;
|
||||||
}
|
}
|
||||||
if (milliseconds > MINUTES_IN_MS) {
|
if (milliseconds >= MINUTES_IN_MS) {
|
||||||
minutes = Math.floor(milliseconds / MINUTES_IN_MS);
|
minutes = Math.floor(milliseconds / MINUTES_IN_MS);
|
||||||
milliseconds -= minutes * MINUTES_IN_MS;
|
milliseconds -= minutes * MINUTES_IN_MS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user