changed UTC to localtime in ssh key view

This commit is contained in:
Levi 2017-06-21 11:45:35 -05:00
parent 642acfde75
commit 9b6bb4eb26
2 changed files with 18 additions and 1 deletions

View file

@ -164,6 +164,12 @@
<!-- Gen SSH Key lib -->
<script type="text/javascript" src="{% static 'hosting/js/gen-ssh-key.js' %}"></script>
<!-- Moment -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.js"></script>
</body>
</html>

View file

@ -1,5 +1,6 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 i18n %}
{% load tz %}
{% block content %}
<div>
<div class="container virtual-machine-container dashboard-container ">
@ -32,7 +33,8 @@
{% for user_key in keys %}
<tr>
<td scope="row">{{user_key.name}}</td>
<td>{{user_key.created_at}}</td>
<td><span id="created_at">{{user_key.created_at|date:'Y-m-d H:i' }}</span></td>
<td>
<span class="h3 label label-success"><strong>Active</strong></span>
</td>
@ -92,5 +94,14 @@
</script>
{% endif %}
<script type="text/javascript">
window.onload = function () {
var locale_date = new Date(document.getElementById('created_at').textContent + ' UTC');
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
document.getElementById('created_at').innerHTML = locale_date;
};
</script>
{%endblock%}