I use a datepicker field in a nested form and only want to save the date with this field.
However, I recognized that the time is save to the database nowadays. So I tested this setup in the fields.yaml of “Person” of the Playground plugin and added this beforeSave() method to see what arrives:
featured_info:
tab: 'test'
type: nestedform
showPanel: true
form:
fields:
featured_day:
label: 'TEST'
tab: 'test'
type: datepicker
mode: date
format: Y-m-d
public function beforeSave()
{
trace_log($this->attributes);
}
It turns out that the featured_day has the time instead of just the date which seems like a bug to me.
[2024-05-04 07:21:39] local.INFO: Array
(
[preferred_name] => Joey
[name] => Joe Dirt
[is_married] =>
[sports] =>
[hobbies] =>
[featured_info] => Array
(
[featured_day] => 2024-05-14 07:21:37
)
)
OctoberCMS 3.6.17