I have found out a bit more. If I want to use XLite\View\FormField\Input\Text\Date and I use the date as the data type, then
the following code for setter works.
Code:
/**
* Birth Date
* @var string
*
* @Column (type="date")
*/
protected $birthdate = '';
public function setBirthdate($value)
{
$formats = \XLite\Core\Converter::getDateFormatsByStrftimeFormat();
$format = $formats[phpFormat];
$value = date_create_from_format($format, $value);
$this->birthdate=$value;
return $this;
}
However, for the getter, I have a problem. If I write
Code:
public function getBirthdate()
{
$formats = \XLite\Core\Converter::getDateFormatsByStrftimeFormat();
$format = $formats[phpFormat];
return $this->birthdate->format($format);
}
then it works for the 5 formats out of 8 possible, that is it doesn't work
for the formats 09-18-2019, 18.09.2019, 18-09-2019.
Any idea on how to solve this?