How to use format-duration - 8 common examples

To help you get started, we’ve selected a few format-duration examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github u-wave / web / src / components / Dialogs / EditMediaDialog / index.js View on Github external
bodyClassName: PropTypes.string,
    contentClassName: PropTypes.string,
    titleClassName: PropTypes.string,

    onEditedMedia: PropTypes.func.isRequired,
    onCloseDialog: PropTypes.func.isRequired,
  };

  state = {
    errors: null,
    /* eslint-disable react/destructuring-assignment */
    artist: this.props.media.artist,
    title: this.props.media.title,
    start: formatDuration(this.props.media.start * 1000),
    end: formatDuration(this.props.media.end * 1000),
    /* eslint-enable react/destructuring-assignment */
  };

  handleSubmit = (e) => {
    e.preventDefault();

    const { media, onEditedMedia, onCloseDialog } = this.props;
    const {
      artist, title, start, end,
    } = this.state;

    const startSeconds = parseDuration(start);
    const endSeconds = parseDuration(end);

    const errors = [];
    if (Number.isNaN(startSeconds) || startSeconds < 0) {
github u-wave / web / src / components / Dialogs / EditMediaDialog / index.js View on Github external
onChange={this.handleChangeStart}
        icon={}
        tabIndex={BASE_TAB_INDEX + 2}
      />
    );
    const toLabel = (
      // eslint-disable-next-line jsx-a11y/label-has-for
      <label>
        {t('dialogs.editMedia.playToLabel')}
      </label>
    );
    const toInput = (
      }
        tabIndex={BASE_TAB_INDEX + 3}
      /&gt;
    );

    return (
      <form>
        {errors &amp;&amp; errors.length &gt; 0 &amp;&amp; (
          
            {errors.map(error =&gt; <div>{t(`dialogs.editMedia.errors.${error}`)}</div>)}
          
        )}

        <div></div></form>
github u-wave / web / src / components / Dialogs / EditMediaDialog / index.js View on Github external
media: PropTypes.object,

    bodyClassName: PropTypes.string,
    contentClassName: PropTypes.string,
    titleClassName: PropTypes.string,

    onEditedMedia: PropTypes.func.isRequired,
    onCloseDialog: PropTypes.func.isRequired,
  };

  state = {
    errors: null,
    /* eslint-disable react/destructuring-assignment */
    artist: this.props.media.artist,
    title: this.props.media.title,
    start: formatDuration(this.props.media.start * 1000),
    end: formatDuration(this.props.media.end * 1000),
    /* eslint-enable react/destructuring-assignment */
  };

  handleSubmit = (e) => {
    e.preventDefault();

    const { media, onEditedMedia, onCloseDialog } = this.props;
    const {
      artist, title, start, end,
    } = this.state;

    const startSeconds = parseDuration(start);
    const endSeconds = parseDuration(end);

    const errors = [];
github bmcmahen / captioner / src / Timeline.tsx View on Github external
width={2}
                fill={theme.colors.scales.gray[5]}
              /&gt;
              
                {formatDuration(mouse * 1000)}
              
            
          )}

          {/* captions */}
          {transitions.map(({ item, key, props }, i) =&gt; {
            return (
              
                 {
                    e.stopPropagation();
                    onRequestSkip(i);
                  }}
                  style={props}
                  css={{
github bmcmahen / captioner / src / Captions.tsx View on Github external
position: "relative",
            lineHeight: theme.lineHeights.body,
            paddingTop: `calc(${theme.spaces.sm} + 2px)`
          }
        ]}
        htmlFor={caption.id}
      &gt;
github u-wave / web / src / components / MediaList / Row.js View on Github external
onKeyPress={this.handleKeyPress}
        onClick={onClick}
      &gt;
        {media.loading ? (
          
        ) : (
          
        )}
        <div title="{media.artist}">
          {media.artist}
        </div>
        <div title="{media.title}">
          {media.title}
        </div>
        <div>
          {formatDuration(duration * 1000)}
        </div>
        
      
    ));
  }
}
github SKempin / Lyrics-King-React-Native / screens / DetailsScreen.js View on Github external
flex: 1,
                alignSelf: 'center',
                paddingRight: 10
              }}
            &gt;
              
              
              
              
            
          
          {this.displayLyrics()}
        
        
      
    );
  }
}
github u-wave / web / src / components / FooterBar / Eta.js View on Github external
const Eta = ({
  className, base, currentTime, endTime,
}) =&gt; {
  const currentRemaining = endTime - currentTime;
  return (
    <span>
      {formatDuration(base + currentRemaining)}
    </span>
  );
};

format-duration

Convert a number in milliseconds to a standard duration string.

ISC
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular format-duration functions