Hello, I'm getting the following warnings on a fresh Drupal 7 Install with all the latest dev releases of the Views, Date, Ctools, and Calendar modules. I noticed there was a similar issue already posted but it's status is closed. Any help is appreciated.

    Notice: Undefined property: stdClass::$field_data_field_trade_show_date_field_trade_show_date_value2 in calendar_build_nodes() (line 687 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/calendar/calendar.module).
    Warning: DateTime::getTimezone() [datetime.gettimezone]: The DateTime object has not been correctly initialized by its constructor in DateObject->__construct() (line 169 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::format() [datetime.format]: The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::setTimezone() [datetime.settimezone]: The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 222 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::setDate() [datetime.setdate]: The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 223 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: DateTime::setTime() [datetime.settime]: The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 224 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/date/date_api/date_api.module).
    Warning: date_format() [function.date-format]: The DateTime object has not been correctly initialized by its constructor in calendar_build_nodes() (line 718 of /Applications/MAMP/htdocs/drupal_7_test2/sites/all/modules/calendar/calendar.module).

Comments

acbramley’s picture

I'm also getting similar errors.

acbramley’s picture

Priority: Normal » Critical
Warning: DateTime::getTimezone(): The DateTime object has not been correctly initialized by its constructor in DateObject->__construct() (line 169 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format() (line 238 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::setTimezone(): The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 222 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::setDate(): The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 223 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: DateTime::setTime(): The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 224 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/date/date_api/date_api.module).
Warning: date_timezone_set(): The DateTime object has not been correctly initialized by its constructor in calendar_build_nodes() (line 716 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/calendar/calendar.module).
Warning: date_format(): The DateTime object has not been correctly initialized by its constructor in calendar_build_nodes() (line 718 of /var/aegir/platforms/mohbigbird/sites/all/modules/contrib/calendar/calendar.module).

These are my errors. I need to use this module without errors for my clients. All I did was clone the calendar view, and change the iCal feed filter to use my date cck field instead of "Updated date"

KarenS’s picture

Status: Active » Closed (cannot reproduce)

Cannot reproduce this problem in 7.3.

yelvington’s picture

Version: 7.x-2.x-dev » 7.x-3.0-alpha1
Status: Closed (cannot reproduce) » Active

I have this problem on 7.x-3.0-alpha1, but what I've noticed is that it's specifically related to nodes that were imported from a csv file using Feeds, and is triggered by Views.

Symptoms:
* Hundreds of errors of the form "Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in DateObject->format()" The date_api.module line numbers vary but most refer to line 241 or 172.
* The imported nodes do not appear in the calendar.
* Individually, the imported nodes seem to display correctly.
* Editing a node, then saving it, seems to fix the problem for that node. It then appears in the calendar view.

Nodes that are created manually are just fine.

All of this makes me wonder whether the dates are being imported in the right format: yyyy-mm-dd hh:mm

I'm reopening this rather than creating a new issue, as the earlier posters may have some insight as to how their nodes were created.

videographics’s picture

For what it's worth, I'm seeing the same errors and they go away when I disable Calendar 7.x-3.0-alpha1. It's not a clean install but I thought this might be worth noting anyway. I don't have any imported data.

videographics’s picture

Correction: It seems to persist even with Calendar 7.x-3.0-alpha1 disabled. (missed some watchdog entries)

Warning: DateTime::setTime() [datetime.settime]: The DateTime object has not been correctly initialized by its constructor in DateObject->setTimezone() (line 225 of /example.com/sites/all/modules/date/date_api/date_api.module).

So, should this be kicked over to the Date module queue?

videographics’s picture

Priority: Critical » Normal

If one considers #7 and #5, it seems likely that we're both just looking at bad data triggering these errors and the modules involved are just fine in this regard. (Best to get back to testing from clean installs, huh?) Sorry for creating any unnecessary distractions.

But, this does bring up the point that if it's common to find poorly formed data in a particular field (whatever the source), it might be beneficial to try to come up with a graceful way to handling it.

KarenS’s picture

Status: Active » Closed (duplicate)

This is probably a duplicate of #1366770: Having non-date data in date field breaks cron and most pages. When you force bad data into fields you're going to get bad results. I'm not really sure how much work Date needs to do to 'fix' things when you do that.

kq_sb’s picture

See https://www.drupal.org/node/2902201
Could also be caused by NULL end date (value2).