/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Implements hook_views_query_alter * - If the db doesn't have timezone support transform exposed filter date inputs from the sites default timezone to UTC. * @TODO - can the conversion to UTC happen somewhere in the $view->handler, hook_form_alter, or date api */ function mymodule_views_query_alter(&$view, &$query) { $tz = variable_get('date_default_timezone_name', 'Pacific/Auckland'); $dates = &$query->where['date']['clauses']; foreach($dates as &$date) { '(\d{4}-\d{2}-\d{2})', $date ); } } }