Skip to content

[6.x] Fix single-mode date fieldtype crashing when saving with a time#14880

Open
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/single-mode-date-time-save
Open

[6.x] Fix single-mode date fieldtype crashing when saving with a time#14880
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/single-mode-date-time-save

Conversation

@mynetx

@mynetx mynetx commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Saving an entry with a single-mode date field whose format includes a time throws a TypeError. The CP submits the value as a ['date' => ..., 'time' => ...] array, but processSingle() passed it straight to Carbon::parse(), which can't parse arrays. This hits the default date field, since the default save format (Y-m-d H:i) makes formatHasTime() true regardless of time_enabled.

This combines the date and time into a single string before parsing.

Fixes #14860

The Control Panel submits a single date that includes a time as a
['date' => ..., 'time' => ...] array, but processSingle() passed it
straight to Carbon::parse(), which throws a TypeError on arrays. This
hit the default date field, whose default save format (Y-m-d H:i)
makes formatHasTime() true regardless of time_enabled.

Combine the date and time into a single string before parsing, and
treat a missing date as an empty value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant