Skip to content

Commit

Permalink
Update duration format regex detection in toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Hamon committed Dec 13, 2016
1 parent b770dbf commit b2f165f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inc/toolbox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ static function parseJSON($json_content)

static function formatDuration($duration) {

if(preg_match('/^(\d{1}):(\d{2}):(\d{2})$/i', $duration, $matches)) {
$duration = 'PT0'.$matches[1].'H'.$matches[2].'M'.$matches[3].'S';
if(preg_match('/^(\d{2}):(\d{2}):(\d{2})$/i', $duration, $matches)) {
$duration = 'PT'.$matches[1].'H'.$matches[2].'M'.$matches[3].'S';
}

return static::FormatISO8601DateInterval($duration);
Expand Down

0 comments on commit b2f165f

Please sign in to comment.