Skip to content

Commit

Permalink
Fix regex for Rfc3339 validation (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
kekko1212 authored and bighappyface committed Jan 16, 2017
1 parent d39c56a commit 325a0f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JsonSchema/Rfc3339.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/Constraints/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 325a0f8

Please sign in to comment.