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

Iteration occurs two times #1

Open
zabimca opened this issue Mar 12, 2021 · 0 comments
Open

Iteration occurs two times #1

zabimca opened this issue Mar 12, 2021 · 0 comments

Comments

@zabimca
Copy link

zabimca commented Mar 12, 2021

Hi,

Thanks for this lovely code which works as i expected, but there is one minor bug which i tried to fix but couldn't.
in for loop the seconds given in 60 (1 minute), if i have $future_date 1 minute beyond $now (current time) it should stop once the $future_date and $now is equal but the current code iterates two times, means once the condition ends its not stopping rather it iterates again and then it stops.

Example : consider $future_date is 3:35 (in time i have given) and $now is 3:33 then the countdown timer should display as 00:00:02:59 and once it completes 2 minutes it should stop at 00:00:00:00 but the issue is it again runs the timer from 00:00:02:59 and then it stops correctly at 00:00:00:00.

My findings is that there is some issue in if loop (if $future_date < $now) and the increments in for loop and in $now->modify('+1 second').

If these gets fixed it would be great.

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

1 participant