- WIP on locale formatting since strftime is deprecated
- Added Limit and Offset attributes in RelationBuilder
This commit is contained in:
1 parent
2f482324b2
commit
b33c67b594
4 files changed
+50
-4
No files matched your search
@@ -43,6 +43,13 @@ class Datetime extends \DateTime implements EntityObjectInterface {
|
||||
return strftime($format, $this->getTimestamp());
|
||||
}
|
||||
|
||||
public function formatLocaleIntl(int $dateFormatter = \IntlDateFormatter::LONG, int $timeFormatter = \IntlDateFormatter::NONE) : string
|
||||
{
|
||||
$formatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormatter, $timeFormatter, \Locale::getRegion());
|
||||
|
||||
return $formatter->format($this->getTimestamp());
|
||||
}
|
||||
|
||||
public function ageAt(null|\DateTime $dateTime) : int
|
||||
{
|
||||
return (int) ( (int) ($dateTime ?: new DateTime())->format('Ymd') - (int) $this->format('Ymd') ) / 10000;
|
||||
|
||||
Reference in new issue
Block a user