diff --git a/src/countdown.js b/src/countdown.js index be48365..f44ff17 100644 --- a/src/countdown.js +++ b/src/countdown.js @@ -122,10 +122,11 @@ plural = format[1]; } } - if(Math.abs(count) === 1) { - return singular; - } else { + // Fix #187 + if(Math.abs(count) > 1) { return plural; + } else { + return singular; } } // The Final Countdown diff --git a/test/unit/strftime_test.js b/test/unit/strftime_test.js index 26b93db..cecc5f3 100644 --- a/test/unit/strftime_test.js +++ b/test/unit/strftime_test.js @@ -101,6 +101,15 @@ test('return the singular when given pair of arguments', function() { $clock.tick(500); }); +test('return the singular for zero (issue #187)', function() { + $dom.countdown(new Date().valueOf() + 1000) + .on('update.countdown', function(event) { + ok(event.offset.seconds === 1); + ok(event.strftime('%m %!m:min,minutes;') === '00 min'); + }); + $clock.tick(500); +}); + test('return the correct plural even with odd looking (issue #70)', function() { $dom.countdown(new Date().valueOf() + 2 * 60 * 1000) .on('update.countdown', function(event) {