diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index 7013d14e..071fcbe5 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -461,21 +461,27 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface $timestamp = (string) $attributes['zeit']; $parts = explode(' ', $timestamp); if (2 === count($parts)) { - [$datePart, $timePart] = $parts; + [$pickupDate, $timePart] = $parts; + $pickupTime = substr($timePart, 0, 5); } else { - $datePart = null; - [$timePart, ] = $parts; + $pickupDate = $dateStart->format('d.m.Y'); + $pickupTime = $parts[0]; } - $pickupTime = sprintf('%s Uhr', substr($timePart, 0, 5)); - $pickupDate = $datePart; $pickups[] = [ + 'bus_pro_id' => $busProId, 'city' => $this->pickups[$busProId]['city'], 'street' => $this->pickups[$busProId]['street'], 'price' => (float) str_replace(',', '.', (string) $attributes['preis']), - 'time' => $pickupTime, 'date' => $pickupDate, + 'time' => $pickupTime, ]; } + usort($pickups, function ($a, $b) { + $timeStampA = \DateTimeImmutable::createFromFormat('d.m.Y H:i', $a['date'].' '.$a['time']); + $timeStampB = \DateTimeImmutable::createFromFormat('d.m.Y H:i', $b['date'].' '.$b['time']); + + return $timeStampA <=> $timeStampB; + }); $date['pickups'] = serialize($pickups); return $date;