diff --git a/module/VuFind/src/VuFind/ILS/Driver/Alma.php b/module/VuFind/src/VuFind/ILS/Driver/Alma.php index d6881b2e8dd4d3126541b65f58d4b609c16d14b1..aebad97d66a8d6cbee0e20cc527ef11386fba497 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Alma.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Alma.php @@ -861,14 +861,8 @@ class Alma extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface "title" => (string)($fee->title ?? ''), "amount" => round(floatval($fee->original_amount) * 100), "balance" => round(floatval($fee->balance) * 100), - "createdate" => $this->dateConverter->convertToDisplayDateAndTime( - 'Y-m-d\TH:i:s.???T', - $created - ), - "checkout" => $this->dateConverter->convertToDisplayDateAndTime( - 'Y-m-d\TH:i:s.???T', - $checkout - ), + "createdate" => $this->parseDate($created, true), + "checkout" => $this->parseDate($checkout, true), "fine" => $this->getTranslatableString($fee->type) ]; } @@ -1595,6 +1589,8 @@ class Alma extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface $euroPad = "/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}$/"; // e. g. 13/07/2012 $datestamp = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/"; // e. g. 2012-07-13 $timestamp = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$/"; + $timestampMs + = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$/"; // e. g. 2017-07-09T18:00:00 if ($date == null || $date == '') { @@ -1621,6 +1617,18 @@ class Alma extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface substr($date, 0, 10) ); } + } elseif (preg_match($timestampMs, $date) === 1) { + if ($withTime) { + return $this->dateConverter->convertToDisplayDateAndTime( + 'Y-m-d\TH:i:s#???T', + $date + ); + } else { + return $this->dateConverter->convertToDisplayDate( + 'Y-m-d', + substr($date, 0, 10) + ); + } } else { throw new \Exception("Invalid date: $date"); }