I have written this script: StackExchange sites - convert dates to local timezone .
It applies to Stack Exchange sites, e.g. : stackoverflow.com, stackexchange.com, superuser.com, etc.
The timezone that the Stack Exchange sites use is UTC i.e. +0000.
So, this script converts the dates to your local timezone, in both:
2015-12-14 14:11:13Z, and in
- date text like
Dec 14 '15 at 14:11or
Dec 14 '15 at 14:11. superuser.com
It also recalculates them whenever the page changes via
While you are on the superuser.com homepage, every 1 minute the activity indicator which will show when new posts are asked or answered.
Also, every relative timestamp, e.g.
answered 1 min agowill become
answered 2 min ago, and so on.
Well, while using the script, the latter feature, i.e. "the relative timestamps being increased every 1 min" becomes broken, and they don't get updated anymore.
The script modifies the values as follows (in my case, for timezone EEST, +0200):
- date text
Dec 14 '15 at 14:11-->
Dec 14 '15 at 16:11
If I try to add a
Z to the modified tooltips, i.e. modify the line 65 to:
dates[i].title = toTimeZone(temp, localTimezone) + 'Z';
therefore the text in the above case to become
then the page hangs (the
MutationObserver constantly sees mutations ).
The other approach I tried, was (instead of modifying all tooltips+texts on page),
to attach an event listener on each, to be activated on
onmouseover and be restored on
onmouseaway, but I found it very difficult to implement.
It uses the
jsTimezoneDetect script (for getting the local timezone),
jsTimezoneDetect does not do geo-location, nor does it care very much about historical time zones, e.g. it may get "Europe/Berlin" when the user is in fact in "Europe/Stockholm" (they are both identical in modern time).