Tampermonkey script to convert SourceHut Todo formats from relative ("3 years ago") to absolute ("July 30, 2018")
#1 - Convert the main todo.sr.ht page.
5b354e1a9447 — QuintillusCFC 2 months ago
Add support for the top-level sr.ht (projects) page.  Update the readme.
b682e4573409 — QuintillusCFC 2 months ago
Update comments.  Create a test bookmark to see if that's working on hg.sr.ht

heads

tip
browse log

clone

read-only
https://hg.sr.ht/~adj/SourceHutDateFormat
read/write
ssh://hg@hg.sr.ht/~adj/SourceHutDateFormat

This is a Tampermonkey script that converts SourceHut dates from relative terms (e.g. "3 years ago") to absolute terms (e.g. "July 30, 2018"). For me, the absolute terms tend to be much more useful when correlating issues with external systems such as files, e-mails, etc.

This script currently works with the following SourceHut services:

  • todo.sr.ht - all areas except the main https://todo.sr.ht page
  • hg.sr.ht - all areas
  • git.sr.ht - all areas
  • sr.ht - all areas

If you spot an area on one of these sites where it isn't working, file a ticket at this tracker: https://todo.sr.ht/~adj/SourceHutDateFormat . New fields may be added that need configurating, or the HTML and CSS may change and break an area.

There are a few configurable settings in the script:

  • maxDaysForRelative. Defaults to 1. How many days should use the relative format. I do find it useful to see, e.g. "2 hours ago", which makes things stand out as very recent. If you prefer a slightly longer relative window, you can adjust this.
  • locale. Defaults to "en-US", hope to figure out how to default it to your system default someday. Will affect the date format.
  • dateFormatOptions. I prefer the long month format; you might prefer the short month format. Adjust it here.

To use:

  • Install Tampermonkey
  • Create a new script
  • Paste the contents of script.js into that file
  • Reload any SourceHut Todo pages you are viewing

Future updates:

  • Upload to Tampermonkey shared site for discoverability. Didn't find any SourceHut scripts there yet.
  • Make sure it works with Greasemonkey/Firefox as well as Tampermonkey/Vivaldi.
  • Expand coverage to more SourceHut sites. meta.sr.ht and sr.ht are the likely candidates as those are the others ones I'm using