Skip to content

Commit

Permalink
Fix parameter for date formatter
Browse files Browse the repository at this point in the history
Default in function parameter doesn't do anything if it's called with an
explicit null value.
  • Loading branch information
nanaya committed Dec 4, 2024
1 parent 79a1eb1 commit aeaa214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ function display_regdate($user)

$tooltipDate = i18n_date($user->user_regdate);

$formattedDate = i18n_date($user->user_regdate, null, 'year_month');
$formattedDate = i18n_date($user->user_regdate, pattern: 'year_month');

if ($user->user_regdate < Carbon\Carbon::createFromDate(2008, 1, 1)) {
return '<div title="'.$tooltipDate.'">'.osu_trans('users.show.first_members').'</div>';
Expand All @@ -1275,7 +1275,7 @@ function display_regdate($user)
]);
}

function i18n_date($datetime, $format = IntlDateFormatter::LONG, $pattern = null)
function i18n_date($datetime, int $format = IntlDateFormatter::LONG, $pattern = null)
{
$formatter = IntlDateFormatter::create(
App::getLocale(),
Expand Down
2 changes: 1 addition & 1 deletion resources/views/teams/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class="profile-info__avatar"
<div class="team-info-entry">
<div class="team-info-entry__title">{{ osu_trans('teams.show.info.created') }}</div>
<div class="team-info-entry__value">
{{ i18n_date($team->created_at, null, 'year_month') }}
{{ i18n_date($team->created_at, pattern: 'year_month') }}
</div>
</div>
@if (present($team->url))
Expand Down

0 comments on commit aeaa214

Please sign in to comment.