alexanderwallin / react-player-controls

⏯ Dumb and (re)useful React components for media players.
http://alexanderwallin.github.io/react-player-controls/
ISC License
191 stars 35 forks source link

Round down FormattedTime seconds #27

Closed thekeenant closed 7 years ago

thekeenant commented 7 years ago

Right now, a time like 59.8 will result in:

hours = floor(59.8 / 3600) = 0 minutes = floor((59.8 % 3600) / 60) = 0 seconds = round(59.8) % 60 = 0

Thus, 0:00 when it is formatted. This change corrects that to 0:59. 59.4 has always displayed correctly as 0:59 because the round function results in 59 % 60 = 59.

The seconds should really still be 59 because the time hasn't turned over to 1 minute yet. I can't really think of a case where it should round up.

alexanderwallin commented 7 years ago

This makes sense, good catch!

alexanderwallin commented 7 years ago

0.5.17 released!