Skip to content

Instantly share code, notes, and snippets.

@st3fan
Created September 17, 2025 01:03
Show Gist options
  • Save st3fan/3efcc928621b29a54326ac25b4d0e0dc to your computer and use it in GitHub Desktop.
Save st3fan/3efcc928621b29a54326ac25b4d0e0dc to your computer and use it in GitHub Desktop.
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