darkred / ftp.mozilla.org - convert dates to relative format or just in local timezone

Published:

Version: 1.1 updated

License: MIT License (Expat)

This script applies to http://ftp.mozilla.org*
It converts dates to either:

  • relative format (taking into account the local timezone), or
  • just in local timezone.

e.g. (using as local timezone Europe/Helsinki that is UTC+0300) instead of showing:
13-Oct-2015 16:24 (UTC) it converts it to either:
3 hours ago, or:
13-Oct-2015 19:24 (+0300)

It uses jQuery, the jsTimezoneDetect JavaScript script (for getting the local timezone),
and the Moment.js and Moment-Timezone JavaScript libraries (for converting the dates).

_Note 1: you may uncomment this line (#34) and comment out line 33, in order the dates to just be displayed using local timezone
Note 2: if you want to use it in conjunction with my other script ftp.mozilla.org - add sorting back then you must follow Note 2 for that one to work, too.
Note 3: 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).

Hosted in GitHub

Rating: 0