Skip to content

Commit

Permalink
Fix date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Nov 11, 2023
1 parent 9b1cda0 commit 5784db6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ps_facetedsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,16 @@ private function getExistingFiltersOverview()
$tmp[] = (isset($supportedControllers[$c]) ? $supportedControllers[$c]['name'] : $c);
}
$filters_templates[$k]['controllers'] = implode(', ', $tmp);

// Format date for different core versions. Since 8.0, it has only two arguments.
// PHPStan ignores are added because it doesn't seem to understand the condition.
if (version_compare(_PS_VERSION_, '8.0.0', '>=')) {
/** @phpstan-ignore-next-line */
$filters_templates[$k]['date_add'] = Tools::displayDate($v['date_add'], true);
} else {
/** @phpstan-ignore-next-line */
$filters_templates[$k]['date_add'] = Tools::displayDate($v['date_add'], null, true);
}
}

return $filters_templates;
Expand Down
6 changes: 3 additions & 3 deletions views/templates/admin/manage.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
<tbody>
{foreach $filters_templates as $template}
<tr>
<td class="center">{(int)$template['id_layered_filter']}</td>
<td class="center">{$template['id_layered_filter']}</td>
<td class="text-left">{$template['name']}</td>
<td>{$template['controllers']}</td>
<td class="center">{(int)$template['n_categories']}</td>
<td>{Tools::displayDate($template['date_add'],null , true)}</td>
<td class="center">{$template['n_categories']}</td>
<td>{$template['date_add']}</td>
<td>
{if empty($limit_warning)}
<div class="btn-group-action">
Expand Down

0 comments on commit 5784db6

Please sign in to comment.