I have a custom content type with a Date field that has an optional To and it's a Datetime type. I've created a view with three displays: Current, Upcoming, and Past. The filters that I've setup are:
Content: Date (field_date) - From date AND Content: Date (field_date) - To date < now
Content: Date (field_date) - From date OR Content: Date (field_date) - To date between now -1 day and now +1 day and now -1 day and now +1 day
Content: Date (field_date) - From date AND Content: Date (field_date) - To date > now
I did go through each of the Troubleshooting steps listed on the project page, and tried the suggestions here: http://drupal.org/node/235434 and here: http://drupal.org/node/375551, to no avail...
Once I view the page I created, I see this:
warning: date_format() expects parameter 1 to be DateTime, boolean given in .../modules/date/includes/date_api_filter_handler.inc on line 319.
I've resaved the CCK fields and View filters a number of times, but nothing seems to work... I'm not sure where else to go from here... A bazillion apologies if this is a CCK or View issue... Given that the error reference the date module specifically, I figured this was the place to go, but it's also my first time posting an issue, so be kind...
Comments
Comment #1
celadon commentedI am getting exactly the same message, only it's showing up in the log, not on the page (I'm using a block display within Composite to display the view).
This has been going on for a long time, but since the view still shows, I have not bothered to try to figure out why. The field and view seem to be set up normally. Here's an example page with the view that generates the error: http://www.maia-arts.com/music/events
Here's the view I'm using (below)
thanks!
Comment #2
shiva7663 commentedSubscribe.
Comment #3
PeterErnst commentedSubscribe
In my case, the same error occur after a update from Date 6.x-2.0 to 6.x-2.4.
Permanently the following Error is displayed:
warning: date_format() expects parameter 1 to be DateTime, boolean given in /var/www/my_folder/sites/all/modules/date/includes/date_api_filter_handler.inc on line 319.
I tried the proposed fix-workflow incuding:
- Edit my date fields
- Go to the Manage fields screen for each of your date fields and edit the date field
- double-check that the values all look reasonable, and re-save it
- go to the Display fields screen, double-check all the settings there, and re-submit that screen.
- update to the latest development version
- rerun update.php multiple times
- rerun empty cache multiple times
The Error is still there. But it doesn't show up only once per page, the frequency depend on the following:
- If the system displays a page ore something without a date field, the error is displayed once
- In case of a view, the error is displayed once plus a multiple time depend on the amount of used date-fields
But in general: the view displays the results proper, only the error occurs.
Comment #4
pixelpreview@gmail.com commentedsame problem with a node with a cck date field
I can't save the value from these field
and I have a lot of warnings in my logs
date_timezone_set() expects parameter 1 to be DateTime, boolean given .... line 482
date_format() expects parameter 1 to be DateTime, boolean given ... line 492
date_create() expects parameter 2 to be DateTimeZone, boolean given ...
Comment #5
shaneonabike commentedSubscribe
Comment #6
jaarong commentedsubscribe
Comment #7
abowers commentedI ran into this problem today, with the error showing in my log, but my view showing up perfectly. I am using Date 6.x-2.4, and have been for a while. What happened was that in the Views date filter, I was using 'now() - 10 minutes' instead of 'now - 10 minutes'. Once I removed the parenthesis, the error went away (go figure!). This is what my successful filter looks like in case it helps:
I would try changing your date filter to just use 'now' in the Date default box, and see if your error goes away. If it does, then maybe it is something you are putting in that box that date_create doesn't understand.
Good luck!
Comment #8
c-gundo commentedi have the same error message with a cck date field when i create or edit the node and just one time after saving them.
as i see, the first parameter for the date_format() function is not in the good format.
in my case, $date (the first parameter) is like "07/05/2010"
if i force $date to be
in date_api.module, line 651
$date = date_create('2010-05-07');the error disappears but the field is always the same value :-)
this is not the solution
but it seems to be the origin
Comment #9
emilyf commentedI have this same issue where it's dumping this error message to my logs, but my view displays just fine. I echo the statement that I'm not clear on if this is a date or views issue, but if it's possible for a developer to respond as to which module this needs to be reported to that would be really helpful.
In my case, I have a views date filter on year, but by default I need it to return all results. For some reason it wasn't working to leave it empty, so I had to set the default to be 'null' in the view. I am on the latest date-dev, calendar-dev and views-2.10.
Below is my views code:
Comment #10
yannick menard commentedsubscribe
Comment #11
dww#518816: warning: date_format() expects parameter 1 to be DateTime
In particular, I believe #518816-5: warning: date_format() expects parameter 1 to be DateTime would also fix the bug originally reported here about exposed views filters (although I haven't tested that myself). The bug reported in #8 above is definitely fixed with the patches in the other issue...
Comment #12
sonicthoughts commentedI have this same error on 2.7. spent several hours trying to figure out and it looks like it was resolved but patches were committed. perhaps its related to PHP versions?
Error is:
warning: date_format() expects parameter 1 to be DateTime, boolean given in drupal/sites/all/modules/date/includes/date_api_filter_handler.inc on line 324.
Filters:
Date: Date (node) Content: Zmanin Date (field_zamin_date) <= now + 7 AND
Date: Date (node) Content: Zmanin Date (field_zamin_date) >= now
Just trying to make a weekly view (actually this isn't the logic i want - need to use week number - but i'd like to get this far at least :))
Comment #13
maxmendez commentedHi, I have a same warning
Warning: date_format() expects parameter 1 to be DateTime, boolean given in date_api_filter_handler->default_value() (line 324 date_api_filter_handler.inc)I use Date 6.x-2.7
Comment #14
maxmendez commentedThis problem it's php, when sending the first parameter with spaces on the date_create function, to eliminate the possibility that this error occurs, I think the line 313 in the file date_api_filter_handler.inc should be modified as follows :