forked from wulkano/Kap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't show milliseconds in the left duration timer in the editor (wul…
…kano#557) As discussed in Slack, it's just noise. We already show it when you hover the progress bar.
- Loading branch information
1 parent
9979be2
commit b2e3562
Showing
3 changed files
with
14 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import moment from 'moment'; | ||
|
||
const formatTime = (time, duration) => { | ||
const durationFormatted = duration ? | ||
const formatTime = (time, options) => { | ||
options = { | ||
showMilliseconds: true, | ||
...options | ||
}; | ||
|
||
const format = `m:ss${options.showMilliseconds ? '.SS' : ''}`; | ||
|
||
const durationFormatted = options.extra ? | ||
` (${moment() | ||
.startOf('day') | ||
.milliseconds(duration * 1000) | ||
.format('m:ss.SS')})` : | ||
.milliseconds(options.extra * 1000) | ||
.format(format)})` : | ||
''; | ||
|
||
return `${moment() | ||
.startOf('day') | ||
.milliseconds(time * 1000) | ||
.format('m:ss.SS')}${durationFormatted}`; | ||
.format(format)}${durationFormatted}`; | ||
}; | ||
|
||
export default formatTime; |