Page MenuHomePhabricator

ISO date format not honored by Mediawiki API (arvbadtimestamp_arvstart)
Closed, ResolvedPublic


On MediaWiki 1.27, I can query for revisions made past a certain timestamp.

If, however, I format the timestamp this way:

  • 2016-08-30T00:00:00+00:00

I get an error. This timestamp, however, works.

  • 2016-08-30T00:00:00

This timestamp is ISO format generated from the following python line:

A small testcase to illustrate the problem even better:

Working URL:

Non working URL:

Event Timeline

Datatypes are list on

There is no way to pass a timestamp with timezone to the api (or other inputs in mediawiki), "any included timezone is ignored"

I am not sure, if the api should accept this timestamp and just ignore the timezone or it is better to ignore the whole timestamp

Timezone is part of the standard cited in that documentation, and it is what you get from standard python... so I think it makes sense to accept it somehow! How to do so it of course up to you :-)

Note further that the handling of different timestamp formats is controlled by the MWTimestamp class used by MediaWiki for all timestamp manipulation. Any fix for this issue would likely be there rather than in the API itself.

Timezone is part of the standard cited in that documentation

It says "ISO 8601 date and time, 2001-01-15T14:56:00Z (punctuation and Z are optional)" and "ISO 8601 date and time with (ignored) fractional seconds, 2001-01-15T14:56:00.00001Z (dashes, colons, and Z are optional)". It doesn't specify that anything else in the ISO 8601 standard is allowed. 2001-01-15T14:56:00+00:00 and 2001-W03-2T14:56:00Z and 2001-015T14:56:00Z and 2001-01-15T14:56Z are all not recognized.

Aklapper triaged this task as Lowest priority.Sep 1 2016, 4:59 PM

@Anomie you are right that documentation does not say it will handle the entire ISO 8601, but I do think MW should handle at least a very common 2019-04-08T04:12:45+00:00-style format (only +00:00 / -00:00, not other timezones). It is, for better or worse, fairly common with Python, and supporting it shouldn't be a significant undertaking.

Note that this is identical to Wikidata T179068, which was successfully implemented.

Change 512201 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/libs/Timestamp@master] Improve ISO 8601 support in setTimestamp()

Change 512201 merged by jenkins-bot:
[mediawiki/libs/Timestamp@master] Improve ISO 8601 support in setTimestamp()

Change 517915 had a related patch set uploaded (by Anomie; owner: Gergő Tisza):
[mediawiki/core@master] Update ObjectFactory and ConvertibleTimestamp

Change 517915 merged by jenkins-bot:
[mediawiki/core@master] Update ObjectFactory and ConvertibleTimestamp