Skip to content

Commit

Permalink
Merge pull request #27700 from guardian/gl/podcast-duration-tweak
Browse files Browse the repository at this point in the history
Add leading zero to podcast duration if needed
  • Loading branch information
Georges-GNM authored Jan 8, 2025
2 parents ac66b3a + c0b1f92 commit 09da828
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/app/model/PressedCard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ object PressedCard {
audioDurationSeconds(fc).get.headOption
} else None
if (minutes.isDefined && seconds.isDefined) {
val duration = minutes.get.toString + ":" + seconds.get.toString
// adds a leading zero if the values are less than 10
val formattedMinutes = f"${minutes.get}%02d"
val formattedSeconds = f"${seconds.get}%02d"
val duration = s"$formattedMinutes:$formattedSeconds"
Some(duration)
} else None
}
Expand Down

0 comments on commit 09da828

Please sign in to comment.