Problem/Motivation
It looks like the same error that occurred in D7
#3070150: PDOException when submitting a date after Jan 18, 2038 →
is happening now in D9/10.
Steps to reproduce
On a standard profile drupal 9/10 install:
- Enable publication_date
- Go to /node/add/article, fill in title (required) and set the "Published on" field to e.g: 01/01/2040 01:00:00 AM
- Hit save and we get the following error
Drupal\Core\Entity\EntityStorageException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'published_at' at row 1: INSERT INTO "node_field_data" ("nid", "vid", "type", "langcode", "status", "uid", "title", "created", "changed", "promote", "sticky", "default_langcode", "revision_translation_affected", "published_at") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => article [:db_insert_placeholder_3] => en [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => qdqsd [:db_insert_placeholder_7] => 1679403104 [:db_insert_placeholder_8] => 1679403802 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 1 [:db_insert_placeholder_12] => 1 [:db_insert_placeholder_13] => 2208992400 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Proposed resolution
PublicationDateItem extends TimestampItem which defines a range (min/max) contraint in its annotation.
I'm guessing these contraints are therefore not inherited?
See if we can inherit the contraints from TimestampItem, otherwise redefine it.
Remaining tasks
Provide patch
User interface changes
?
API changes
?
Data model changes
?