- Merged getValue override

This commit is contained in:
Dave Mc Nicoll committed 2026-02-25 20:09:28 +00:00
1 parent b0b3aca6d9
commit fd5d31fa17
11 files changed
+183 -106

No files matched your search

+6 -2
View File
@@ -4,7 +4,7 @@ namespace Ulmus\Entity\Field;
use Ulmus\Entity\EntityObjectInterface;
class Datetime extends \DateTime implements EntityObjectInterface {
class Datetime extends \DateTime implements EntityObjectInterface, \JsonSerializable {
public string $format = "Y-m-d H:i:s";
@@ -52,7 +52,7 @@ class Datetime extends \DateTime implements EntityObjectInterface {
public function formatLocaleIntl(int $dateFormatter = \IntlDateFormatter::LONG, int $timeFormatter = \IntlDateFormatter::NONE) : string
{
$formatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormatter, $timeFormatter);
$formatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormatter, $timeFormatter, \Locale::getRegion(""));
return $formatter->format($this->getTimestamp());
}
@@ -62,4 +62,8 @@ class Datetime extends \DateTime implements EntityObjectInterface {
return (int) ( (int) ($dateTime ?: new DateTime())->format('Ymd') - (int) $this->format('Ymd') ) / 10000;
}
public function jsonSerialize(): mixed
{
return $this;
}
}