protected function _get_coalesced_range(array $date_range)
{
$now = time();
$coalesce_time = $this->_blog_id_wpcom % 86400;
$current_time = $now - strtotime('today', $now);
if ($current_time < $coalesce_time && '01' == date('d', $now)) {
// Move back 1 period
return array('from' => date('Y-m-01', strtotime('-1 month', $date_range['from'])) . ' ' . date('H:i:s', $coalesce_time), 'to' => date('Y-m-01', $date_range['to']) . ' ' . date('H:i:s', $coalesce_time));
} else {
// Use current period
return array('from' => date('Y-m-01', $date_range['from']) . ' ' . date('H:i:s', $coalesce_time), 'to' => date('Y-m-01', strtotime('+1 month', $date_range['to'])) . ' ' . date('H:i:s', $coalesce_time));
}
}