MDL-68200 mod_forum: Fix the invalid date format in the time tags

This commit is contained in:
Shamim Rezaie 2020-03-25 15:07:13 +11:00
parent 6e95533c73
commit b0326f0632
3 changed files with 7 additions and 7 deletions

View File

@ -638,9 +638,8 @@ class post extends exporter {
private function get_author_subheading_html(stdClass $exportedauthor, int $timecreated) : string {
$fullname = $exportedauthor->fullname;
$profileurl = $exportedauthor->urls['profile'] ?? null;
$formatteddate = userdate($timecreated, get_string('strftimedaydatetime', 'core_langconfig'));
$name = $profileurl ? "<a href=\"{$profileurl}\">{$fullname}</a>" : $fullname;
$date = "<time>{$formatteddate}</time>";
$date = userdate_htmltime($timecreated, get_string('strftimedaydatetime', 'core_langconfig'));
return get_string('bynameondate', 'mod_forum', ['name' => $name, 'date' => $date]);
}
}

View File

@ -79,9 +79,11 @@
<div class="mb-3" tabindex="-1">
{{#html.authorsubheading}}{{{.}}}{{/html.authorsubheading}}
{{^html.authorsubheading}}
<time>
{{#userdate}} {{timecreated}}, {{#str}} strftimedaydatetime, core_langconfig {{/str}} {{/userdate}}
</time>
{{< core/time_element }}
{{$elementid}}created-{{id}}-{{uniqid}}{{/elementid}}
{{$timestampval}}{{timecreated}}{{/timestampval}}
{{$userdateformatval}}{{#str}} strftimedaydatetime, core_langconfig {{/str}}{{/userdateformatval}}
{{/core/time_element}}
{{/html.authorsubheading}}
</div>
{{/isdeleted}}

View File

@ -371,9 +371,8 @@ class mod_forum_generator extends testing_module_generator {
public function get_author_subheading_html(stdClass $exportedauthor, int $timecreated) : string {
$fullname = $exportedauthor->fullname;
$profileurl = $exportedauthor->urls['profile'] ?? null;
$formatteddate = userdate($timecreated, get_string('strftimedaydatetime', 'core_langconfig'));
$name = $profileurl ? "<a href=\"{$profileurl}\">{$fullname}</a>" : $fullname;
$date = "<time>{$formatteddate}</time>";
$date = userdate_htmltime($timecreated, get_string('strftimedaydatetime', 'core_langconfig'));
return get_string('bynameondate', 'mod_forum', ['name' => $name, 'date' => $date]);
}
}