Using the option function causes relative countdowns to restart. This can be reproduced with the following steps:
- Visit the demo page at http://keith-wood.name/countdownBasics.html. Open the browser's developer console to enter JS.
- Stop the running countdown with
$('#defaultCountdown').countdown('destroy');
- Start a new countdown with a relative expiry with
$('#defaultCountdown').countdown({until: '+1m'});
- Change anything in the configuration with e.g.
$('#defaultCountdown').countdown('option', 'format', 'MS');
You'll see that the countdown starts counting down again from 1 minute although that option wasn't changed. After a brief inspection of the code I pinned the error down to https://github.com/kbwood/countdown/blob/master/src/js/jquery.countdown.js#L384. There is a check if the timezone changed. It is assume changed, if the two timezones are not equal. As the new config option does not have a timezone set the test always concludes that the timezone changed an the countdown has to be restarted.
There is also a workaround for this. You can grab the current timezone from the options and reapply that together with the actual change intended like this:
let timezone = $('#defaultCountdown').countdown('option', 'timezone');
$('#defaultCountdown').countdown('option', { format: 'YODHMS', timezone: timezone });
Thanks for the great component! My team is using it in an E-Assessment system at the university of Duisburg-Essen and it works great.
Using the option function causes relative countdowns to restart. This can be reproduced with the following steps:
You'll see that the countdown starts counting down again from 1 minute although that option wasn't changed. After a brief inspection of the code I pinned the error down to https://github.com/kbwood/countdown/blob/master/src/js/jquery.countdown.js#L384. There is a check if the timezone changed. It is assume changed, if the two timezones are not equal. As the new config option does not have a timezone set the test always concludes that the timezone changed an the countdown has to be restarted.
There is also a workaround for this. You can grab the current timezone from the options and reapply that together with the actual change intended like this:
Thanks for the great component! My team is using it in an E-Assessment system at the university of Duisburg-Essen and it works great.