mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Show local time if browser timezone is different
This commit is contained in:
@@ -183,26 +183,34 @@
|
|||||||
{{ ev.get_date_range_display }}
|
{{ ev.get_date_range_display }}
|
||||||
{% if event.settings.show_times %}
|
{% if event.settings.show_times %}
|
||||||
<br>
|
<br>
|
||||||
{% blocktrans trimmed with time=ev.date_from|date:"TIME_FORMAT" %}
|
<span data-time="{{ ev.date_from.isoformat }}" data-timezone="{{ request.event.timezone }}">
|
||||||
Begin: {{ time }}
|
{% blocktrans trimmed with time=ev.date_from|date:"TIME_FORMAT" %}
|
||||||
{% endblocktrans %}
|
Begin: {{ time }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
</span>
|
||||||
{% if event.settings.show_date_to and ev.date_to %}
|
{% if event.settings.show_date_to and ev.date_to %}
|
||||||
<br>
|
<br>
|
||||||
{% blocktrans trimmed with time=ev.date_to|date:"TIME_FORMAT" %}
|
<span data-time="{{ ev.date_to.isoformat }}" data-timezone="{{ request.event.timezone }}">
|
||||||
End: {{ time }}
|
{% blocktrans trimmed with time=ev.date_to|date:"TIME_FORMAT" %}
|
||||||
{% endblocktrans %}
|
End: {{ time }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ev.date_admission %}
|
{% if ev.date_admission %}
|
||||||
<br>
|
<br>
|
||||||
{% if ev.date_admission|date:"SHORT_DATE_FORMAT" == ev.date_from|date:"SHORT_DATE_FORMAT" %}
|
{% if ev.date_admission|date:"SHORT_DATE_FORMAT" == ev.date_from|date:"SHORT_DATE_FORMAT" %}
|
||||||
{% blocktrans trimmed with time=ev.date_admission|date:"TIME_FORMAT" %}
|
<span data-time="{{ ev.date_admission.isoformat }}" data-timezone="{{ request.event.timezone }}">
|
||||||
Admission: {{ time }}
|
{% blocktrans trimmed with time=ev.date_admission|date:"TIME_FORMAT" %}
|
||||||
{% endblocktrans %}
|
Admission: {{ time }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% blocktrans trimmed with datetime=ev.date_admission|date:"SHORT_DATETIME_FORMAT" %}
|
<span data-time="{{ ev.date_admission.isoformat }}" data-timezone="{{ request.event.timezone }}">
|
||||||
Admission: {{ datetime }}
|
{% blocktrans trimmed with datetime=ev.date_admission|date:"SHORT_DATETIME_FORMAT" %}
|
||||||
{% endblocktrans %}
|
Admission: {{ datetime }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
|
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
|
||||||
<script type="text/javascript" src="{% static "moment/moment-with-locales.js" %}"></script>
|
<script type="text/javascript" src="{% static "moment/moment-with-locales.js" %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static "moment/moment-timezone-with-data-1970-2030.js" %}"></script>
|
||||||
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
|
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
|
||||||
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.js" %}"></script>
|
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.js" %}"></script>
|
||||||
<script type="text/javascript" src="{% static "datetimepicker/bootstrap-datetimepicker.js" %}"></script>
|
<script type="text/javascript" src="{% static "datetimepicker/bootstrap-datetimepicker.js" %}"></script>
|
||||||
|
|||||||
1546
src/pretix/static/moment/moment-timezone-with-data-1970-2030.js
vendored
Normal file
1546
src/pretix/static/moment/moment-timezone-with-data-1970-2030.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -369,6 +369,30 @@ $(function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var local_tz = moment.tz.guess()
|
||||||
|
$("span[data-timezone]").each(function() {
|
||||||
|
var t = moment.tz($(this).attr("data-time"), $(this).attr("data-timezone"))
|
||||||
|
var tz = moment.tz.zone($(this).attr("data-timezone"))
|
||||||
|
|
||||||
|
$(this).tooltip({
|
||||||
|
'title': gettext("Time zone:") + " " + tz.abbr(t)
|
||||||
|
});
|
||||||
|
if (t.tz(tz.name).format() !== t.tz(local_tz).format()) {
|
||||||
|
var $add = $("<span>").addClass("text-muted")
|
||||||
|
$add.append($("<span>").addClass("fa fa-globe"))
|
||||||
|
$add.append(" " + gettext("Your local time:") + " ")
|
||||||
|
if (t.tz(tz.name).format("YYYY-MM-DD") != t.tz(local_tz).format("YYYY-MM-DD")) {
|
||||||
|
$add.append(t.tz(local_tz).format($("body").attr("data-datetimeformat")))
|
||||||
|
} else {
|
||||||
|
$add.append(t.tz(local_tz).format($("body").attr("data-timeformat")))
|
||||||
|
}
|
||||||
|
$add.insertAfter($(this));
|
||||||
|
$add.tooltip({
|
||||||
|
'title': gettext("Time zone:") + " " + moment.tz.zone(local_tz).abbr(t)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Lightbox
|
// Lightbox
|
||||||
lightbox.init();
|
lightbox.init();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user