Last modified: 2007-03-21 18:22:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11200, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9200 - Adding Julian Date as Variable
Adding Julian Date as Variable
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
PC All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikibooks.org/
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-07 00:57 UTC by Robert Horning
Modified: 2007-03-21 18:22 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Robert Horning 2007-03-07 00:57:55 UTC
The motivation for this request is to provide a way that would allow Wikibooks
to put up a featured Wikibook on the main page that would appear on a rotation
schedule, similar to what is done for Wikipedia and Commons Featured
Articles/Pictures.

The short coming of this concept is that Wikibooks simply doesn't have enough
quality books to justify or warrant having a new book featured every day that is
brand new.  I've created a template that currently uses a calculation using a
mod function and a psuedo "variable" that is really just a transcluded template:

{{Wikibooks:Featured Books/Book{{#expr: {{CURRENTDAY}} mod {{FEATURENUM}}}}}}

The problem here is that the CURRENTDAY variable only goes to 31 (on months with
31 days), and we need the ability to have a few more than just 31 featured
Wikibooks (although this is a short term solution).  What I would like to see is
something more like this:

{{Wikibooks:Featured Books/Book{{#expr: {{JULIANDAY}} mod {{FEATURENUM}}}}}}

where the variable "JULIANDAY" is calculated according to the rough standards
listed on [[w:Julian Day]].

I believe this value is already calculated by MySQL and other DB servers, so it
is simply a matter of passing this information forward, although calculations of
this date aren't overly complicated.  I'm sure that a very complicated
expression could also be generated using the values of "CURRENTDAY",
"CURRENTMONTH", and "CURRENTYEAR" to derive this date, although it could be
debated if the efficiency of doing this for something like a major project main
page is something worth doing.  It also seems a bit strange to "recalculate" a
variable that already exists in the operating system and was used to calculate
the above three variables in the first place, or at least something very similar.

This does have value beyond just the very limited appeal for having a date
variable that can be manipulated for further calculations, and I think that this
is certainly something that can be extended in other directions as well.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-03-07 01:12:54 UTC
Wouldn't something like {{#expr:({{#date:U}}/86400) round 0}} work for you?
Comment 2 Robert Horning 2007-03-07 01:45:55 UTC
A better expression would be:

{{#expr:{{#time:U}}/86400 round 0}}

but yeah, that mostly does what I was looking for.  Thanks.  I'm going to create
a full Julian date template based off of this, which is trivial at this point. 
Thank for pointing me in the right direction.

The only real problem here is the classical Unix MAXINT bug for when this number
rolls over, but I think that will be a larger issue for more than just the main
page of Wikibooks.  Hopefully that bug will get a good work around that will be
better than the Y2K problems.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links