kinabalu / obsidian-word-sprint

Obsidian Word Sprint plugin
MIT License
41 stars 6 forks source link

00:60 left #17

Closed MalignantCarp closed 2 years ago

MalignantCarp commented 2 years ago

This picture says it all: image

The issue is utils.ts in secondsToMMSS care of wonderful floating point math. Like the number coming in is something like 59.8 seconds, which is less than 60 so Math.ceil(seconds % 60) Since we're modding a floating point, seconds % 60 can yield 0 through 59.999..., so running Math.ceil is bringing it up to 60.

Probably best to run ceiling on the initial seconds before calculating minutes and then use round instead of ceil for calculating secondsForFormatting.

That will also fix the fact that the minute went down to 0 before reaching 59 seconds.

kinabalu commented 2 years ago

Fixed in 0.0.17