Hey folks, thank you for such a great plugin.
In my custom wordpress theme, I have the following element powering a countdown.
data-show-start-time="<?php echo $start_time; ?>"
data-show-end-time="<?php echo $end_time; ?>"
data-show-current-time="<?php echo time(); ?>">...</figure>
$start_time and $end_time are retrieved as timestamps using get_field(), and presumably everything is in the same timezone since all timestamps are computed server side.
My problem is that the current time is always way ahead of the end time. I looked in the ACF DateTime picker code and saw its use of PHP’s strtotime, and I wondered if some relative date calculation is throwing something off, but I found the timestamps matched the fields exactly.
I never change timezones at any point in my code, but I can literally put a start time in the past and an end time in the future and still end up with the countdown reporting that it was long finished.
Here’s an empirical example.
<figure class="mike" data-show-start-time="1407008220" data-show-end-time="1407009540" data-show-current-time="1407024748">
Just to aid my understanding, how does ACF’s date picker behave differently than my use of
time()? I’d like to understand why
time() seems to give me dramatically different results even though I’m to understand everything is timezone independent.