add a i18n api field for the users "now" datetime (#2007)

This commit is contained in:
Kevin Papst
2020-10-07 00:04:20 +02:00
committed by GitHub
parent bb97611349
commit c2ec15aeb3
3 changed files with 20 additions and 2 deletions

View File

@@ -81,6 +81,7 @@ final class ConfigurationController extends BaseApiController
->setDuration($this->formats->getDurationFormat($locale))
->setTime($this->formats->getTimeFormat($locale))
->setIs24hours($this->formats->isTwentyFourHours($locale))
->setNow($this->getDateTimeFactory()->createDateTime())
;
$view = new View($model, 200);

View File

@@ -88,6 +88,23 @@ final class I18nConfig
* @Serializer\Type(name="boolean")
*/
private $is24hours = true;
/**
* The current time of the user
*
* @var \DateTime
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
* @Serializer\Type(name="DateTime")
*/
private $now;
public function setNow(\DateTime $now): I18nConfig
{
$this->now = $now;
return $this;
}
public function setFormDateTime(string $formDateTime): I18nConfig
{