Fix bug in round

This commit is contained in:
the1812 2019-01-08 22:45:43 +08:00
parent 819a6ca890
commit 89ce755fc8
4 changed files with 7 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -336,7 +336,8 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
{
function round(number)
{
return String(Math.round(number * 100) / 100).padStart(5, "0");
const [integer, decimal = "00"] = String(number).split(".");
return `${integer.padStart(2, "0")}.${decimal.substr(0, 2).padRight(2, "0")}`;
}
function secondsToTime(seconds)
{