Last modified: 2013-09-18 17:02:01 UTC
When I set a property of type Date to a 3-digit year (or any other number that doesn't have 4 digits), it is parsed not as a year, but as a time offset from 1 Jan 1970: "910" becomes "1 January 1970 00:15:10" "1910" becomes "1910" "11910" becomes "1 January 1970 03:18:30" Problems: - Nothing in the documentation suggests this behavior. There's no description of simple numbers being interpreted as Unix timestamps. It seems at odds with the goal to "allow year numbers in the order of 10^9" (from Help:Type_Date). - I tried "910 AD" as a workaround, and this sets the property value correctly, but it is displayed without the "AD" -- "910 AD" becomes "910" (in contrast, "910 BC" becomes "910 BC"). This is a problem because I sometimes want set other properties based on a query of existing values. Taking a date, displaying it, and the re-parsing it should not change the meaning of the date. - This seems to be a regression. I haven't tested it, but I found the offending code, and it doesn't exist in an older version I have lying around (1.5). The implication is that the interpretation of valid (and reasonable) dates on an existing wiki will change with an SMW upgrade. My configuration: Semantic MediaWiki 1.8.0.4 MediaWiki 1.20.3 PHP 5.3.15 MySQL 5.5.28 Here's the code that causes the problem (in SMW_DV_Time.php): protected function parseUserValue( $value ) { ... // Check if it's parseable by wfTimestamp when it's not a year (which is wrongly interpreted). if ( strlen( $value ) != 4 && wfTimestamp( TS_MW, $value ) !== false ) { $this->m_dataitem = SMWDITime::newFromTimestamp( $value ); } elseif ( ...
*** This bug has been marked as a duplicate of bug 54151 ***
*** Bug 54151 has been marked as a duplicate of this bug. ***