Skip to content

Iteration occurs two times #1

@zabimca

Description

@zabimca

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions