fix multi-digit seconds fraction handling
This commit is contained in:
parent
7c87dc9720
commit
7b920c1ec5
@ -69,7 +69,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
|
||||
return;
|
||||
}
|
||||
|
||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) {
|
||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) {
|
||||
throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339));
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ class DateTimeToRfc3339TransformerTest extends TestCase
|
||||
array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'),
|
||||
array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'),
|
||||
array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T08:30:00Z'),
|
||||
array('UTC', 'UTC', '2018-10-03T10:00:00.000Z', '2018-10-03T10:00:00.000Z'),
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user