diff options
| author | 2025-03-01 18:41:32 +0800 | |
|---|---|---|
| committer | 2025-03-01 11:41:32 +0100 | |
| commit | b4bb97225e7dd8906484b09b4f736395e779eead (patch) | |
| tree | 5dfefb3ffa286486ca60c4ae9c2abbb9178071af /web/source/frontend | |
| parent | [feature] Implement CSV import for mutes (#3696) (diff) | |
| download | gotosocial-b4bb97225e7dd8906484b09b4f736395e779eead.tar.xz | |
[feature/frontend] use localized time string in status & poll info page (#3821)
Diffstat (limited to 'web/source/frontend')
| -rw-r--r-- | web/source/frontend/index.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index b88c64680..9ea10a477 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -181,3 +181,23 @@ Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => { video._player = player; 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, { + year: 'numeric', + month: 'short', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + hour12: false + }); + } + }); +}); |
