Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
noman-land committed Nov 29, 2024
1 parent 5ad8a8a commit c2150c4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/js/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ export const formatDuration = (duration: number) => {
return `${Math.floor(duration / 60)} minutes`;
};

const zeroPad = (num: number) => {
return Math.floor(num).toString().padStart(2, '0');
};

export const formatTimestamp = (duration: number) => {
const minutes = Math.floor(duration / 60)
.toString()
.padStart(2, '0');
const seconds = Math.floor(duration % 60)
.toString()
.padStart(2, '0');
const minutes = zeroPad(duration / 60);
const seconds = zeroPad(duration % 60);
return `${minutes}:${seconds}`;
};

Expand All @@ -57,9 +57,10 @@ export const formatName = ({ firstName, middleName, lastName }: Presenter) =>
[firstName, middleName, lastName].filter(n => n).join(' ');

export const formatVenueName = (venue: Venue) => {
return `${venue.name} (${[venue.region, venue.city, venue.state]
const location = [venue.region, venue.city, venue.state]
.filter(n => n)
.join(', ')})`;
.join(', ');
return `${venue.name} (${location})`;
};

export const sortByLabel = (a: Option, b: Option) => {
Expand Down

0 comments on commit c2150c4

Please sign in to comment.