Commit 865b6936 by polesye

BLD-1060: Fix RelativeTime.

parent ee368da6
......@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
Blades: Fix bug with incorrect RelativeTime value after XML serialization. BLD-1060
LMS: Update bulk email implementation to lessen load on the database
by consolidating chunked queries for recipients into a single query.
......
......@@ -3,6 +3,13 @@
describe('Time', function () {
describe('format', function () {
describe('with NAN', function () {
it('return a correct time format', function () {
expect(Time.format('string')).toEqual('0:00');
expect(Time.format(void(0))).toEqual('0:00');
});
});
describe('with duration more than or equal to 1 hour', function () {
it('return a correct time format', function () {
expect(Time.format(3600)).toEqual('1:00:00');
......
......@@ -12,6 +12,10 @@
function format(time, formatFull) {
var hours, minutes, seconds;
if (!_.isFinite(time)) {
time = 0;
}
seconds = Math.floor(time);
minutes = Math.floor(seconds / 60);
hours = Math.floor(minutes / 60);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment