N°7145 - UI - Init Value DateTime and Date with Day Time (support raw date values)

This commit is contained in:
Eric Espie
2025-01-09 11:22:28 +01:00
parent 886db5d6ad
commit bf6277fcd2

View File

@@ -6432,7 +6432,11 @@ class AttributeDateTime extends AttributeDBField
{
$sDefaultValue = $this->Get('default_value');
if (utils::IsNotNullOrEmptyString($sDefaultValue)) {
$oDate = new DateTimeImmutable(Expression::FromOQL($sDefaultValue)->Evaluate([]));
try {
$oDate = new DateTimeImmutable($sDefaultValue);
} catch (Exception $e) {
$oDate = new DateTimeImmutable(Expression::FromOQL($sDefaultValue)->Evaluate([]));
}
return $oDate->format($this->GetInternalFormat());
}
return $this->GetNullValue();