changd date format on orders view

This commit is contained in:
Levi 2017-06-21 13:24:38 -05:00
parent f1f6074c78
commit 339e20d0b7
3 changed files with 15 additions and 4 deletions

View file

@ -35,7 +35,7 @@
<div class="col-xs-6 text-right">
<address>
<strong>{% trans "Billed To:"%}</strong><br>
{{order.created_at}}<br><br>
<span id="order-created_at">{{order.created_at}}</span><br><br>
<strong>{% trans "Status:"%}</strong><br>
<strong class="{% if order.status == 'Approved' %}text-success
{%else%} text-danger
@ -81,4 +81,17 @@
</div>
{% endif %}
</div>
<script type="text/javascript">
window.onload = function () {
var locale_date = new Date(document.getElementById("order-created_at").textContent + ' UTC');
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
document.getElementById('order-created_at').innerHTML = locale_date;
};
</script>
{%endblock%}

View file

@ -24,7 +24,7 @@
{% for order in orders %}
<tr>
<td scope="row">{{ order.id }}</td>
<td>{{ order.created_at }}</td>
<td>{{ order.created_at | date:"M d, Y" }}</td>
<td>{{ order.price }} CHF</td>
<td>{% if order.approved %}
<span class="text-success strong">{% trans "Approved"%}</span>

View file

@ -95,11 +95,9 @@
<script type="text/javascript">
console.log("sadas");
window.onload = function () {
{% for user_key in keys %}
console.log("{{user_key.id}}");
var locale_date = new Date(document.getElementById("ssh-created_at-{{user_key.id}}").textContent + ' UTC');
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
console.log(locale_date);