I'm using this countdown library: https://github.com/HugoGiraudel/Countdown.js
Sometimes I need to change the counter's end value. What am I doing now is that I have a function that creates new countdown with a specific value. This solution is kinda buggy because sometimes the counter counts down both values (the old one and the new one).
Javascript isn't really my main language so I need help from you, how can I effectively change the countdown's value even when the previous countdown isn't over.
function updateTimer( d ) {
return new Countdown({
selector: '#timer',
msgPattern: "{minutes}:{seconds}</b>",
msgAfter: "00:00",
dateEnd: new Date( d )
});
}
This is the function I was writing about above. This is what the strings I'm passing to that function looks like "2015-06-25T15:35:12+02:00"