diff --git a/src/JsonSchema/Rfc3339.php b/src/JsonSchema/Rfc3339.php index 5afdaed4..62509aa5 100644 --- a/src/JsonSchema/Rfc3339.php +++ b/src/JsonSchema/Rfc3339.php @@ -4,7 +4,7 @@ class Rfc3339 { - const REGEX = '/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))/'; + const REGEX = '/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/'; /** * Try creating a DateTime instance diff --git a/tests/Constraints/FormatTest.php b/tests/Constraints/FormatTest.php index 6e386b2f..c09decd9 100644 --- a/tests/Constraints/FormatTest.php +++ b/tests/Constraints/FormatTest.php @@ -150,6 +150,9 @@ public function getInvalidFormats() array('00:00:60', 'time'), array('25:00:00', 'time'), + + array('invalid_value_2000-05-01T12:12:12Z', 'date-time'), + array('2000-05-01T12:12:12Z_invalid_value', 'date-time'), array('1999-1-11T00:00:00Z', 'date-time'), array('1999-01-11T00:00:00+100', 'date-time'), array('1999-01-11T00:00:00+1:00', 'date-time'),