Commit 94d4c840 authored by Johannes's avatar Johannes Committed by Peter Tönnies

Fixed "off by 1h bug". Used Carbon::parse instead of createFromFormat....

Fixed "off by 1h bug". Used Carbon::parse instead of createFromFormat. Cherrypicked from jf-pickup-slot-changes for review and early merge
parent 15eba4c9
Pipeline #59555498 passed with stages
in 17 minutes and 4 seconds
......@@ -2,6 +2,7 @@
namespace Foodsharing\Controller;
use Carbon\Carbon;
use Foodsharing\Lib\Session;
use Foodsharing\Permissions\StorePermissions;
use Foodsharing\Services\StoreService;
......@@ -45,10 +46,11 @@ final class PickupRestController extends AbstractFOSRestController
private function getPickupIsConfirmedOrThrowException(int $storeId, string $pickupDate)
{
$date = \DateTime::createFromFormat(DATE_ATOM, $pickupDate);
$date = Carbon::parse($pickupDate);
if (!$date) {
throw new HttpException(400, 'Invalid date format');
}
$confirmed = $this->storePermissions->hasPreconfirmedPickup($storeId);
$this->throwExceptionIfNoSlotIsAvailable($storeId, $date, $confirmed);
......
......@@ -256,7 +256,7 @@ $('#timedialog').dialog({
width: 'auto',
buttons: {
'Eintragen': async function () {
const requestDate = ($('#timedialog-date').val()).replace(' ', 'T') + 'Z'
const requestDate = ($('#timedialog-date').val()).replace(' ', 'T')
try {
const result = await signup(store.id, requestDate)
u_clearDialogs()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment