Clean things up a bit
This commit is contained in:
@@ -82,7 +82,6 @@
|
||||
{{ user.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -180,9 +179,7 @@
|
||||
<script>
|
||||
|
||||
function localDatetimeValue(date) {
|
||||
|
||||
const pad = (v) => String(v).padStart(2, "0");
|
||||
|
||||
return (
|
||||
date.getFullYear() + "-" +
|
||||
pad(date.getMonth() + 1) + "-" +
|
||||
@@ -193,43 +190,21 @@ function localDatetimeValue(date) {
|
||||
}
|
||||
|
||||
function setCurrentTimestamp() {
|
||||
|
||||
document.getElementById("client_timestamp").value =
|
||||
new Date().toISOString();
|
||||
document.getElementById("client_timestamp").value = new Date().toISOString();
|
||||
}
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
|
||||
//
|
||||
// Populate default report range
|
||||
//
|
||||
|
||||
const now = new Date();
|
||||
|
||||
const weekAgo = new Date();
|
||||
|
||||
weekAgo.setDate(now.getDate() - 7);
|
||||
|
||||
document.getElementById("begin_date").value =
|
||||
localDatetimeValue(weekAgo);
|
||||
|
||||
document.getElementById("end_date").value =
|
||||
localDatetimeValue(now);
|
||||
|
||||
//
|
||||
// Convert displayed timestamps to local timezone
|
||||
//
|
||||
|
||||
document.getElementById("begin_date").value = localDatetimeValue(weekAgo);
|
||||
document.getElementById("end_date").value = localDatetimeValue(now);
|
||||
document.querySelectorAll(".tztime").forEach((el) => {
|
||||
|
||||
const ts = el.dataset.ts;
|
||||
|
||||
const d = new Date(ts);
|
||||
|
||||
el.textContent = d.toLocaleString();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user