ZF-8644: Zend_Validate_Sitemap reports valid W3C dates as invalid

Description

Zend_Validate_Sitemap_Lastmod does not correctly validate all W3C Datetime dates as allowed by the Sitemap specification.

require_once 'Zend/Validate/Sitemap/Lastmod.php';

$v = new Zend_Validate_Sitemap_Lastmod;

var_dump($v->isValid("2009-12-27T20:49:30Z")); // FALSE
var_dump($v->isValid("2009-12-27T20:49:30+00:00")); // TRUE
var_dump($v->isValid("2009")); // FALSE
var_dump($v->isValid("2009-12")); // FALSE
var_dump($v->isValid("2009-12-27")); // TRUE
var_dump($v->isValid("2009-12-27T20:49:30+00:00")); // TRUE
var_dump($v->isValid("2009-12-27T20:49:30.30+00:00")); // FALSE

It looks like the regex is based on reading the Sitemap spec section alone without referring to the W3C spec.

Comments

Adding correct component

The standard is somewhat fuzzy related to the formats which are accepted.

Searching other resources it seems that only 3 formats from the 40 available W3C formats are accepted: 2007-08-25T00:00:00+00:00 2007-08-25T00:00+00:00 2007-08-25

Formats like "2009", "2009-01" or "11:00:00" are not valid.