/** * We need to intercept offsetSet, because it may be used to alter the * VALUE from DATE-TIME to DATE or vice-versa. * * @param string $name * @param mixed $value * @return void */ public function offsetSet($name, $value) { parent::offsetSet($name, $value); if (strtoupper($name) !== 'VALUE') { return; } // This will ensure that dates are correctly encoded. $this->setDateTimes($this->getDateTimes()); }