Last modified: 2012-11-11 01:13:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40723, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38723 - SMW 1.8: Problems with date conversion
SMW 1.8: Problems with date conversion
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-26 18:46 UTC by MWJames
Modified: 2012-11-11 01:13 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MWJames 2012-07-26 18:46:25 UTC
I tested the scenario below were dates are wrongfully converted.

## Test batch

{{#subobject:a1|demo=date|has date=01.01.1977|has value=12}}
{{#subobject:a2|demo=date|has date=02.01.1977|has value=34}}  --> ZZZ
{{#subobject:a3|demo=date|has date=03.01.1977|has value=40}}  --> ZZZ
{{#subobject:a4|demo=date|has date=04.01.1977|has value=20}}  --> ZZZ
{{#subobject:a5|demo=date|has date=11.01.1977|has value=16}}  --> ZZZ
{{#subobject:a6|demo=date|has date=13.01.1977|has value=42}}
{{#subobject:a7|demo=date|has date=14.01.1977|has value=72}}
{{#subobject:a8|demo=date|has date=15.01.1977|has value=52}}
{{#subobject:a9|demo=date|has date=16.01.1977|has value=24}}
{{#subobject:a10|demo=date|has date=18.01.1977|has value=42}}
{{#subobject:a11|demo=date|has date=19.01.1977|has value=22}}

Output is converted to

1 January 1977
18 January 1977
19 January 1977
1 February 1977  --> ZZZ --> wrong
1 March 1977  --> ZZZ --> wrong
1 April 1977  --> ZZZ --> wrong
1 November 1977  --> ZZZ --> wrong
13 January 1977
14 January 1977
15 January 1977
16 January 1977

## SMW
Semantic MediaWiki (Version 1.8 alpha)  (1560d5e)
Comment 1 MWJames 2012-11-03 10:36:01 UTC
The error still persists using MediaWiki 1.21alpha (e882bab) and Semantic MediaWiki (Version 1.8 beta 2)	(69ff80f).
Comment 2 Jeroen De Dauw 2012-11-11 00:33:33 UTC
So the issue here is that it's interpreting the dates as mm.dd.yyyy instead of dd.mm.yyyy for the entries you highlighted?
Comment 3 MWJames 2012-11-11 00:36:37 UTC
Exactly the dd.mm.yyyy input becomes mm.dd.yyyy output
Comment 4 Markus Krötzsch 2012-11-11 01:01:36 UTC
This behaviour is controlled in the language files. For English, we prefer mm.dd.yyyy over dd.mm.yyyy. I understand that this is the preference in the US.

I see that somehow it would be nicer to take into account that "." is used as a separator here (which indicates that it is not a US date), but SMW ignores the nature of the separators when interpreting the date. It just sees "1 2 3" and needs to decide if which date is meant.

A quick fix could be to create an EN-gb locale that has a different default. This does not require new date processing mechanisms, just a new file. Would that solve the problem?
Comment 5 Markus Krötzsch 2012-11-11 01:13:16 UTC
To clarify: SMW has a kind of fallback chain of date formats when three numbers are given. If one format is not possible (e.g., 17/01/12 could not be in MM/DD/YY format, even if this is preferred), then then next best will be tried. One can also stop this by not including some formats at all (SMW only tries the formats listed in the language file, not all possible ones).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links