protected function DatexViewsDateTime::opSimple in Datex 8
@inheritDoc
Overrides Date::opSimple
File
- src/
Plugin/ views/ filter/ DatexViewsDateTime.php, line 31
Class
- DatexViewsDateTime
- Filter to handle dates stored as a timestamp.
Namespace
Drupal\datex\Plugin\views\filterCode
protected function opSimple($field) {
$this->value['value'] = DatexArgHandlerTrait::translate($this->value['value']);
$cal = datex_factory();
if ($cal) {
if ($cal
->parse($this->value['value'], 'Y-m-d H:i:s')) {
$this->value['value'] = $cal
->xFormat('Y-m-d H:i:s');
}
elseif ($cal
->parse($this->value['value'], 'Y-m-d')) {
$this->value['value'] = $cal
->xFormat('Y-m-d');
}
else {
$this->value['value'] = \Drupal::time()
->getRequestTime();
}
}
parent::opSimple($field);
}