optimizations (#2904)
* calc once, then re-use * prevent invalid theme switch * allow to turn off weekly-quick-entries by permissions * remove 00:00 from date-times that likely do not need a time * fix datepicker out of window
This commit is contained in:
@@ -239,9 +239,10 @@ final class LocaleFormatter
|
||||
|
||||
/**
|
||||
* @param DateTime|string $date
|
||||
* @param bool $stripMidnight
|
||||
* @return bool|false|string
|
||||
*/
|
||||
public function dateTimeFull($date)
|
||||
public function dateTimeFull($date, bool $stripMidnight = false)
|
||||
{
|
||||
if (null === $this->dateTimeTypeFormat) {
|
||||
$this->dateTimeTypeFormat = $this->localeFormats->getDateTimeTypeFormat();
|
||||
@@ -255,13 +256,19 @@ final class LocaleFormatter
|
||||
}
|
||||
}
|
||||
|
||||
$format = $this->dateTimeTypeFormat;
|
||||
|
||||
if ($stripMidnight && $date->format('H') == '00' && $date->format('i') == '00') {
|
||||
$format = $this->localeFormats->getDateTypeFormat();
|
||||
}
|
||||
|
||||
$formatter = new IntlDateFormatter(
|
||||
$this->locale,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
date_default_timezone_get(),
|
||||
IntlDateFormatter::GREGORIAN,
|
||||
$this->dateTimeTypeFormat
|
||||
$format
|
||||
);
|
||||
|
||||
return $formatter->format($date);
|
||||
|
||||
Reference in New Issue
Block a user