The poll opening / closing dates are stored in the database as stings in UTC time, but the conversion to timestamps in advpoll_get_data uses strtotime without the timezone. This results in incorrect opening / closing date calculation.
I fixed this by appending " UTC" to the time values used:
if ($node->advpoll_dates) {
(isset($node->advpoll_dates[$lang])) ? $data['start_date'] = strtotime($node->advpoll_dates[$lang][0]['value'] . ' UTC') : $data['start_date'] = strtotime($node->advpoll_dates['und'][0]['value'] . ' UTC');
(isset($node->advpoll_dates[$lang])) ? $data['end_date'] = strtotime($node->advpoll_dates[$lang][0]['value2'] . ' UTC') : $data['end_date'] = strtotime($node->advpoll_dates['und'][0]['value2'] . ' UTC');
} else {
$data['start_date'] = 0;
$data['end_date'] = 0;
}
This is a hack, it should use the time zone data as stored in the field. I'll get around to writing it up properly one day and submitting a patch, unless someone wants to beat me to it :)
Comments
Comment #1
tripper54 commentedPatch attached. Might not be the best approach, but it works for me.
Comment #2
Leeteq commentedComment #3
tripper54 commentedPatch fails to apply on the latest dev, needs reroll.
Should probably use LANGUAGE_NONE instead of 'und'.
Comment #4
tripper54 commentedReroll. This is a bit cleaner.
Comment #5
tripper54 commentedCommitted.