Jonas Kress (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/240714
Change subject: [WIP] Use YearMonthDayTimeParser in TimeParserFactory ...................................................................... [WIP] Use YearMonthDayTimeParser in TimeParserFactory Use YearMonthDayTimeParser in TimeParserFactory to be able to parse dates like February 29, 1700 (Julian) Bug: T98194 Change-Id: Ib3796e2286ed229d391fdbd77bdbe99d621f5e29 --- M repo/includes/Parsers/TimeParserFactory.php M repo/tests/phpunit/includes/Parsers/TimeParserFactoryTest.php 2 files changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/14/240714/1 diff --git a/repo/includes/Parsers/TimeParserFactory.php b/repo/includes/Parsers/TimeParserFactory.php index 89c5525..358dc82 100644 --- a/repo/includes/Parsers/TimeParserFactory.php +++ b/repo/includes/Parsers/TimeParserFactory.php @@ -11,6 +11,7 @@ use ValueParsers\ParserOptions; use ValueParsers\PhpDateTimeParser; use ValueParsers\ValueParser; +use ValueParsers\YearMonthDayTimeParser; /** * @since 0.5 @@ -58,6 +59,7 @@ $parsers[] = new YearMonthTimeParser( $this->options ); $parsers[] = $isoTimestampParser; $parsers[] = new MwTimeIsoParser( $this->options ); + $parsers[] = new YearMonthDayTimeParser( $eraParser ); $parsers[] = new PhpDateTimeParser( $this->getMonthNameUnlocalizer(), $eraParser, diff --git a/repo/tests/phpunit/includes/Parsers/TimeParserFactoryTest.php b/repo/tests/phpunit/includes/Parsers/TimeParserFactoryTest.php index 7c1ad08..86d8cce 100644 --- a/repo/tests/phpunit/includes/Parsers/TimeParserFactoryTest.php +++ b/repo/tests/phpunit/includes/Parsers/TimeParserFactoryTest.php @@ -37,7 +37,7 @@ $factory = new TimeParserFactory( new ParserOptions( array( ValueParser::OPT_LANG => $languageCode ) ) ); $parser = $factory->getTimeParser(); - $this->assertTrue( $expected->equals( $parser->parse( $value ) ) ); + $this->assertEquals($expected->toArray(), $parser->parse( $value )->toArray() ); } public function validInputProvider() { @@ -125,6 +125,8 @@ array( '+2013-07-01T00:00:00Z' ), '1 Jul 2013' => array( '+2013-07-01T00:00:00Z' ), + 'February 29, 1500' => + array( '+1500-02-29T00:00:00Z', TimeValue::PRECISION_DAY, $julian ), '1 Jul 2013 BC' => array( '-2013-07-01T00:00:00Z', TimeValue::PRECISION_DAY, $julian ), '1 Jul 2013CE' => -- To view, visit https://gerrit.wikimedia.org/r/240714 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3796e2286ed229d391fdbd77bdbe99d621f5e29 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits