Skip to content
Snippets Groups Projects
Commit f9b83519 authored by Dhariyank's avatar Dhariyank Committed by Azz-eddine BERRAMOU
Browse files

Issue #3300599 by himanshu_jhaloya, Dharti Patel: Coding Standard Issues

parent b01a5dcf
No related branches found
No related tags found
No related merge requests found
/**
* @file
* Js file to handle filter state.
*/
(function ($, Drupal) { (function ($, Drupal) {
'use strict'; 'use strict';
Drupal.behaviors.views_year_filter = { Drupal.behaviors.views_year_filter = {
......
...@@ -37,7 +37,7 @@ class ViewsSearchApiYearFilterDate extends SearchApiDate { ...@@ -37,7 +37,7 @@ class ViewsSearchApiYearFilterDate extends SearchApiDate {
'@example2' => '-2 hours -30 minutes', '@example2' => '-2 hours -30 minutes',
]), ]),
], ],
'#default_value' => isset($this->value['type']) ? $this->value['type'] : 'date', '#default_value' => $this->value['type'] ?? 'date',
]; ];
// Add js to handle year filter state. // Add js to handle year filter state.
$form['#attached']['library'][] = 'views_year_filter/year_filter'; $form['#attached']['library'][] = 'views_year_filter/year_filter';
...@@ -54,7 +54,15 @@ class ViewsSearchApiYearFilterDate extends SearchApiDate { ...@@ -54,7 +54,15 @@ class ViewsSearchApiYearFilterDate extends SearchApiDate {
$startDate = intval($this->value['value']) . '-01-01 00:00:01'; $startDate = intval($this->value['value']) . '-01-01 00:00:01';
$endDate = intval($this->value['value']) . '-12-31 23:59:59'; $endDate = intval($this->value['value']) . '-12-31 23:59:59';
$this->getQuery()->addCondition($this->realField, [strtotime($startDate), strtotime($endDate)], 'BETWEEN', $this->options['group']); $this->getQuery()->addCondition(
$this->realField,
[
strtotime($startDate),
strtotime($endDate),
],
'BETWEEN',
$this->options['group']
);
} }
else { else {
parent::opSimple($field); parent::opSimple($field);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment