Skip to content

Commit

Permalink
Merge pull request #37682 from Pujan92/fix/37216
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl authored Mar 8, 2024
2 parents 86642ef + 73d8bec commit 8c4f72a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/VideoPlayer/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {format} from 'date-fns';

// Converts milliseconds to 'minutes:seconds' format
// Converts milliseconds to '[hours:]minutes:seconds' format
const convertMillisecondsToTime = (milliseconds: number) => {
const date = new Date(milliseconds);
return format(date, 'mm:ss');
const hours = Math.floor(milliseconds / 3600000);
const minutes = Math.floor((milliseconds / 60000) % 60);
const seconds = Math.floor((milliseconds / 1000) % 60)
.toFixed(0)
.padStart(2, '0');
return hours > 0 ? `${hours}:${String(minutes).padStart(2, '0')}:${seconds}` : `${minutes}:${seconds}`;
};

export default convertMillisecondsToTime;
1 change: 1 addition & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4642,6 +4642,7 @@ const styles = (theme: ThemeColors) =>
videoPlayerTimeComponentWidth: {
width: 40,
},

colorSchemeStyle: (colorScheme: ColorScheme) => ({colorScheme}),

updateAnimation: {
Expand Down

0 comments on commit 8c4f72a

Please sign in to comment.