Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show 1 instead of 0 for final second #20

Open
jtkeyva opened this issue Mar 18, 2021 · 5 comments
Open

Show 1 instead of 0 for final second #20

jtkeyva opened this issue Mar 18, 2021 · 5 comments

Comments

@jtkeyva
Copy link

jtkeyva commented Mar 18, 2021

Kinda weird seeing a 0 on a countdown when there is technically 1 second remaining. Can there be a switch or an offset?
thanks

@ramith-ascentic
Copy link

+1

Would be great if this feature is added, seems like a common scenario when it's used as a count down timer.

@liveaffiliates
Copy link

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

image

@ramith-ascentic
Copy link

ramith-ascentic commented Jun 15, 2021

@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.

@liveaffiliates
Copy link

I just timed it with a stopwatch the timer is not even running for the correct amount of time

@JesusHdez960717
Copy link

JesusHdez960717 commented Oct 27, 2021

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}';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants