Last modified: 2014-03-10 16:52:59 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 T4522, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 2522 - {{CURRENTMONTH}} uses a leading zero (date('m')) but {{CURRENTDAY}} does not (date('j'))
{{CURRENTMONTH}} uses a leading zero (date('m')) but {{CURRENTDAY}} does not ...
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement with 4 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikipedia.org/wiki/template...
:
: 2912 3411 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-26 05:43 UTC by Ævar Arnfjörð Bjarmason
Modified: 2014-03-10 16:52 UTC (History)
8 users (show)

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


Attachments

Description Ævar Arnfjörð Bjarmason 2005-06-26 05:43:00 UTC
{{CURRENTMONTH}} uses a leading zero (date('m')) but {{CURRENTDAY}} does not
(date('j') (date ('d') is the current day with leading zeros), this is inconsistant.

Either they should both use leading zeros or neither one should, or two new date
variables should be introduced which didn't have a leading zero (for
{{CURRENTMONTH}}) or did (for {{CURRENTDAY}}}).
Comment 1 Ævar Arnfjörð Bjarmason 2005-07-22 16:29:46 UTC
*** Bug 2912 has been marked as a duplicate of this bug. ***
Comment 2 dhneum 2005-09-09 22:47:41 UTC
With the current bug, it's impossible for us to construct the ISO 8601 
international standard date, because {{CURRENTDAY}} is missing the 
leading zero.  {{CURRENTDAY}} needs to always display the two-digit day 
of month, or else please create a new variable that does so, named, e.g., 
{{CURRENTDAY2}}.  Wikipedia should only be using the ISO 8601 
international standard date and time format for the four-tilde signature 
string and logged-out skin, instead of arbitrary, colloquial formats, 
because Wikipedia is intended for a worldwide audience.
Comment 3 Zigger 2005-09-09 23:38:08 UTC
*** Bug 3411 has been marked as a duplicate of this bug. ***
Comment 4 JePe 2005-09-10 01:40:00 UTC
On the Dutch Wikipedia I have made the template {{CURRENTDAY XX}} with the 
content: {{Day {{CURRENTDAY}}}}

The templates from {{Day 1}} till {{Day 31}} have a content of 01 till 31 (with a 
leading zero). 
Comment 5 dhneum 2005-10-17 00:22:30 UTC
Using JePe's idea, on en.wikipedia, I have created the template 
{{CURRENTDAY2}} with the content {{Twodigit {{CURRENTDAY}}}}. The 
templates {{Twodigit 1}} through {{Twodigit 31}} have a content of 01 
through 31.

Therefore, on en.wikipedia, {{CURRENTDAY2}} returns the current day of 
month always as a two-digit number (with a leading zero for days 1 
through 9).

Could an admin please document this variable, {{CURRENTDAY2}}, on 
the Help:Variable page (http://meta.wikimedia.org/wiki/Help:Variable), 
since many other users are needing and looking for this function on the 
Help:Variable page, but can't find it there.
Comment 6 lɛʁi לערי ריינהארט 2005-10-17 16:34:55 UTC
(In reply to comment #5)
> Using JePe's idea, on en.wikipedia, I have created the template 
> {{CURRENTDAY2}} with the content {{Twodigit {{CURRENTDAY}}}}. ...

This "workaround" is using 32 templates / project. What about fixing this bug
which would support *all* projects.
Comment 7 Ævar Arnfjörð Bjarmason 2005-10-17 23:07:27 UTC
Severity => enhancement
Comment 8 dhneum 2005-10-18 14:19:45 UTC
I agree with comment 6. Due to the inconsistency stated in the first post of 
this bug, {{CURRENTMONTH}} has little or no utility, since it's useless 
without the corresponding zero-padded day of month. Since almost no 
one could be using it due to this design mistake, I propose modifying the 
existing CURRENTMONTH variable so that it behaves consistently with 
the existing CURRENTDAY variable. I.e., remove the leading zero in 
{{CURRENTMONTH}}. Then create two new variables, named 
CURRENTMONTH2 and CURRENTDAY2, that give the month and day 
always as two-digit numbers.
Comment 9 Helder 2011-07-02 01:56:13 UTC
I'm reopening this bug because the inconsistency reported in the first comment is still present: I just created a page with
  {{CURRENTDAY}}/{{CURRENTMONTH}}
and got
  2/07
instead of any of these:
  02/07
  2/7

For a real example of how this is problematic see:
https://secure.wikimedia.org/wikipedia/en/w/index.php?diff=437297075&oldid=436773789
The version of the code which uses MW variables was tested (on 29 June 2011), before saving the edit. Then, some days after that the code suddenly stops working because, on 1 July 2011, the value returned by {{CURRENTDAY}} is "1" instead of "01".

I think MW users can't be supposed to guess that MediaWiki outputs are inconsistent.
Comment 10 Jarry1250 2011-07-05 18:00:43 UTC
To summarise, then, this bug concerns the disparity between month and day:

{{CURRENTMONTH}} is padded;
{{CURRENTMONTH1}} is unpadded;
{{CURRENTDAY}} is unpadded;
{{CURRENTDAY2}} is padded.

Each have existing usages across the wikis.

The easiest start would be to add {{CURRENTMONTH2}} as padded. Then {{CURRENTMONTH}} could be made unpadded (a breaking change). Then {{CURRENTMONTH1}} deprecated and eventually removed.

This would obviously require discussion.
Comment 11 Helder 2014-03-10 16:52:59 UTC
See also Change-Id: Ia1272e564c9cc53632b630ac534c439e81f001e1

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


Navigation
Links