Merge pull request #8166 from bendavies/grid-date-to-from-not-required

[Grid] to and from are not required in grid date filter
This commit is contained in:
Łukasz Chruściel 2017-06-22 20:43:23 +02:00 committed by GitHub
commit d7d00c60e9
2 changed files with 2 additions and 14 deletions

View file

@ -32,7 +32,7 @@ final class DateFilter implements FilterInterface
$field = $this->getOption($options, 'field', $name);
$from = $this->getDateTime($data['from']);
$from = isset($data['from']) ? $this->getDateTime($data['from']) : null;
if (null !== $from) {
$inclusive = (bool)$this->getOption($options, 'inclusive_from', self::DEFAULT_INCLUSIVE_FROM);
if (true === $inclusive) {
@ -42,7 +42,7 @@ final class DateFilter implements FilterInterface
}
}
$to = $this->getDateTime($data['to']);
$to = isset($data['to']) ? $this->getDateTime($data['to']) : null;
if (null !== $to) {
$inclusive = (bool)$this->getOption($options, 'inclusive_to', self::DEFAULT_INCLUSIVE_TO);
if (true === $inclusive) {

View file

@ -50,10 +50,6 @@ final class DateFilterSpec extends ObjectBehavior
'from' => [
'date' => '2016-12-05',
'time' => '08:00',
],
'to' => [
'date' => '',
'time' => '',
]
],
[]
@ -131,10 +127,6 @@ final class DateFilterSpec extends ObjectBehavior
$dataSource,
'checkoutCompletedAt',
[
'from' => [
'date' => '',
'time' => '',
],
'to' => [
'date' => '2016-12-06',
'time' => '08:00',
@ -187,10 +179,6 @@ final class DateFilterSpec extends ObjectBehavior
$dataSource,
'checkoutCompletedAt',
[
'from' => [
'date' => '',
'time' => '',
],
'to' => [
'date' => '2016-12-06',
'time' => '',