From d43866b4c21d9db871d9bf170300d5db5e4f2fac Mon Sep 17 00:00:00 2001 From: Marek Nocon Date: Mon, 18 Mar 2019 14:17:10 +0100 Subject: [PATCH] Change how the current set date is evaluated --- src/lib/Behat/PageElement/DateAndTimePopup.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/Behat/PageElement/DateAndTimePopup.php b/src/lib/Behat/PageElement/DateAndTimePopup.php index a4e74fa78c..cbf8588b6f 100644 --- a/src/lib/Behat/PageElement/DateAndTimePopup.php +++ b/src/lib/Behat/PageElement/DateAndTimePopup.php @@ -47,9 +47,7 @@ public function setTime(string $hour, string $minute): void if (!$isTimeOnly) { // get current date as it's not possible to set time without setting date - $currentDateScript = sprintf('document.querySelector("%s %s")._flatpickr.formatDate(document.querySelector("%s %s")._flatpickr.selectedDates, "Y-m-d")', - $this->fields['containerSelector'], - $this->fields['flatpickrSelector'], + $currentDateScript = sprintf('document.querySelector("%s %s")._flatpickr.selectedDates[0].toLocaleString()', $this->fields['containerSelector'], $this->fields['flatpickrSelector']); $currentDate = $this->context->getSession()->getDriver()->evaluateScript($currentDateScript);