psilandia

logo

Pasi Savolainen

This is my site. It's ordered mainly in a 'directory' fashion. To navigate, use:

Specifics about me.

Humanized dates/ages for blosxom

After seeing some places implementing humanized dates and ages (Gmail impressed me most :), I coded fluffydates -plugin for blosxom.

It's output is age of certain date or date's shorter/more readable form. It most often looks like this for dates: 0:02; Yesterday 9:44; Thursday 9:44; February 18; February 18, 2003. For age it would look something like this: 20 minutes; 9½ hours; 0¾ day; 1¼ days; 7½ months; 1¾ years.

It supports multilingual sites, a primary language can be chosen and other languages used via interpolate_fancy blosxom plugin. interpolate_fancy can also be used for accessing date translating functions to have more interesting effects.

Usage/installation is simple: drop it into your plugin folder, and place $fluffydate::story_date and/or $fluffydate::story_age in your story.html. For fancier accessing you'll need interpolate_fancy.

With interpolate_fancy, you can use four additional functions, human_storydate, human_storyage, short_date and date_to_age. Two former are almost same as those provided via variables, but these can be localized.

All four functions take two parameters, lang and short. lang tells which language to use (English and Finnish so far :) and short tells if shorter form of date should be used (Mon instead of Monday, etc.)

Example with interpolate_fancy:

Download fluffydate.

Updated 2004-10-18: fixed typo, fixed one close-shaved moment cutoff, fixed handling with not found dates (again, typo).

(4 years ago) | /code/misc/fluffydate | Comments 0

Comments:

Check HTML and CSS Validity. RSS feed Rendertime: 0.63s