From 3bfe09b821d9f5e2e4c7bdb352c95b6e363d7778 Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Fri, 3 Oct 2014 15:32:07 +0500 Subject: [PATCH] Fixed incorrect relative time value in time.js. TNL-157 --- common/lib/xmodule/xmodule/js/spec/time_spec.js | 2 +- common/lib/xmodule/xmodule/js/src/time.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/time_spec.js b/common/lib/xmodule/xmodule/js/spec/time_spec.js index 1941d09959..4790d87d8f 100644 --- a/common/lib/xmodule/xmodule/js/spec/time_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/time_spec.js @@ -33,7 +33,7 @@ [488, '00:08:08'], [2452, '00:40:52'], [3600, '01:00:00'], [28800, '08:00:00'], [144532, '40:08:52'], [190360, '52:52:40'], - [294008, '81:40:08'] + [294008, '81:40:08'], [-5, '00:00:00'] ]; $.each(testTimes, function (index, times) { diff --git a/common/lib/xmodule/xmodule/js/src/time.js b/common/lib/xmodule/xmodule/js/src/time.js index b4ccb6652c..ab6580e388 100644 --- a/common/lib/xmodule/xmodule/js/src/time.js +++ b/common/lib/xmodule/xmodule/js/src/time.js @@ -12,7 +12,7 @@ function format(time, formatFull) { var hours, minutes, seconds; - if (!_.isFinite(time)) { + if (!_.isFinite(time) || time < 0) { time = 0; }