暂存-说明文档(部分)
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
<span class="badge bg-secondary font-monospace">{{ s.ip_address }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<small class="text-muted">{{ s.last_active.strftime('%Y-%m-%d %H:%M:%S') }}</small>
|
||||
<small class="text-muted local-time" data-utc="{{ s.last_active.isoformat() }}Z">{{ s.last_active.strftime('%Y-%m-%d %H:%M:%S') }}</small>
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
{% if s.session_token != current_token %}
|
||||
@@ -111,4 +111,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.querySelectorAll('.local-time').forEach(function(el) {
|
||||
const utcDate = new Date(el.getAttribute('data-utc'));
|
||||
if (!isNaN(utcDate)) {
|
||||
|
||||
const pad = (n) => n.toString().padStart(2, '0');
|
||||
const yyyy = utcDate.getFullYear();
|
||||
const MM = pad(utcDate.getMonth() + 1);
|
||||
const dd = pad(utcDate.getDate());
|
||||
const HH = pad(utcDate.getHours());
|
||||
const mm = pad(utcDate.getMinutes());
|
||||
const ss = pad(utcDate.getSeconds());
|
||||
|
||||
el.textContent = `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user