DeltaCMS/src/AdminPanel/Form/DateInput.php
Florian Bouillon cacdc2c3d6 Changed whole Input Objects
they now lives by themselves when before
they where highly connected to Form.php
2019-04-25 16:14:25 +02:00

28 lines
557 B
PHP

<?php
namespace AdminPanel\Form;
use DateTime;
class DateInput extends AbstractInput
{
public function getOption(string $name)
{
if ($name === "value") {
return new DateTime($this->options["name"]);
} else {
return parent::getOption($name);
}
}
public function setOption($name, $value)
{
if ($name === "value") {
$this->attributes["value"] = (new DateTime($value))->format('Y-m-d');
} else {
parent::setOption($name, $value);
}
}
}