duration.tsx 557 B

123456789101112131415161718192021
  1. import getDuration from 'sentry/utils/duration/getDuration';
  2. import {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. function Duration({seconds, fixedDigits, abbreviation, exact, ...props}: Props) {
  10. return (
  11. <span {...props}>
  12. {exact
  13. ? getExactDuration(seconds, abbreviation)
  14. : getDuration(seconds, fixedDigits, abbreviation)}
  15. </span>
  16. );
  17. }
  18. export default Duration;