"Clever" date formatting accessibility

10 November 2005   14 comments   Zope, Python


Powered by Fusion×

Last night I wrote a little function that tries to show dates cleverly by comparing the date with todays date, it formats the date differently.

If the date is today is just says "Today 10:00" and for yesterday it says "Yesterday 10:00". If it's within a week it shows is like this "Thursday 10:00". If the date is older than about 30 days it skips the time part and just shows "13-May 2005" and if anything else (ie. > 7 and < 30 days) it shows the whole thing like this "13-Oct 2005 10:00".

What do you think about this? ...from a usability/accessability point of view. One counter argument I have against this is that if you print off a page where it says "Today 12:22" and leave that printed paper for a few days, what "Today" means will change.

To demonstrate it, I've put together a little demo page so that you can get a feel for how it works. Please let me know what you think.


Ned Batchelder
This reminds me of Outlook's date categorization, which I had to reverse engineer once. It puts dates into these buckets:

Last Month
Earlier This Month
Three Weeks Ago
Two Weeks Ago
Last Week
This Week
Next Week
Two Weeks Away
Three Weeks Away
Later This Month
Next Month
Beyond Next Month

You seem to know what you're talking about when it comes to MS Outlook!! Can you help me with a little problem i am having with mine at the moment.

When i start it up i arrange my meassages by date using groups, but Outlook has decide of its own accord that it wants to put all my messages into the "Beyond Next Month" and "Older" buckets. It used to put them into "Today", "Yesterday" etc. Do you know how i can get things back to being this way?

Thanks your help would be much apprecited I'm going mad trying to fix this one.

Peter Bengtsson
Sorry, no idea. I don't use Outlook, I've just seen other people using it.
Check your computer's time/date setting. Most likely you or someone has accidentally set their computer date to sometime in the future.

Anyways, your problem was 5 month ago so just posting this for anyone else who stumbles on it.

And I did so stumble. THANKS!
Also stumbled. Thanks!
Thank you so much!!!!
I rememeber seeing somewhere (maybe in a hCalendar implementation? [1]) the use of the `abbr` tag for these "clever" dates. So you'd have: <abbr title="2005-11-12">Today</abbr> 10:15

You then could use CCS to make the title attr appear in the printed version (with the `content` property [2]).

Apart from this CSS wizardry, the printing issue could be easily solved by putting today's complete date somewhere on the page. I can't think of a simplest solution :)

[1] http://microformats.org/wiki/hcalendar
[2] http://www.alistapart.com/stories/goingtoprint
Peter Bengtsson
That's really good! Didn't think of that. Will give it a try.
Tom Smith
If, at "23-03-06 00:005" you enter "22-03-06 23:55"... is it yesterday or 10 mins ago?

On Sunday, is Saturday last week or yesterday?

Is something done last year require a time at all? Should it even be shown, or do most people "exist" in the last few weeks alone? For example, should "clever" formatting look like this...

This afternoon (Thurs)
Item one (04:55)
Item two (02:32)
Item three (01:14)
This morning (Thurs)
Item four (09:45)
Yesterday (Wed)
Item five
Item six
Tues 6th March
Item seven
Item eight
Lots of items
Previous month (Feb)
134 items.. who cares... life goes on... etc.
Tom Smith
i.e the "cleverness" assumes that items share some components of a human-oriented date and you don't have to show that data most of the time...
i can understand where the "Beyond next month" bucket would be used -- most probably appointment, i think i found a bug, the string is used to display my mail messages as well :)
here's the screenshot -
Can you tell how to solve the problem?
this is exactly what I've been looking for! but where's the code, man?

Your email will never ever be published

Related posts

Active Reactor watches 08 November 2005
MyMcDiet.com Kevin O'Connor's fast food diet 12 November 2005
Related by keywords:
Date formatting in python or in PostgreSQL 20 July 2004