use snek's formatDate everywhere

pull/2/head
Aevann1 2022-11-23 00:36:33 +02:00
parent 755cfbf335
commit 9c3f520aa7
3 changed files with 11 additions and 6 deletions

View File

@ -1,8 +1,11 @@
function pinned_timestamp(id) {
const el = document.getElementById(id)
const time = new Date(parseInt(el.dataset.timestamp)*1000)
const pintooltip = el.getAttribute("data-bs-original-title")
if (!pintooltip.includes('until')) el.setAttribute("data-bs-original-title", `${pintooltip} until ${time}`)
if (!pintooltip.includes('until'))
{
const time = formatDate(new Date(parseInt(el.dataset.timestamp)*1000))
el.setAttribute("data-bs-original-title", `${pintooltip} until ${time}`)
}
}
/** @type {HTMLImageElement} */

View File

@ -57,7 +57,7 @@ else
}
function badge_timestamp(t) {
const date = new Date(t.dataset.until*1000);
const date = formatDate(new Date(t.dataset.until*1000));
const text = t.getAttribute("data-bs-original-title")
t.setAttribute("data-bs-original-title", `${text} ${date.toString()}`);
t.removeAttribute("onmouseover")

View File

@ -262,9 +262,11 @@
{% if v.flairchanged %}
<script>
const date = new Date({{v.flairchanged}}*1000).toString();
const text = ` - Your flair has been locked until ${date}`
document.getElementById('customtitlebody').value += text;
document.addEventListener('DOMContentLoaded', function() {
const date = formatDate(new Date({{v.flairchanged}}*1000));
const text = ` - Your flair has been locked until ${date}`;
document.getElementById('flair-body').value += text;
});
</script>
{% endif %}