Skip to:

Standardise 'time ago' displays

  • localiseorg


    The way ‘time ago’ information is output and displayed is beginning to annoy me:

    • It’s too verbose from end user perspective – Do I really need to know it happened 2 hours, 5 minutes ago?
    • HTML markup is inconsistent/crufty from CSS styling perspective
    • It’s a PITA to work with from microformats/js/etc perspective

    Examples of HTML inconsistency…

    Activity feed:

    <span class="time-since">2 hours, 5 minutes ago</span>

    Members widget:

    <span class="activity">registered 5 days, 14 hours ago</span>

    So, I have a suggestion which deals with all these issues and adds extra awesomeness. 🙂

    Go look here:

    The HTML output for any ‘time ago’ display would be made consistent:

    <time class="ago" datetime="2008-07-17T09:24:17Z">%fallback_text%</time>

    CSS will look nice: time.ago { whatever }

    jQuery will look nice: $(‘time.ago’).whatever();

    %fallback_text% would be there in case js is disabled in browser, ensuring the user would still see something meaningful. You could have this as just the actual time/date and thus ditch all the server-side processing that’s currently used to determine the ‘time ago’.

    IMHO this approach should be applied to anything that displays ‘time ago’ text in WP – consistent, concise, easy to style, less code server-side.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Standardise 'time ago' displays’ is closed to new replies.
Skip to toolbar