This repository has no description
421 B
15 lines
1// Show times in the visitor's zone: add ?tz= once; every link carries it on.
2(function () {
3 if (!document.body.dataset.tzaware) return;
4 var url = new URL(location.href);
5 if (url.searchParams.has("tz")) return;
6 var tz;
7 try {
8 tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
9 } catch (e) {
10 return;
11 }
12 if (!tz) return;
13 url.searchParams.set("tz", tz);
14 location.replace(url.toString());
15})();