Problem/Motivation
I'm trying to update lots of incorrectly "0" dates (actually 1/1/1970) to be empty.
When I do this I get an error:
Error: Call to a member function setTimezone() on null in Drupal\bulk_update_fields\BulkUpdateFields::processDate() (line 17 of /opt/bitnami/apps/drupal/htdocs/modules/contrib/bulk_update_fields/src/BulkUpdateFields.php)
That makes sense, since setTimezone() can't handle empty values but this is a use case that should really be supported.
Steps to reproduce
1. Create a node with a value in a date field.
2. Use the module to try and clear out that date field's value.
3. See the error.
Proposed resolution
I'd recommend wrapping the date formatting logic in an if(empty($date)) statement.
I did this in my environment and it solved the problem. I'm not able to navigate the waters to update the underlying source here though.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3177195-1.patch | 710 bytes | el1_1el |
Comments
Comment #2
el1_1el commentedComment #4
el1_1el commented