protected function opBetween($field) { $timezone =
$this->
getTimezone();
$origin_offset =
$this->
getOffset($this->value
['min'
],
$timezone);
// Although both 'min' and 'max' values are required, default empty 'min'
// value as UNIX timestamp 0.
$min =
(!
empty($this->value
['min'
])) ?
$this->value
['min'
] : '@0';
// Convert to ISO format and format for query. UTC timezone is used since
// dates are stored in UTC.
$a =
new DateTimePlus($min,
new \
DateTimeZone($timezone));
$a =
$this->query->
getDateFormat($this->query->
getDateField("'" .
$this->dateFormatter->
format($a->
getTimestamp() +
$origin_offset, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, DateTimeItemInterface::STORAGE_TIMEZONE
) . "'", TRUE,
$this->calculateOffset
),
$this->dateFormat, TRUE
);
$b =
new DateTimePlus($this->value
['max'
],
new \
DateTimeZone($timezone));
$b =
$this->query->
getDateFormat($this->query->
getDateField("'" .
$this->dateFormatter->
format($b->
getTimestamp() +
$origin_offset, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, DateTimeItemInterface::STORAGE_TIMEZONE
) . "'", TRUE,
$this->calculateOffset
),
$this->dateFormat, TRUE
);
// This is safe because we are manually scrubbing the values.
$operator =
strtoupper($this->operator
);
$field =
$this->query->
getDateFormat($this->query->
getDateField($field, TRUE,
$this->calculateOffset
),
$this->dateFormat, TRUE
);
$this->query->
addWhereExpression($this->options
['group'
], "
$field $operator $a AND
$b"
);
} /**
* Override parent method, which deals with dates as integers.
*/