Page MenuHomePhabricator

Date type does not handle a sole year value correctly
Closed, ResolvedPublic

Description

Author: gavin_ogorman

Description:
If a property of type::Date (submittedOn for example) is created and then assigned a single value of a single year e.g:

[[submittedOn::2011]]

then the value is not parsed correctly. The problem is in datavalues/SMW_DV_Time.php:149 and is the MediaWiki wfTimestamp() function. It doesn't correctly parse the year, but returns a value anyway. I did a quick test:

if ( $timeStamp !== false && $timeStamp != 19700101003332 ) {

and that fixed the problem. Obviously it's not a good solution, the wfTimestamp function probably needs to be fixed.


Version: unspecified
Severity: normal

Details

Reference
bz30395

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:53 PM
bzimport set Reference to bz30395.

gavin_ogorman wrote:

example of date parsing error

Attached:

Should be fixed by r94928. The solution still isn't ideal, but it should do the job. Can you confirm it works for you?