duration.tsx 520 B

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