{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template core_calendar/humandate

    Print a human readable date format.

    Example context (json):
    {
        "userdate": "2021-09-01",
        "date": "Tomorrow, 23 January",
        "time": "12:00 AM",
        "timestamp": "1630512000",
        "ispast": false,
        "isnear": true,
        "nearicon": {
            "extraclasses": "me-0 pb-1",
            "attributes": [
                {"name": "src", "value": "../../../pix/i/warning.svg"},
                {"name": "alt", "value": "Warning"}
            ]
        },
        "needtitle": true,
        "link": "https://example.com/calendar/view.php"
    }
}}
{{#link}}
<a href="{{link}}" title="{{userdate}}">
{{/link}}
    <span
        class="date {{#ispast}}dimmed_text{{/ispast}} {{#isnear}}text-danger{{/isnear}}"
        data-timestamp="{{timestamp}}"
        {{#needtitle}} title="{{userdate}}" {{/needtitle}}
    >
        {{#nearicon}}
            {{>core/pix_icon}}
        {{/nearicon}}
        {{#date}}{{date}}{{#time}}, {{/time}}{{/date}}{{time}}
    </span>
{{#link}}
</a>
{{/link}}
