You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The used date formats are different from the expected protected static string $datetimeFormat = 'Y-m-d\TH:i:s\Z'; format used in the Deserializes.php trait.
The return of this block
if (! class_exists($type) && ! interface_exists($type)) {
throw new InvalidAttributeTypeException("Neither the Class nor Interface `$type` exists");
} elseif ($type == \DateTimeInterface::class) {
if (strlen($value) === 10) {
return DateTime::createFromFormat('Y-m-d', $value);
} else {
return DateTime::createFromFormat(static::$datetimeFormat, $value);
}
}
is false, because the createFromFormat isn't the correct format for the value.
See screenshot attached:
Creating this issue because I don't know what the correct fix would be in the great scope of things.
Put it into a try-catch block and try another format if the first one fails?
The text was updated successfully, but these errors were encountered:
Let's do this: let's define a priority-sorted list of date/datetime format specifiers as a static attribute on Deserializes, and loop through them try/catching each one until one of them works or we run out of options, in which case we throw some sort of datetime in unknown format: $dateString exception.
Let's do this: let's define a priority-sorted list of date/datetime format specifiers as a static attribute on Deserializes, and loop through them try/catching each one until one of them works or we run out of options, in which case we throw some sort of datetime in unknown format: $dateString exception.
That make sense?
Sounds fine to me. Will open a PR as soon as I'm done. Might take until tomorrow noon though. Update: Opened a PR with a possible solution and a basic test.
Call reportsV20210630->getReport.
This is a productive response provided as example:
The used date formats are different from the expected
protected static string $datetimeFormat = 'Y-m-d\TH:i:s\Z';
format used in the Deserializes.php trait.The return of this block
is
false
, because the createFromFormat isn't the correct format for the value.See screenshot attached:
Creating this issue because I don't know what the correct fix would be in the great scope of things.
Put it into a try-catch block and try another format if the first one fails?
The text was updated successfully, but these errors were encountered: