File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change 6868function formatTimestamp() {
6969 document.querySelectorAll("time.localized").forEach(el => {
7070 const d = new Date(el.getAttribute("datetime"));
71- const pad = n => String(Math.abs(n)).padStart(2, '0');
72- const year = d.getFullYear();
73- const month = pad(d.getMonth() + 1);
74- const day = pad(d.getDate());
75- const hour = pad(d.getHours());
76- const minute = pad(d.getMinutes());
77- const tzOffset = -d.getTimezoneOffset();
78- const sign = tzOffset >= 0 ? "+" : "-";
79- const absOffset = Math.abs(tzOffset);
80- const tzHour = pad(Math.floor(absOffset / 60));
81- const tzMin = pad(absOffset % 60);
82- const tzStr = `${sign}${tzHour}:${tzMin}`;
83- el.textContent = `${year}-${month}-${day} ${hour}:${minute} UTC${tzStr}`;
71+ el.textContent = d.toLocaleString("SE", { "timeZoneName": "short" });
8472 });
8573}
8674if (document.readyState !== "loading") {
You can’t perform that action at this time.
0 commit comments