mirror of https://github.com/MISP/MISP
Filter Event Date - convert timestamp to datetime
PyMisp sends the to / from as a timestamp. MISP needs to convert a timestamp when comparing.pull/6362/head
parent
6255f631cb
commit
22cbd98aa2
|
@ -2877,9 +2877,17 @@ class Event extends AppModel
|
|||
public function set_filter_timestamp(&$params, $conditions, $options)
|
||||
{
|
||||
if ($options['filter'] == 'from') {
|
||||
$conditions['AND']['Event.date >='] = $params['from'];
|
||||
if (is_numeric($params['from'])) {
|
||||
$conditions['AND']['Event.date >='] = date('Y-m-d', $params['from']);
|
||||
} else {
|
||||
$conditions['AND']['Event.date >='] = $params['from'];
|
||||
}
|
||||
} elseif ($options['filter'] == 'to') {
|
||||
$conditions['AND']['Event.date <='] = $params['to'];
|
||||
if (is_numeric($params['to'])) {
|
||||
$conditions['AND']['Event.date <='] = date('Y-m-d', $params['to']);
|
||||
} else {
|
||||
$conditions['AND']['Event.date <='] = $params['to'];
|
||||
}
|
||||
} else {
|
||||
if (empty($options['scope'])) {
|
||||
$scope = 'Attribute';
|
||||
|
|
Loading…
Reference in New Issue