duration.tsx 509 B

1234567891011121314151617181920
  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. function Duration({seconds, fixedDigits, abbreviation, exact, ...props}: Props) {
  9. return (
  10. <span {...props}>
  11. {exact
  12. ? getExactDuration(seconds, abbreviation)
  13. : getDuration(seconds, fixedDigits, abbreviation)}
  14. </span>
  15. );
  16. }
  17. export default Duration;