Timer JS fixes (#1054)

Add months to duration output
Update momentjs
Move EVE time generation function to shared source

Fixes timerboard showing EVE time as local time.
Changed to show 24 hour time.
This commit is contained in:
Basraah 2018-05-10 10:31:02 +10:00 committed by Adarnof
parent 86f57ccd56
commit 6187fb9b86
4 changed files with 16 additions and 6 deletions

View File

@ -19,7 +19,8 @@
<div class="col-lg-12 text-center row">
<div class="label label-info text-left">
<b>{% trans "Current Eve Time:" %} </b>
</div><div class="label label-info text-left" id="current-time"></div>
</div>
<strong class="label label-info text-left" id="current-time"></strong>
<br />
</div>
@ -111,7 +112,7 @@
}
function updateClock() {
document.getElementById("current-time").innerHTML = "<b>" + moment.utc().format('LLLL') + "</b>";
document.getElementById("current-time").innerHTML = getCurrentEveTimeString();
}
</script>
{% endblock content %}

View File

@ -8,8 +8,16 @@ function getDurationString(duration) {
if (duration.years()) {
out += duration.years() + 'y ';
}
if (duration.months()) {
out += duration.months() + 'm ';
}
if (duration.days()) {
out += duration.days() + 'd ';
}
return out + duration.hours() + "h " + duration.minutes() + "m " + duration.seconds() + "s";
}
function getCurrentEveTimeString() {
return moment().utc().format('dddd LL HH:mm:ss')
}

View File

@ -1,4 +1,4 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
{% if locale and LANGUAGE_CODE != 'en' %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/{{ LANGUAGE_CODE }}.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/locale/{{ LANGUAGE_CODE }}.js"></script>
{% endif %}

View File

@ -18,7 +18,8 @@
<div class="col-lg-12 text-center">
<div class="label label-info text-left">
<b>{% trans "Current Eve Time:" %} </b>
</div><div class="label label-info text-left" id="current-time"></div>
</div>
<strong class="label label-info text-left" id="current-time"></strong>
</div>
{% if corp_timers %}
<h4><b>{% trans "Corp Timers" %}</b></h4>
@ -555,7 +556,7 @@
}
function updateClock() {
document.getElementById("current-time").innerHTML = "<b>" + moment().format('LLLL') + "</b>";
document.getElementById("current-time").innerHTML = getCurrentEveTimeString();
}
</script>
{% endblock content %}