Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: timestamp unit for startAt #691

Merged
merged 8 commits into from
Mar 6, 2018
Merged

Conversation

DanDeMicco
Copy link
Contributor

Adds support for timestamp parsing for startAt. A timestamp is a youtube style timestamp such as 5h2m1s and will start media previews at that point.

@boxcla
Copy link

boxcla commented Feb 28, 2018

Verified that @DanDeMicco has signed the CLA. Thanks for the pull request!

* @return {number} - the time in seconds
*/
convertTimestampToSeconds(timestamp) {
let timeInSeconds = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use INITIAL_TIME_IN_SECOND?

* @param {string} match - the timestamp substring e.g. 1h, 2m, or 3s
* @return {number} - the number for the given unit
*/
const getValueOfMatch = (match) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to break this out for testing purposes

return Number.isNaN(parsedMatch) ? 0 : parsedMatch;
};

if (hours) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very readable! 👍

@DanDeMicco DanDeMicco merged commit 79ec9da into box:master Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants