Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

"Clever" date formatting accessibility

http://www.peterbe.com/plog/clever-date-formatting/test.html

todays date, clever, date formatting, todays, date format

10th of November 2005

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.



Comment

Ned Batchelder - 11th November 2005  [«« Reply to this]
This reminds me of Outlook's date categorization, which I had to reverse engineer once. It puts dates into these buckets:

Unknown
Older
Last Month
Earlier This Month
Three Weeks Ago
Two Weeks Ago
Last Week
Yesterday
Today
This Week
Tomorrow
Next Week
Two Weeks Away
Three Weeks Away
Later This Month
Next Month
Beyond Next Month
Malcolm - 2nd May 2006   [«« Reply to this]
Hello-

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.

Malcolm
Peter Bengtsson - 2nd May 2006   [«« Reply to this]
Sorry, no idea. I don't use Outlook, I've just seen other people using it.
YukitaJon - 31st October 2006   [«« Reply to this]
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.

HTH
Anonymous - 29th August 2007   [«« Reply to this]
And I did so stumble. THANKS!
nick - 1st December 2008   [«« Reply to this]
Also stumbled. Thanks!
fonso - 12th November 2005  [«« Reply to this]
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 - 12th November 2005   [«« Reply to this]
That's really good! Didn't think of that. Will give it a try.
Tom Smith - 23rd March 2006  [«« Reply to this]
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
Previously
Lots of items
Previous month (Feb)
134 items.. who cares... life goes on... etc.
Tom Smith - 23rd March 2006  [«« Reply to this]
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...
kdrlx - 26th October 2006  [«« Reply to this]
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 -
http://img120.imageshack.us/img120/1855/outlookdefectzd7.jpg
Anonymous - 25th April 2007   [«« Reply to this]
Can you tell how to solve the problem?
u24 - 15th June 2008  [«« Reply to this]
this is exactly what I've been looking for! but where's the code, man?
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.