summaryrefslogtreecommitdiff
path: root/web/source
diff options
context:
space:
mode:
authorLibravatar CDN <git@cdn0x12.dev>2025-03-01 18:41:32 +0800
committerLibravatar GitHub <noreply@github.com>2025-03-01 11:41:32 +0100
commitb4bb97225e7dd8906484b09b4f736395e779eead (patch)
tree5dfefb3ffa286486ca60c4ae9c2abbb9178071af /web/source
parent[feature] Implement CSV import for mutes (#3696) (diff)
downloadgotosocial-b4bb97225e7dd8906484b09b4f736395e779eead.tar.xz
[feature/frontend] use localized time string in status & poll info page (#3821)
Diffstat (limited to 'web/source')
-rw-r--r--web/source/frontend/index.js20
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
+ });
+ }
+ });
+});