Hey Karen and company,

I just installed the awesome Date module (6.x-2.1) and created my first date CCK field (CCK-6.x-2.2). When I save a node that has the date field, I'm getting the following error/warning message:

* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /home/bknew/public_html/sites/all/modules/date/date_api_ical.inc on line 568.
* warning: date_format() expects parameter 1 to be DateTime, null given in /home/bknew/public_html/sites/all/modules/date/date_api_ical.inc on line 654.
* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /home/bknew/public_html/sites/all/modules/date/date_api_ical.inc on line 568.
* warning: date_format() expects parameter 1 to be DateTime, null given in /home/bknew/public_html/sites/all/modules/date/date_api_ical.inc on line 654.

Any ideas on what could be the problem? I'm using a Drupal 6.10 install....

Thanks a million,
Ben

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arlinsandbulte’s picture

Status: Active » Closed (duplicate)

Duplicate of #409476: date_timezone_set() & date_format() error when editing CCK date repeating fields.
I think this has been fixed in the latest 6.x-2.2 release.

tlangston’s picture

Not fixed. I've installed the latest version and am still hitting this error. Note the module referenced in the string is Calendar. Is this related?

* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/theatricalsinger.com/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/theatricalsinger.com/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.

sparker888’s picture

Same problem here. I'm getting these errors with the latest module releases:

* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in C:\wamp\www\acquia-drupal-1.2.9\modules\acquia\calendar\includes\calendar.inc on line 414.
* warning: date_format() expects parameter 1 to be DateTime, null given in C:\wamp\www\acquia-drupal-1.2.9\modules\acquia\calendar\includes\calendar.inc on line 416.

Subscribing

laken’s picture

Version: 6.x-2.1 » 6.x-2.2
Status: Closed (duplicate) » Active

Confirmed still a problem in 6.x-2.2 - I'm getting the identical error to #2 and #3 in a fresh install of Acquia Drupal 1.2.11

Date 6.x-2.2
Calendar 6.x-2.1
CCK 6.x-2.4
Views 6.x-2.6

We're seeing this regardless of whether user is logged in or not.

kepford’s picture

I am getting this error as well. The error only appears on Calendar pages where a node is listed in the view.

* warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/citd/sites/all/modules/calendar/includes/calendar.inc on line 414.
* warning: date_format() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/citd/sites/all/modules/calendar/includes/calendar.inc on line 416.

Drupal 6.12
Date 6.x-2.2
Calendar 6.x-2.1
CCK 6.x-2.2
Views 6.x-2.6

Seeing it for both anonymous users and authenticated users as well

kepford’s picture

I was able to get rid of the error by adding the date field that is in the argument and then excluding it from display. Not sure why this worked but thought I would post it. Hope this helps someone.

So my argument date was a CCK date/time from field. I only wanted to display the node title in the calendar view. This threw the error. When I added the date/time field to the fields the error went away.

nicholas.suter’s picture

Hello people,

I've been trying to work around this issue too (as a user, not a developer). My configuration :
- CCK 6.x-2.4
- Views 6.x-2.6
- Calendar 6.x-2.1
- Date 6.x-2.2
- Drupal 6.13

I get this error when displaying a calendar block, calendar page or a node based on my content type created with the Date Tools. This error appears with all users except Admin (user #1), and happens when my principal date has an end date.
I tried deleting a recreating my date content type, using only dated without hours and minutes and deactivating all timezone options.

When I modify my principle date so it doesn't have an end date, there is no error, but my date is never displayed (but the body of the node is) unless I log in as Admin.

EDIT : problem solved my end... by simply deactivating CCK content permissions module. My users probably didn't have the necessary rights for something or another (something with time fuses ?)

Alan D.’s picture

Thanks bobkepford.

Yep, looks like a dependency of the date field to be in the views field list. See #6: http://drupal.org/node/463052#comment-1728502

swellbow’s picture

This may not help anyone, but I was getting the same four errors when submitting new data for a content type using a date field -- for anonymous users. I reduced it to a new content type with only title and the one date field and still got the error. On a hunch while studying the stack, seeing that Mollom was in the stack, I changed Mollom settings for that form to CAPTCHA only (instead of CAPTCHA and text analysis) and the problem went away. I think Mollom is trying to format the date for analysis and for some reason something gets mixed up. The stack was quite tall and a bit beyond my ability to deduce, but I would be happy to copy the stack here if it helps.

caschbre’s picture

Ditto on my end here. I also disabled the CCK content permissions module to get around the issue.

Anonymous’s picture

Project: Date » Mollom
Version: 6.x-2.2 » 6.x-1.9
Component: Date Timezone » Code

Thanks, swellbow, setting the form to 'CAPTCHA only' fixed it for me. Reassigning this issue to the Mollom project, let's see what they say.

Dave Reid’s picture

I'll look into this on the Mollom end. Can someone show me the exact steps I would need to reproduce this?

caschbre’s picture

I'm not using Mollum so I'm not sure I'd say it is an issue with that project.

Anonymous’s picture

caschbre, please send it back into the CCK/Date issue queue if you are getting the warning without Mollom. Since the warnings on my site are definitely caused by Mollom, I opened a new issue at #526024: date_format() warning on line 356.

caschbre’s picture

Project: Mollom » Date
Version: 6.x-1.9 » 6.x-2.2

reassigning back to date. I think I did it right.

doknet’s picture

Title: * warning: date_timezone_set() expects parameter 1 to be DateTime, null given » just leave a relase will fix this problem calendar.2.2

just leave a relase will fix this problem calendar.2.2

arlinsandbulte’s picture

I *think* this is now fixed with the latest date/calendar modules as of 9/15/09.
Can someone confirm?

kate’s picture

I was using the latest development versions of date and calendar and I saw these errors when an authenticated user tried to create a new content type that had a datetime field.

Following the instructions in #9 from swellbow (thanks swellbow!!!) fixed this for me. I just changed my mollom setting for that form to captcha only and now I don't see any error messages.

arlinsandbulte’s picture

Title: just leave a relase will fix this problem calendar.2.2 » warning: date_timezone_set() expects parameter 1 to be DateTime, null given
Status: Active » Fixed

I am going to mark this as fixed for now.
I renamed the title back so it can be found more easily if someone else happens to run into this problem again.

I know there is at least one other issue with the same or similar error... (some_function expects parameter 1 to be DateTime)
They are probably all related.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.