Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a webserver running on UTC. The date fields are saved as UTC. The user has a timezone of 'Europe/London' (UTC+1h). All the countdown dates have 1 hour added to them.
around line 226 in jquery_countdown.module the date field stored as UTC is formatted using the date() function with a hardcoded offset of +0000.
$vars['id'] = $instance['field_name'] . '-' . $instance['id']; // use field as unique id
$vars['options']['until'] = date("F d, Y g:i a +0000", strtotime($item['value'])); // get date from start field
To fix this bug i guess it needs to pull the timezone from the user object and apply the correct offset here.
Will attempt to supply a diff patch when we're off deadline
Comments
Comment #1
alb CreditAttribution: alb commentedI not know drupal 7 but think is how vers 6
if you use a cck field is possible to set the Time zone handling: ...
which code you use for to see the timer?
Comment #2
joachim CreditAttribution: joachim commented> To fix this bug i guess it needs to pull the timezone from the user object and apply the correct offset here.
I think it may be more complicated than applying an offset.
A further problem this causes is that the countdown is not aware of changes in daylight saving time.
For example:
- I set my countdown date to August 12, 00:00. My timer says X days 7 hours. That seems right, as it's currently 17:00 and it's 7 hours to midnight.
- I set my countdown date to December 12, 00:00. My timer says X days 7 hours. That's now clearly wrong, as midnight in winter time is an hour out from midnight in summer time.
Also, jquery_countdown_field_formatter_view() (line 226, as stated in the OP) is the wrong place for the fix, as I am seeing this problem with the countdown block.