🚸 improve countdown accuracy

This commit is contained in:
DrMaxNix 2024-07-30 21:24:42 +02:00
parent ab5f77cc7a
commit 5e3d8895e9

View File

@ -31,8 +31,8 @@ async function countdown_redraw(){
let hours_raw = Math.floor((difference - (days_raw * 86400000)) / (3600000));
let hours = (hours_raw < 10 ? ("0" + hours_raw) : hours_raw);
// minutes
let minutes_raw = Math.floor((difference - (days_raw * 86400000) - (hours_raw * 3600000)) / (60000));
// minutes (NOTE: As this is the last unit, we use `ceil` here)
let minutes_raw = Math.ceil((difference - (days_raw * 86400000) - (hours_raw * 3600000)) / (60000));
let minutes = (minutes_raw < 10 ? ("0" + minutes_raw) : minutes_raw);