diff options
author | monikahedman <monika_hedman@brown.edu> | 2020-02-09 15:07:55 -0500 |
---|---|---|
committer | monikahedman <monika_hedman@brown.edu> | 2020-02-09 15:07:55 -0500 |
commit | 61d4938de06a09687eca4a1549d48b1009aa4134 (patch) | |
tree | 339a864b78b8d8134124056234926ad011818bf3 | |
parent | 830603bcfd933431d16340a6e8061fccfd8c94de (diff) |
rounding fix
-rw-r--r-- | src/client/views/animationtimeline/Timeline.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx index e4af43e0a..cbdbd07b149 100644 --- a/src/client/views/animationtimeline/Timeline.tsx +++ b/src/client/views/animationtimeline/Timeline.tsx @@ -326,15 +326,18 @@ export class Timeline extends React.Component<FieldViewProps> { @action toReadTime = (time: number): string => { time = time / 1000; - var inSeconds = Math.round((time * 100)) / 100; + const inSeconds = Math.round(time * 100) / 100; + + // console.log(inSeconds) // var inSeconds = parseFloat(time.toFixed(2)); // const inSeconds = (Math.floor(time) / 1000); - let min: (string | number) = Math.floor(inSeconds / 60); - let sec: (string | number) = inSeconds % 60; + const min: (string | number) = Math.floor(inSeconds / 60); + let sec: (string | number) = (Math.round((inSeconds % 60) * 100) / 100); if (Math.floor(sec / 10) === 0) { sec = "0" + sec; } + // sec = Number.parseFloat(sec).toFixed(2); return `${min}:${sec}`; } |