NATHAN ASHBY-KUHLMAN > Blog Entry

Intelligent relative dates

Reporters love to use relative dates, for good reasons. Writing “yesterday,” “today” or “tomorrow” rather than, say, “Dec. 18,” “Dec. 19” or “Dec. 20” doesn’t just sound better. It’s also a lot easier for a reader to understand.

Print journalists can use those relative date references only because their readers have a shared understanding of what “today” refers to — the day that particular newspaper was delivered. On the Web, it’s not that simple:

  • Good sites, ones that understand the importance of breaking news quickly, regularly post some or all of the next day’s newspaper articles before the next day.
  • Some sites’ front pages tease to particularly good articles not just on the articles’ day of publication, but for several days thereafter. Many sites archive coverage by topic and offer it weeks and months later.
  • Many readers don’t discover articles on the day of publication. Maybe friends e-mail them a URL or the text of a story itself. Maybe they clicked on a link to the story from another Web site.

In short, since many site visitors don’t read articles on their actual publication dates, referring to dates in relative terms can get confusing, even if a site identifies the article’s publication date well. This “Rams notebook” from Nov. 8 at stltoday.com uses “today” six times, “Friday” five times, “yesterday” four times, “Thursday” three times, “Sunday” twice and “Monday” once. The relative dates in this article — only 348 words long, by the way — are just incomprehensible after the fact.

One solution would be to make all relative dates into absolute dates. But it would be better to take advantage of something computers do well and make dates “intelligent.” What if Web sites automatically made dates relative to the current date rather than the publication date? For example, suppose I refer to “Dec. 20, 2002” — which right now for me is “tomorrow” — using some JavaScript that will display whatever “Dec. 20” means to you, at the time you access this page:

If you’re reading this blog entry within a few days of when I wrote it, you should see a relative date above — “today,” “yesterday” or “last Friday.” Otherwise, you’ll see the absolute date, “Dec. 20.” If you read this in 2003 rather than 2002, the script will add the year for clarity: “Dec. 20, 2002.” Give this a try below. Choose a month, day and year on the left, then press the “Show” button. You’ll see a relative reference if that date is within the past week or coming week (according to your own computer’s clock). Otherwise, you’ll see an absolute reference to that date.

This is accomplished with some pretty simple JavaScript that you should feel free to download, use and modify. If you include this script in a Web page, you can write out an intelligent date reference like this:

<script type="text/javascript">dateReference("Dec 19 2002");</script>

You want to make sure you display a dumb absolute date in browsers that don’t understand JavaScript, so in practice you should use something like this full code:

<script type="text/javascript">
<!--
dateReference("Dec 19 2002");
//-->
</script>
<noscript>Dec. 19, 2002</noscript>

I am a realist (even if I’m also a dreamer) so I’m not expecting news Web sites to begin using something like this anytime soon. The main problem, of course, is the kind of staff time it would require to code these dates. And because of proper nouns, this isn’t something that could be done with an automatic search and replace of print edition stories — what about the story that refers to NBC’s “Today” show?

There are further problems:

  • Often whether a relative date is in the past or future is determined from context. The script’s inclusion of the “last” in “last Thursday” or the “this” in “this Monday” could be redundant or confusing.
  • This method assumes the clock is set correctly on readers’ computers. They could be quite misinformed if it isn’t.
  • Sometimes dates appear in direct quotes. Making the dates intelligent would alter the quote.
  • Finally, some people (like me) have fairly nocturnal lifestyles, in which the division each night at midnight between “today” and “tomorrow” is arbitrary and would make automatic relative dates confusing.

Intelligent relative dating like this couldn’t be implemented without some solutions to these problems. But if there were a way to do it reliably, we could take advantage of computers’ ability to calculate and reduce the confusion over what day “Thursday” refers to in an article published a month and a half ago.

POST A COMMENT on “Intelligent relative dates”

Your name: (optional)

Your site: (optional)

Comment: (only <a>, <em> and <strong> allowed)

This page last modified on Sunday, February 3, 2013 at 1:27 pm