diff --git a/tests/features/asset_release/add_asset_release.feature b/tests/features/asset_release/add_asset_release.feature index 003ed53423..fdfebe281c 100644 --- a/tests/features/asset_release/add_asset_release.feature +++ b/tests/features/asset_release/add_asset_release.feature @@ -105,7 +105,6 @@ Feature: "Add release" visibility options. And I go to "/rdf_entity/http_e_f_fexample1regression/asset_release/add" Then I should see the heading "Page not found" - @javascript Scenario: Check publish time release is present time and past. Given the following owner: | name | type | diff --git a/tests/src/Context/JoinupContext.php b/tests/src/Context/JoinupContext.php index 643bce3c46..6ea044ea42 100644 --- a/tests/src/Context/JoinupContext.php +++ b/tests/src/Context/JoinupContext.php @@ -862,7 +862,7 @@ public function printMessages() { * Fills a date or time field at a datetime widget. * * Examples: - * - When I fill in "Start date" with the date "29-08-2016". + * - When I fill in "Start date" with the date "2016-08-29". * - When I fill in "Start date" with the date "+2 days". * - When I fill in "Start date" with the time "26:59:00". * - When I fill in "Start date" with the time "+1 hour". @@ -885,7 +885,7 @@ public function fillDateField(string $field_group, string $date_component, strin $is_relative_value = $date_component === 'date' ? preg_match('/^\d{2}-\d{2}-\d{4}$/', $value) === 0 : preg_match('/^\d{2}:\d{2}:\d{2}$/', $value) === 0; if ($is_relative_value) { - $value = date('d-m-Y', strtotime($value)); + $value = date('Y-m-d', strtotime($value)); } $field_selectors = $this->findDateFields($field_group); diff --git a/web/modules/custom/asset_release/asset_release.module b/web/modules/custom/asset_release/asset_release.module index e27b5bf81a..b23c31f3f7 100644 --- a/web/modules/custom/asset_release/asset_release.module +++ b/web/modules/custom/asset_release/asset_release.module @@ -354,7 +354,8 @@ function asset_release_form_alter(&$form, FormStateInterface $form_state, string */ function _asset_release_edit_date_validate(array &$form, FormStateInterface $form_state): void { $dt_now = new DateTime(); - $date_value = $form_state->getValue('created')[0]['value']; + $values = $form_state->getValues(); + $date_value = $values['created'][0]['value']; if ($date_value->format('c') > $dt_now->format('c')) { $form_state->setErrorByName('created', t('Your "Authored on" field date is greater than @date', ['@date' => $dt_now->format('c')])); }