mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature/frontend] use localized time string in status & poll info page (#3821)
This commit is contained in:
@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user