Ajax error when date field has no time set

Created on 17 July 2025, about 1 month ago

Problem/Motivation

An AJAX HTTP error occurred when no time is filled by the user and an ajax is triggered in the form.

Steps to reproduce

On a clean Drupal 11 instalation:

  1. Install paragraphs module and create a paragraph type with the datetime_timezone field
  2. Install the media module and enable any media field into CT. e.g Basic page CT
  3. Now add at the Basic page the paragraph field created at 1 step
  4. try to create a Basic page, selecting the data into the paragraph, but without selecting a time.
  5. Now jump into media field and click into "Add Media" btn
  6. you receive erros into console and drupalmessage.

Proposed resolution

Ensures both date and time are set before creating a DrupalDateTime object. If date exists, it combines date and time into a string and initializes the object with the specified timezone. If date is missing, the value is set to NULL

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇧🇷Brazil igorgoncalves

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024