locale time automatically for datefields with class=timestamp
This commit is contained in:
1 parent
8ebba2d3f1
commit
3116e34474
4 files changed
+23
-4
No files matched your search
@@ -16,6 +16,25 @@
|
|||||||
<script>
|
<script>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
|
var timestamps = document.getElementsByClassName('timestamp');
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
year : 'numeric', month : '2-digit',
|
||||||
|
day : '2-digit', hour : '2-digit',
|
||||||
|
minute : '2-digit', second : '2-digit',
|
||||||
|
hour12 : false,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var i = 0; i < timestamps.length; i++) {
|
||||||
|
var time = timestamps[i].innerHTML + "+00:00"
|
||||||
|
timestamps[i].innerHTML = new Date(time).toLocaleString(undefined, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, false);
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
{% for event in events %}
|
{% for event in events %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{event.creation|date:'Y-m-d H:i:s'}}</td>
|
<td class="timestamp">{{event.creation|date:'Y-m-d H:i:s'}}</td>
|
||||||
<td>{{event.author}}</td>
|
<td>{{event.author}}</td>
|
||||||
<td><a href="/test/{{event.test.id}}">{{event.test.dev.name|prettyName}}</a></td>
|
<td><a href="/test/{{event.test.id}}">{{event.test.dev.name|prettyName}}</a></td>
|
||||||
<td>{{event.test.timecontrol}}</td>
|
<td>{{event.test.timecontrol}}</td>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<td class="numeric">{{machine.id}}</td>
|
<td class="numeric">{{machine.id}}</td>
|
||||||
<td>{{machine.user.username}}</td>
|
<td>{{machine.user.username}}</td>
|
||||||
<td>{{machine.osname|truncatewords:1|slice:":-2"}}</td>
|
<td>{{machine.osname|truncatewords:1|slice:":-2"}}</td>
|
||||||
<td>{{machine.updated|date:'Y-m-d H:i'}}</td>
|
<td class="timestamp">{{machine.updated|date:'Y-m-d H:i'}}</td>
|
||||||
<td> <a href="/test/{{machine.workload.id}}">{{machine.workload.dev.name|prettyName}}</a></td>
|
<td> <a href="/test/{{machine.workload.id}}">{{machine.workload.dev.name|prettyName}}</a></td>
|
||||||
<td class="numeric">{{machine.threads}}</td>
|
<td class="numeric">{{machine.threads}}</td>
|
||||||
<td class="numeric">{{machine.mnps|twoDigitPrecision}}</td>
|
<td class="numeric">{{machine.mnps|twoDigitPrecision}}</td>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div id="configuration">
|
<div id="configuration">
|
||||||
<table class="datatable left-align">
|
<table class="datatable left-align">
|
||||||
<tr><th>Author</th><td>{{test.author}}</td></tr>
|
<tr><th>Author</th><td>{{test.author}}</td></tr>
|
||||||
<tr><th>Creation</th><td>{{test.creation|date:'Y-m-d H:i:s'}}</td></tr>
|
<tr><th>Creation</th><td class="timestamp">{{test.creation|date:'Y-m-d H:i:s'}}</td></tr>
|
||||||
<tr><th>Engine</th><td>{{test.engine}}</td></tr>
|
<tr><th>Engine</th><td>{{test.engine}}</td></tr>
|
||||||
<tr><th>Dev Branch</th><td>{{test.dev.name|prettyName}}</td></tr>
|
<tr><th>Dev Branch</th><td>{{test.dev.name|prettyName}}</td></tr>
|
||||||
<tr><th>Dev Bench</th><td>{{test.dev.bench}}</td></tr>
|
<tr><th>Dev Bench</th><td>{{test.dev.bench}}</td></tr>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<td>{{result.machine.id}}</td>
|
<td>{{result.machine.id}}</td>
|
||||||
<td>{{result.machine.user.username|slice:"6"}}</td>
|
<td>{{result.machine.user.username|slice:"6"}}</td>
|
||||||
<td>{{result.machine.osname|truncatewords:1|slice:":-2"}}</td>
|
<td>{{result.machine.osname|truncatewords:1|slice:":-2"}}</td>
|
||||||
<td>{{result.updated|date:'Y-m-d H:i'}}</td>
|
<td class="timestamp">{{result.updated|date:'Y-m-d H:i'}}</td>
|
||||||
<td class="numeric">{{result.games}}</td>
|
<td class="numeric">{{result.games}}</td>
|
||||||
<td class="numeric">{{result.wins}}</td>
|
<td class="numeric">{{result.wins}}</td>
|
||||||
<td class="numeric">{{result.losses}}</td>
|
<td class="numeric">{{result.losses}}</td>
|
||||||
|
|||||||
Reference in new issue
Block a user