duration.tsx 487 B

123456789101112131415161718
  1. import {getDuration, getExactDuration} from 'sentry/utils/formatters';
  2. interface Props extends React.HTMLAttributes<HTMLSpanElement> {
  3. seconds: number;
  4. abbreviation?: boolean;
  5. exact?: boolean;
  6. fixedDigits?: number;
  7. }
  8. const Duration = ({seconds, fixedDigits, abbreviation, exact, ...props}: Props) => (
  9. <span {...props}>
  10. {exact
  11. ? getExactDuration(seconds, abbreviation)
  12. : getDuration(seconds, fixedDigits, abbreviation)}
  13. </span>
  14. );
  15. export default Duration;