Created
September 17, 2025 01:03
-
-
Save st3fan/3efcc928621b29a54326ac25b4d0e0dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = (event) => { | |
const formatter = new Intl.DateTimeFormat('default', { | |
weekday: 'short', | |
year: 'numeric', | |
month: 'long', | |
day: 'numeric', | |
hour: 'numeric', | |
minute: 'numeric', | |
second: 'numeric' | |
}); | |
const elements = document.querySelectorAll("[data-timestamp]"); | |
for (let element of elements) { | |
const date = new Date(parseInt(element.dataset.timestamp, 10) * 1000); | |
element.innerHTML = formatter.format(date); | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment