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

This commit is contained in:
Shamim Rezaie
2020-05-12 15:07:23 +10:00
parent c59656006b
commit a8b4b9f407
3 changed files with 7 additions and 7 deletions
+1 -2
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]);
}
}
@@ -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}}
+1 -2
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]);
}
}