StackExchange sites - convert dates to local timezone

Converts dates to your local timezone

目前為 2015-12-16 提交的版本,檢視 最新版本

作者
darkred
評價
0 0 0
版本
2015.12.16b
建立日期
2015-12-15
更新日期
2015-12-16
尺寸
5.8 KB
授權條款
未知
腳本執行於

This script applies to StackExchange sites stackoverflow.com, stackexchange.com, superuser.com, etc. The timezone that the StackExchange sites use is UTC i.e. +0000 (source) So, this script converts the dates to your local timezone, in both:

  • tooltips 2015-12-14 14:11:13Z, and in
  • date text like Dec 14 at 14:11.

It also recalculates them whenever the page changes.


It uses the jsTimezoneDetect JavaScript script (for getting the local timezone), and the Moment.js and Moment-Timezone JavaScript libraries (for converting the dates). Also note: 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). And, if you reopen Firefox e.g. stackexchange.com, then session restore uses the timestamps for the tooltips from cache, so the script uses these cached values (refreshing the page (F5) fixes the issue).