Show 1 instead of 0 for final second
Opened this issue · 5 comments
Kinda weird seeing a 0 on a countdown when there is technically 1 second remaining. Can there be a switch or an offset?
thanks
+1
Would be great if this feature is added, seems like a common scenario when it's used as a count down timer.
This is not a feature it is a bug in the code. I set it up as below with durations 12 so its the same as a clock. At 3 you should be 1/4 of the way around, and 6 1/2 the way around, 9 3/4 and at 12 or 0 the full way around, but below is what it looks like. It looks weird because it is wrong the text and the animation is i second ahead
duration: 12
initialDuration: 0
@liveaffiliates I get your point, but there could be different scenarios where a 0 needs to be shown.
In the example you mentioned, even-though you've set the duration to be 12, it's actually 13 (extra 1 second for the 0). Therefore as OP mentioned, there should be an option where we could skip the 0 or add an offset.
I just timed it with a stopwatch the timer is not even running for the correct amount of time
Solved with pull request #35 , I personally had the same problem, and the solution I gave it was a bit more generic, allowing you to manually edit the text given a duration.
Here is an example of how to solve this problem using the changes in pull request #35 :
Possible solution 1: Replace only '0' with specific text.
In the example of use in the code I specifically solve it by substituting the '0' for the 'GO'
timeFormatterFunction: (oldFormatterFunction, duration) {
if (duration.inSeconds == 0) {
return "GO";
} else {
return Function.apply(oldFormatterFunction, [duration]);
}
}
Possible solution 2: Displace all the text one second with respect to the duration
timeFormatterFunction: (_, duration) {
return '${duration.inSeconds + 1}';
}