Topic on Project:Support desk

time ParserFunction gives unexpected output

5
Lbillett (talkcontribs)

On the afternoon of July 31, 2014 I noticed the following behaviour:

 {{#time:Y-m}} => 2014-07
 {{#time:Y-m|now -1 months}} => 2014-07  (<-same month?)
 {{#time:Y-m|now -2 months}} => 2014-05


By Aug 1st, the same functions yield as expected:

{{#time:Y-m}} => 2014-08
 {{#time:Y-m|now -1 months}} => 2014-07
 {{#time:Y-m|now -2 months}} => 2014-06 

Am I just using the function wrong? Tried it on my mediawiki.org talk page too with the same result. Are adjustments by month not doing what I think? Thanks!

Florianschmidtwelzow (talkcontribs)

Maybe i's possible, that you refer to your local time zone? The time parser function uses the server time (or a configured time in LocalSettings.php), so it's possible, that the server was in August and "you was still in July"? Just an idea :)

Lbillett (talkcontribs)

I was thinking it might be timezone related. But it's still puzzling that the same functions behaved differently in the same moment! I suppose if the calculation in that instance is being done with no time zone accommodation this could happen?

Ricordisamoa (talkcontribs)

{{#time:c|2014-07-31 -1 months}} and {{#time:c|2014-08-01 -1 months}} DO yield the same result, actually.

Lbillett (talkcontribs)

Ah, a better example. So... is this considered expected output? As a workaround I adjusted my reports to only do monthly arithmetic based on the 1st of the month. But I'd maintain that this is a little weird.

Reply to "time ParserFunction gives unexpected output"