diff options
| author | 2025-03-02 11:27:30 +0100 | |
|---|---|---|
| committer | 2025-03-02 11:27:30 +0100 | |
| commit | 4c9901fc035ece13b2dbaca21465a534abb77a04 (patch) | |
| tree | 4aad111cdd492fa908fd9a6c0ab1d27e7f8ddf06 /web/source | |
| parent | [feature] add microformat support (#3848) (diff) | |
| download | gotosocial-4c9901fc035ece13b2dbaca21465a534abb77a04.tar.xz | |
[chore] little frontend tweaks (#3852)
* [chore] little frontend tweaks
* beep boop
* poke
* clarify server time
Diffstat (limited to 'web/source')
| -rw-r--r-- | web/source/frontend/index.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index 9ea10a477..310d149ed 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -182,22 +182,22 @@ Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => { video._plyrContainer = player.elements.container; }); -document.addEventListener('DOMContentLoaded', () => { - const timeTags = document.getElementsByTagName('time'); - Array.from(timeTags).forEach(timeTag => { - const datetime = timeTag.getAttribute('datetime'); - const currentText = timeTag.textContent.trim(); - // Only format if current text contains precise time - if (currentText.match(/\d{2}:\d{2}/)) { - const date = new Date(datetime); - timeTag.textContent = date.toLocaleString(undefined, { +Array.from(document.getElementsByTagName('time')).forEach(timeTag => { + const datetime = timeTag.getAttribute('datetime'); + const currentText = timeTag.textContent.trim(); + // Only format if current text contains precise time. + if (currentText.match(/\d{2}:\d{2}/)) { + const date = new Date(datetime); + timeTag.textContent = date.toLocaleString( + undefined, + { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false - }); - } - }); + }, + ); + } }); |
