Skip to content
Snippets Groups Projects
Commit eb871ba5 authored by Zan Vidmar's avatar Zan Vidmar Committed by zanvidmar
Browse files

Issue #3445775: validateEntityFields is not correctly transforming date field values.

validateEntityFields() is not correctly transforming date field values for
datetime type "date" fields (it works as designed for "datetime" type only).
To fix the issue correct date format is applied for date only fields.
parent 2575e00c
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,12 @@ trait EntityTrait {
// Make sure we store them as UTC, so we don't have any scenarios where
// system time influences behat test.
$date = new DrupalDateTime($values[$field_name], 'UTC');
$values[$field_name] = $date->format('Y-m-d\TH:i:s');
if ($field_definition->getSetting('datetime_type') === 'date') {
$values[$field_name] = $date->format('Y-m-d');
}
else {
$values[$field_name] = $date->format('Y-m-d\TH:i:s');
}
}
// Created and changed fields are stored as a normal timestamp but require
// the same human-readable input as datetime fields.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment