Support relative time for graphs again (#10359)

This commit is contained in:
Tony Murray
2019-06-21 07:17:43 -05:00
committed by GitHub
parent 1f19eb2146
commit 4ad20eedbb
2 changed files with 3 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ foreach ($menu_options as $option => $text) {
if ($vars['format'] == 'graph_' . $option) {
$listoptions .= '<span class="pagemenu-selected">';
}
$listoptions .= '<a href="' . generate_url($vars, array('format' => 'graph_' . $option, 'from' => '-24h', 'to' => 'now')) . '">' . $text . '</a>';
$listoptions .= '<a href="' . generate_url($vars, array('format' => 'graph_' . $option, 'from' => '-24hour', 'to' => 'now')) . '">' . $text . '</a>';
if ($vars['format'] == 'graph_' . $option) {
$listoptions .= '</span>';
}

View File

@@ -15,10 +15,10 @@ if (session('widescreen')) {
}
if (!is_numeric($vars['from'])) {
$vars['from'] = $config['time']['day'];
$vars['from'] = strtotime($vars['from']) ?: Config::get('time.day');
}
if (!is_numeric($vars['to'])) {
$vars['to'] = $config['time']['now'];
$vars['to'] = strtotime($vars['to']) ?: Config::get('time.now');
}
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', $vars['type'], $graphtype);