Skip to content

Commit 6f06297

Browse files
committed
fix: Fix round to nearest interval
1 parent 613b4ca commit 6f06297

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/date.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const formatTimer = (milliseconds: number) => {
1818
*/
1919
export const roundTimeNearestInterval = (milliseconds: number, interval: number) => {
2020
const seconds = milliseconds / 1000;
21-
const m = Math.round(seconds / 60 / interval) * interval;
21+
const m = Math.round(Math.round((seconds / 60) % 60) / interval) * interval;
2222
const h = Math.floor(seconds / 60 / 60) + Math.floor(m / 60);
2323
return (h * 60 + (m % 60)) * 60 * 1000;
2424
};

0 commit comments

Comments
 (0)