Skip to content

Commit

Permalink
Remove inputUnit parameter of formatDuration
Browse files Browse the repository at this point in the history
The inputUnit parameter was not used anywhere and significantly
complicated the implementation of the formatDuration function.
Now, all inputs are assumed to be in microseconds which is consistent
with a few other methods in the date.tsx file.

Signed-off-by: James Ferguson <jamesferguson497@gmail.com>
  • Loading branch information
jamesfer committed Oct 6, 2020
1 parent 1e2f249 commit 90b6cc7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/jaeger-ui/src/utils/date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ export function formatSecondTime(duration: number) {
}

/**
* Humanizes the duration based on the inputUnit
* Humanizes the duration for display.
*
* Example:
* 5000ms => 5s
* 1000μs => 1ms
* 183840s => 2d 3h 4m
*
* @param {number} duration (in microseconds)
* @return {string} formatted duration
*/
export function formatDuration(duration: number, inputUnit: string = 'microseconds'): string {
export function formatDuration(duration: number): string {
if (duration < 1) {
return `${_round(duration, 2)}μs`;
}
Expand Down

0 comments on commit 90b6cc7

Please sign in to comment.