move date-fmt to the bitty script
This commit is contained in:
@@ -28,5 +28,4 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</bitty-6-0>
|
</bitty-6-0>
|
||||||
<script src="{{ "/static/js/ui.js" | cachebust }}"></script>
|
<script src="{{ "/static/js/ui.js" | cachebust }}"></script>
|
||||||
<script src="{{ "/static/js/date-fmt.js" | cachebust }}"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -246,4 +246,12 @@ export default class {
|
|||||||
el.scrollIntoView();
|
el.scrollIntoView();
|
||||||
el.focus();
|
el.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertTimestamps(ev, el) {
|
||||||
|
const timestamp = el.getInt('utc');
|
||||||
|
if (!isNaN(timestamp)) {
|
||||||
|
const date = new Date(timestamp * 1000);
|
||||||
|
el.textContent = date.toLocaleString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
const timestampSpans = document.getElementsByClassName("timestamp");
|
|
||||||
for (let timestampSpan of timestampSpans) {
|
|
||||||
const timestamp = parseInt(timestampSpan.dataset.utc);
|
|
||||||
if (!isNaN(timestamp)) {
|
|
||||||
const date = new Date(timestamp * 1000);
|
|
||||||
timestampSpan.textContent = date.toLocaleString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user