Alpha widget throws exception when end date is before start date

Created on 10 June 2022, over 2 years ago
Updated 8 March 2023, over 1 year ago

Problem/Motivation

Alpha widget doesn't show error, crashes the site when invalid dates are selected

Steps to reproduce

* Enable Alpha widget
* Set end date to appear before the start date
* Save the page
* Exception is rendered, instead of a form error message

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: End date must not occur before start date. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 811 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal\date_recur\DateRange->__construct(Object, Object) (Line: 29)
Drupal\date_recur\DateRecurNonRecurringHelper->__construct(Object, Object) (Line: 36)
Drupal\date_recur\DateRecurNonRecurringHelper::createInstance('', Object, Object) (Line: 451)
Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem->getHelper() (Line: 366)
Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem->preSave() (Line: 233)
Drupal\Core\Field\FieldItemList->delegateMethod('preSave') (Line: 191)
Drupal\Core\Field\FieldItemList->preSave() (Line: 937)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('preSave', Object) (Line: 887)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object) (Line: 567)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 756)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 521)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 802)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 270)

Proposed resolution

* Add better date validation to the widget

πŸ› Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States makbeta

Live updates comments and jobs are added and updated live.

Missing content requested by

πŸ‡¦πŸ‡ΊAustralia dpi
about 1 year ago
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024