Page MenuHomePhabricator

[Bug] Date parser does not allow February 29, 1700 (Julian)
Open, MediumPublic

Description

From T75272:

A fault with the user interface input parser is that it does not allow the entry of dates that exist in the Julian calendar but not the Gregorian calendar, such as February 29, 1700.

Reason is that dates in this format are processed by the PhpDateTimeParser.

Event Timeline

thiemowmde raised the priority of this task from to Needs Triage.
thiemowmde updated the task description. (Show Details)
thiemowmde added projects: Wikidata, DataValues.
thiemowmde added subscribers: thiemowmde, daniel, Jc3s5h.
JanZerebecki moved this task from incoming to ready to go on the Wikidata board.
JanZerebecki set Security to None.
Jonas renamed this task from Date parser does not allow February 29, 1700 (Julian) to [Bug] Date parser does not allow February 29, 1700 (Julian).Aug 14 2015, 8:44 AM

The relevant YearMonthDayTimeParser (see https://github.com/DataValues/Time/blob/master/src/ValueParsers/YearMonthDayTimeParser.php) that could fix this and quite a lot similar issues is already merged and released for a while now. It's just not used in Wikibase repo.

The relevant YearMonthDayTimeParser (see https://github.com/DataValues/Time/blob/master/src/ValueParsers/YearMonthDayTimeParser.php) that could fix this and quite a lot similar issues is already merged and released for a while now. It's just not used in Wikibase repo.

I notice this course calls eraParser. EraParser (see https://github.com/DataValues/Time/blob/master/src/ValueParsers/EraParser.php) appears to recognize years that contain + as CE, - as BCE, and several variations of the suffix as the appropriate era (CE, AD, Anno Domini, BCE, Before Christ, etc.) But I was unable to figure out what EraParser will do if the year is 0.

Change 240714 had a related patch set uploaded (by Jonas Kress (WMDE)):
[WIP] Use YearMonthDayTimeParser in TimeParserFactory

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

The relevant YearMonthDayTimeParser (see https://github.com/DataValues/Time/blob/master/src/ValueParsers/YearMonthDayTimeParser.php) that could fix this and quite a lot similar issues is already merged and released for a while now. It's just not used in Wikibase repo.

Unfortunately the YearMonthDayTimeParser is not fixing the problem. Do you have an idea @thiemowmde ?

1700-02-29 works BTW!

"1700-02-29" is "ISO-like" and parsed by IsoTimestampParser.

YearMonthDayTimeParser is currently not able to parse localized month names. This is by design. It can parse everything that contains three numbers, e.g. "29.2.1700", "02/29/1700" and so on. These two test cases should be added to https://gerrit.wikimedia.org/r/240714.

In https://github.com/DataValues/Time/pull/93 I'm exploring the idea to make YearMonthDayTimeParser aware of localized month names, but I'm not sure if this is the right thing to do. I need time to collect test cases.

Change 240714 merged by jenkins-bot:
Use YearMonthDayTimeParser in TimeParserFactory

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

@thiemowmde @Jonas patch is merged, is this fixed now and can be closed?

As hinted in T98194#1684440 the original task description is still valid: When entering "February 29, 1700" our set of date parsers wrongly turn this into "1 March 1700". This ticket was in the previous sprint because of numeric inputs like "29.2.1700" and "02/29/1700", which are now allowed. We did not picked it up in the current sprint (it's only in the proposals column).