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

Fix time label when time is more than an hour #900

Merged
merged 2 commits into from
Jul 29, 2020
Merged

Conversation

karaggeorge
Copy link
Member

Fixes #893

@sindresorhus
Copy link
Contributor

sindresorhus commented Jul 22, 2020

Why are we showing milliseconds there? Seems unnecessary.

};

const format = (time, {showMilliseconds} = {}) => {
const formatString = `${time >= 60 * 60 ? 'h:m' : ''}m:ss${showMilliseconds ? '.SS' : ''}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, but I think we should show it as

Suggested change
const formatString = `${time >= 60 * 60 ? 'h:m' : ''}m:ss${showMilliseconds ? '.SS' : ''}`;
const formatString = `${time >= 60 * 60 ? 'hh:mm' : ''}mm:ss${showMilliseconds ? '.SS' : ''}`;

This is how most video players show duration.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you meant this:

Suggested change
const formatString = `${time >= 60 * 60 ? 'h:m' : ''}m:ss${showMilliseconds ? '.SS' : ''}`;
const formatString = `${time >= 60 * 60 ? 'h:' : ''}mm:ss${showMilliseconds ? '.SS' : ''}`;

right? Otherwise if it's more than an hour the format becomes hh:mmmm:ss

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant:

Suggested change
const formatString = `${time >= 60 * 60 ? 'h:m' : ''}m:ss${showMilliseconds ? '.SS' : ''}`;
const formatString = `${time >= 60 * 60 ? 'hh:m' : ''}m:ss${showMilliseconds ? '.SS' : ''}`;

@karaggeorge
Copy link
Member Author

karaggeorge commented Jul 22, 2020

I'm not sure about the milliseconds. I've never found it useful, but it was like that since Kap 2.x, so I just kept the logic during the rewrite. I'm ok with removing them.

@sindresorhus
Copy link
Contributor

Yeah, let's try removing it and see if anyone complains.

@karaggeorge
Copy link
Member Author

Removed milliseconds and changed the format 👍

@sindresorhus sindresorhus merged commit 63a239a into master Jul 29, 2020
@sindresorhus sindresorhus deleted the editor-time branch July 29, 2020 17:47
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.

Video time displayed incorrectly after 60 minutes
2 participants