Fix code style in src/Util/Temporal

This commit is contained in:
Hypolite Petovan 2025-01-26 17:47:23 -05:00
parent f3202b0508
commit 8f0a31dc1e

View file

@ -147,7 +147,8 @@ class Temporal
} }
$tpl = Renderer::getMarkupTemplate("field_input.tpl"); $tpl = Renderer::getMarkupTemplate("field_input.tpl");
$o = Renderer::replaceMacros($tpl, $o = Renderer::replaceMacros(
$tpl,
[ [
'$field' => [ '$field' => [
'dob', 'dob',
@ -157,7 +158,8 @@ class Temporal
'', '',
'placeholder="' . DI::l10n()->t('YYYY-MM-DD or MM-DD') . '"' 'placeholder="' . DI::l10n()->t('YYYY-MM-DD or MM-DD') . '"'
] ]
]); ]
);
return $o; return $o;
} }
@ -223,17 +225,19 @@ class Temporal
bool $picktime = true, bool $picktime = true,
string $minfrom = '', string $minfrom = '',
string $maxfrom = '', string $maxfrom = '',
bool $required = false): string bool $required = false
{ ): string {
// First day of the week (0 = Sunday) // First day of the week (0 = Sunday)
$firstDay = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week') ?: 0; $firstDay = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week') ?: 0;
$lang = DI::l10n()->toISO6391(DI::l10n()->getCurrentLang()); $lang = DI::l10n()->toISO6391(DI::l10n()->getCurrentLang());
// Check if the detected language is supported by the picker // Check if the detected language is supported by the picker
if (!in_array($lang, if (!in_array(
$lang,
['ar', 'ro', 'id', 'bg', 'fa', 'ru', 'uk', 'en', 'el', 'de', 'nl', 'tr', 'fr', 'es', 'th', 'pl', 'pt', 'ch', 'se', 'kr', ['ar', 'ro', 'id', 'bg', 'fa', 'ru', 'uk', 'en', 'el', 'de', 'nl', 'tr', 'fr', 'es', 'th', 'pl', 'pt', 'ch', 'se', 'kr',
'it', 'da', 'no', 'ja', 'vi', 'sl', 'cs', 'hu'])) { 'it', 'da', 'no', 'ja', 'vi', 'sl', 'cs', 'hu']
)) {
$lang = 'en'; $lang = 'en';
} }
@ -351,8 +355,7 @@ class Temporal
// translators - e.g. 22 hours ago, 1 minute ago // translators - e.g. 22 hours ago, 1 minute ago
if($isfuture) { if($isfuture) {
$format = DI::l10n()->t('in %1$d %2$s'); $format = DI::l10n()->t('in %1$d %2$s');
} } else {
else {
$format = DI::l10n()->t('%1$d %2$s ago'); $format = DI::l10n()->t('%1$d %2$s ago');
} }