6205ad Improve human-readable date/time display in web UI

Authored and Committed by Adam Williamson 6 years ago
    Improve human-readable date/time display in web UI
    
    There are many places in the web UI where we take a date/time
    (sourced either from a datetime or a timestamp) and turn it
    into some kind of human-readable form. There are mouseovers
    for the date/time a commit, PR or issue was created, the time
    it was last modified, and the date/time on each comment in an
    issue or PR, for instance. There were three problems with this.
    
    First, these weren't all consistent. Some used the format string
    '%b %d %Y %H:%M:%S', which gives something like "Mar 06 2018
    23:44:27", while others used '%Y-%m-%d %H:%M:%S', which gives
    something like "2018-03-06 23:44:27". There's no reason these
    shouldn't be consistent, AFAICS.
    
    Second, neither of the existing forms indicates the timezone of
    the date/time, which is UTC. This isn't obvious for users: they
    may well assume the date/time given is in their local timezone.
    Ideally I'd actually like to *do* that, but doing it is hard; we
    can at least explicitly give the timezone in the string.
    
    Finally, we were constantly duplicating the format strings all
    over the templates, where it would make much more sense to just
    have a single filter function and use it every time we want to
    do this. This enforces consistency, and means that if we do want
    to change the format in future, we can change it in one place,
    not dozens of them.
    
    This was prompted by #3041 but doesn't entirely fix it.
    
    Signed-off-by: Adam Williamson <awilliam@redhat.com></awilliam@redhat.com>
    
        
file modified
+1 -1
file modified
+3 -3
file modified
+3 -3
file modified
+13 -8