Skip to content

Instantly share code, notes, and snippets.

@junaidpv
Created August 4, 2025 16:49
Show Gist options
  • Save junaidpv/1406595a5ab01604ddec84ebb34986c1 to your computer and use it in GitHub Desktop.
Save junaidpv/1406595a5ab01604ddec84ebb34986c1 to your computer and use it in GitHub Desktop.
diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php
index 84d776c4b64..8d07427e550 100644
--- a/core/modules/views/src/Plugin/views/filter/Date.php
+++ b/core/modules/views/src/Plugin/views/filter/Date.php
@@ -45,6 +45,13 @@
$form['value'][$component]['#default_value'] = date('m/d/Y', strtotime($form['value'][$component]['#default_value']));
}
}
+
+ if (isset($form['value']['min'])) {
+ $form['value']['min']['#title'] = $this->t('From');
+ }
+ if (isset($form['value']['max'])) {
+ $form['value']['max']['#title'] = $this->t('To');
+ }
}
}
@@ -220,4 +227,20 @@
$this->query->addWhereExpression($this->options['group'], "$field $this->operator {$values['value']}");
}
+ /**
+ * {@inheritdoc}
+ */
+ public function operators() {
+ $operators = parent::operators();
+ $operators['<']['title'] = $this->t('Before');
+ $operators['<=']['title'] = $this->t('Before or On');
+ $operators['=']['title'] = $this->t('On');
+ $operators['!=']['title'] = $this->t('Not On');
+ $operators['>=']['title'] = $this->t('On or After');
+ $operators['>']['title'] = $this->t('After');
+ $operators['between']['title'] = $this->t('Between');
+ $operators['not between']['title'] = $this->t('Not Between');
+
+ return $operators;
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment