1441 |
ariadna |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template core_calendar/humandate
|
|
|
19 |
|
|
|
20 |
Print a human readable date format.
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"userdate": "2021-09-01",
|
|
|
25 |
"date": "Tomorrow, 23 January",
|
|
|
26 |
"time": "12:00 AM",
|
|
|
27 |
"timestamp": "1630512000",
|
|
|
28 |
"ispast": false,
|
|
|
29 |
"isnear": true,
|
|
|
30 |
"nearicon": {
|
|
|
31 |
"extraclasses": "me-0 pb-1",
|
|
|
32 |
"attributes": [
|
|
|
33 |
{"name": "src", "value": "../../../pix/i/warning.svg"},
|
|
|
34 |
{"name": "alt", "value": "Warning"}
|
|
|
35 |
]
|
|
|
36 |
},
|
|
|
37 |
"needtitle": true,
|
|
|
38 |
"link": "https://example.com/calendar/view.php"
|
|
|
39 |
}
|
|
|
40 |
}}
|
|
|
41 |
{{#link}}
|
|
|
42 |
<a href="{{link}}" title="{{userdate}}">
|
|
|
43 |
{{/link}}
|
|
|
44 |
<span
|
|
|
45 |
class="date {{#ispast}}dimmed_text{{/ispast}} {{#isnear}}text-danger{{/isnear}}"
|
|
|
46 |
data-timestamp="{{timestamp}}"
|
|
|
47 |
{{#needtitle}} title="{{userdate}}" {{/needtitle}}
|
|
|
48 |
>
|
|
|
49 |
{{#nearicon}}
|
|
|
50 |
{{>core/pix_icon}}
|
|
|
51 |
{{/nearicon}}
|
|
|
52 |
{{#date}}{{date}}{{#time}}, {{/time}}{{/date}}{{time}}
|
|
|
53 |
</span>
|
|
|
54 |
{{#link}}
|
|
|
55 |
</a>
|
|
|
56 |
{{/link}}
|