_setClassName('Cake\I18n\FrozenDate', 'DateTimeImmutable'); return $this; } /** * Change the preferred class name to the mutable Date implementation. * * @return $this */ public function useMutable() { $this->_setClassName('Cake\I18n\Date', 'DateTime'); return $this; } /** * Convert request data into a datetime object. * * @param mixed $value Request data * @return \DateTimeInterface */ public function marshal($value) { $date = parent::marshal($value); if ($date instanceof DateTime || $date instanceof DateTimeImmutable) { $date = $date->setTime(0, 0, 0); } return $date; } /** * {@inheritDoc} */ protected function _parseValue($value) { /** @var \Cake\I18n\Time $class */ $class = $this->_className; return $class::parseDate($value, $this->_localeFormat); } }