Page MenuHomePhabricator

Failure to format dates with timestamp that have 00 for month and/or day
Closed, ResolvedPublic

Description

TimeValues that have timestamps such as '+00000001995-00-00T00:00:00Z' with '00' for month and/or day gets converted to '1995-00-00T00:00:00Z' then is passed through MWTimestamp( $timestamp ), which in turn does new DateTime( $timestamp ) for TS_UNIX.

new DateTime( '1995-00-00T00:00:00Z' ) results in an object with date value of '1994-11-30 00:00:00'.

MwIsoTimestampFormatter then considers the year invalid since original '1995' != '1994' and on failure, does fallback to outputting a timestamp.

Example of an item where this occurs on Wikidata is https://www.wikidata.org/wiki/Q4119465


Version: unspecified
Severity: normal

Details

Reference
bz64659

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:19 AM
bzimport set Reference to bz64659.
bzimport added a subscriber: Unknown Object (MLST).

this is when the TimeValue has PRECISION_YEAR

btw, the iso regex pattern for validation is '!^[-+]\d{1,16}-(0\d|1[012])-([012]\d|3[01])T00:00:00Z$!' so 00 for month and/or day is considered valid.

Change 130617 had a related patch set uploaded by Aude:
Fix formatting of TimeValues with month or day = '00' in timestamp

https://gerrit.wikimedia.org/r/130617

Change 130617 merged by jenkins-bot:
Fix formatting of TimeValues with month or day = '00' in timestamp

https://gerrit.wikimedia.org/r/130617

Change 130827 had a related patch set uploaded by Aude:
Fix formatting of TimeValues with month or day = '00' in timestamp

https://gerrit.wikimedia.org/r/130827

Change 130827 merged by jenkins-bot:
Fix formatting of TimeValues with month or day = '00' in timestamp

https://gerrit.wikimedia.org/r/130827