Deprecated function: DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated in Drupal\Component\Datetime\DateTimePlus::createFromFormat() (line 251 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).

Created on 14 April 2023, over 1 year ago
Updated 23 April 2023, over 1 year ago

Problem/Motivation

After update Drupal core to 9.5.7, places that are using a date field with date_time_day format, there is an error Deprecated function, because, a value date source doesn't exist and it returns as null type.

Steps to reproduce

Open an entity to edit or create where a date field is empty.

Proposed resolution

I attached a patch where add a ternary condition and if null then a value will be returned as an empty string.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Rachinskiy

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024