timer.jquery
timer.jquery copied to clipboard
Countdown timer with negative remaining time
Try to initialize countdown with negative remaining time (i.e. seconds > duration):
let timeLimit = 10;
let timeElapsed = 15;
let $countdown = $("#countdown").timer({
countdown: true,
duration: timeLimit + 's',
seconds: timeElapsed
});
Expected result: -5 sec
Actual result: -1:0-5 min
Demo: https://jsfiddle.net/naXa/gmcbfd4w (v0.7.1) and https://jsfiddle.net/naXa/gmcbfd4w/9 (v0.9.0)
It would be nice to have an endless countdown which:
- doesn't stop when reached 0.
- looks nice with negative time values.
- can be initialized with negative
duration.
Thanks for submitting this issue.
By default maybe we can have the timer stop on encountering such a situation and we can bypass it by a property that says something like allowNegativeCountdown. Or We could implement it and set this to be true by default and have users explicitly set it to false if they dont want this behavior.
Either ways, this is a good to have feature.. Feel free to implement it and send a PR (assign it to yourself if you are interested).. if not I ll try to squeeze in some time to add this unless somebody else picks it up and assigns to themselves in the mean time.