Relative time references become out of date

From WhyNotWiki

Jump to: navigation, search

[edit] Problem

If in June 2007, I write "Just 6 months ago, I was ...", then come December 2007 (if I still haven't changed the text by then), my words will be inaccurate by a factor of 100%!

In December, they should read "Just 12 months ago, I was ...".

But who's going to remember to keep changing the words every month (or every day, if it's a relative time statement with a precision of days...)? Certainly not I!!

[edit] Solution

Make only absolute time references and let the system convert it into a relative time reference for you!

So instead of writing this:

"Just 6 months ago, I was ..."

, you'd write this:

"Just {{now - 2007-01}} months ago, I was ..."

and it will do the subtraction for you.

[edit] Using MediaWiki

Using the #expr: parser function, we can actually do this with a MedaiWiki template.

{{ago|2007|01|01|months}} ago...

will produce:

23.07 months ago...
Personal tools