Skip to content

Commit

Permalink
Format session dates from within mustache
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Oct 31, 2023
1 parent 25db2d7 commit c4f6ce2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ function driprelease_calculate_availability(\stdClass $driprelease, int $session
$row['sessioncounter'] = $sessioncounter + 1;
$row['start'] = $start;
$row['end'] = $end;
$row['startformatted'] = userdate($start, '%a %d %b %Y %H:%M');
$row['endformatted'] = userdate($end, '%a %d %b %Y %H:%M');
return $row;
}

Expand Down
12 changes: 11 additions & 1 deletion templates/quiz.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,17 @@

{{#isheader}}
<tr>
<td colspan="6 ">{{#str}} session, tool_driprelease {{/str}} {{{calculatedavailability.sessioncounter}}}: {{calculatedavailability.startformatted}} - {{calculatedavailability.endformatted}}</td>
<td colspan="6 ">
{{#str}} session, tool_driprelease {{/str}} {{{calculatedavailability.sessioncounter}}}:
{{< core/time_element }}
{{$timestampval}}{{calculatedavailability.start}}{{/timestampval}}
{{$userdateformatval}}%a %d %b %Y %H:%M{{/userdateformatval}}
{{/core/time_element}}
-
{{< core/time_element }}
{{$timestampval}}{{calculatedavailability.end}}{{/timestampval}}
{{$userdateformatval}}%a %d %b %Y %H:%M{{/userdateformatval}}
{{/core/time_element}}
</tr>
{{/isheader}}

Expand Down

0 comments on commit c4f6ce2

Please sign in to comment.