-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 200 fix issue with creation of date only fields #201
base: master
Are you sure you want to change the base?
Issue 200 fix issue with creation of date only fields #201
Conversation
$date = new DateTime($value, $siteTimezone); | ||
$date->setTimezone($storageTimezone); | ||
$values[$key] = $date->format('Y-m-d\TH:i:s'); | ||
if (DateTime::createFromFormat('Y-m-d', $value) !== FALSE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this ever return FALSE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it returns FALSE when value is of datetime type e.g. 2017-04-02T05:00:00.
The reason the old code uses that format is that even for date-only fields, the actual storage has the entire date and time string. |
Yes this is what my understanding is. Ideally date-only fields should have been created with and without the timestamp but not happening with timestamp for me. Perhaps there is a change in Drupal core 8.6.x the way it handles the Date. |
Running into the same issue, I have a date only field but I can set the value:
field_date remains empty. This patch fixed the issue. |
Fix issue 200 (#200), an issue with the creation of date only fields