Page MenuHomePhabricator

#time displays wrong day when given date as input
Closed, DuplicatePublic

Description

Author: jerome-ml

Description:
{{ #time: j F}} gives correct results

however :

  • {{ #time: j F | 20080317 }}
  • {{ #time: j F | 2008-3-17 }}
  • {{ #time: j F | 17 mars 2008 }}
  • {{ #time: j F | 2008 17 mars}}

give

  • 16 mars
  • 16 mars
  • 18 mars
  • 18 mars

expected :

  • 17 mars
  • 17 mars
  • 17 mars
  • 17 mars

Version

  • MediaWiki: 1.11.0
  • PHP: 5.2.5 (cgi)
  • MySQL: 5.0.44-log

Extensions

ParserFunctions (version 1.1.1)


Version: unspecified
Severity: normal

Details

Reference
bz13357

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:07 PM
bzimport added a project: ParserFunctions.
bzimport set Reference to bz13357.
bzimport added a subscriber: Unknown Object (MLST).

jerome-ml wrote:

Further investigation :

  • {{ #time: j F H:i | 20080317 }}
  • {{ #time: j F H:i | 2008-3-17 }}
  • {{ #time: j F H:i | 17 mars 2008 }}
  • {{ #time: j F H:i | 2008 17 mars}}
    • 16 mars 23:00
    • 16 mars 23:00
    • 18 mars 02:08
    • 18 mars 02:08

  • {{ #time: j F H:i | 20080317 13:00 }}
  • {{ #time: j F H:i | 2008-3-17 13:00 }}
  • {{ #time: j F H:i | 17 mars 2008 13:00 }}
  • {{ #time: j F H:i | 2008 17 mars 13:00 }}
    • 17 mars 12:00
    • 17 mars 12:00
    • Erreur : durée invalide
    • Erreur : durée invalide

  • {{ #time: j F H:i | 20080317 0:00 }}
  • {{ #time: j F H:i | 2008-3-17 0:00 }}
  • {{ #time: j F H:i | 17 mars 2008 0:00 }}
  • {{ #time: j F H:i | 2008 17 mars 0:00 }}
    • 16 mars 23:00
    • 16 mars 23:00
    • Erreur : durée invalide
    • Erreur : durée invalide

Note : There is probably a paramteter I did not set correctly about the server time because every time recorded (modification time/date for instance) is diplayed with a one hour difference with my local (french) time. I figured out default was GMT and I didn't take the time to investigate since I don't really care about modification times anyway. I mention it here since I see a 1 hour delay here to. Maybe solving that issue would make the two first formats work : 20080317 and 2008-3-17. Still it would not provide any explanation for the two others.

jerome-ml wrote:

Comment on my last comment : Forget the part about the 1 hour delay. I just realized there is a user set parameter that I can set to french time. Now, modification dates are correct. And the #time function issue persists.

jerome-ml wrote:

Regarding those lines in my previous comments

  • {{ #time: j F H:i | 17 mars 2008 }}
  • {{ #time: j F H:i | 2008 17 mars}}

I am realizing I misunderstood the use of this syntax. Apparently the 2008 is not understood as a year but as a time added to 06:00 in hhmm. This explains the 18 mars instead of 17 mars : 2008 added 20 hours to 06:00.
(This behaviour could be dangerous, though, since entering 2008, one would expect it to be interpreted as a year.)

  • {{ #time: j F H:i | 17 mars }}

gives an arbitrary

17 mars 06:00

which seems to be correct since the result on http://fr.wikipedia.org is the same.

I still have an issue with the other syntax :

  • {{ #time: Y j F H:i | 20080317 }}
  • {{ #time: Y j F H:i | 2008-3-17 }}
  1. 2008 16 mars 23:00
  2. 2008 16 mars 23:00

mediawiki-bugzilla wrote:

I have the exact same problem, all my dates are off by one if supplied as parameter to the #time parser function. Without parameter it works correctly.

  • {{ #time: j F }}
  • {{ #time: j F | 2008-3-17 }}
  1. 17 November
  2. 16 November

Time zone: localtime is set to Europe/Berlin

This works fine for me. I think the problem you're running into is actually bug 7133. Since #time doesn't support timezones, it assumes that all times are in UTC. So if your server is set to a different timezone, the difference will be reflected in the output. Since the WMF servers are set to UTC, they give the following results (which are correct):

{{ #time: Y j F H:i | 20080317 }} -> 2008 17 mars 00:00
{{ #time: Y j F H:i | 2008-3-17 }} -> 2008 17 mars 00:00

  • This bug has been marked as a duplicate of bug 7133 ***

It's also possible this was a duplicate of bug 17080, but I'm reasonably sure it falls under one or the other.