I want to set up a weekly calendar using Date and Calendar modules. I need to set the default argument in Views to Week granularity so that it displays the weekly calendar. However, when viewing the view, the Date API throws this error at me:
recoverable fatal error: Object of class DateTime could not be converted to string in /home/ali30873/domains/my.site/public_html/sites/all/modules/date/date_api.module on line 1190.
I used the Devel module's dsm() function to take a peek at the object and it seems to be empty.
It only seem to be throwing this argument with the default argument set to the current date.
For example, if I go:
It throws up the error. But if I go:
http://my.site/testcalendar/2011-W5
It doesn't throw up any error.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | wrong_format_sent_to_date_week-1052586-11-D7.patch | 674 bytes | arlinsandbulte |
| #5 | 1052586.patch | 606 bytes | jpsolero |
Comments
Comment #1
DMacpherson commentedComment #2
mkahn commentedDitto. I have updated to the dev version of date 6.x-2.x-dev, and using php 5.2.
Comment #3
HallSL commentedSame here. I just updated Date and Calendar to most recent dev versions and am getting this error:
recoverable fatal error: Object of class DateTime could not be converted to string in /home/riverrep/public_html/sites/all/modules/date/date_api.module on line 1189.
The week that is defaulted to, using the current date, throws the error:
http://www.riverreporteronline.com/where-when
When the specific week is paged to, it's fine:
http://www.riverreporteronline.com/where-when/2011-W8
Comment #4
RKopacz commentedI am having same problem. Has solution been reported somewhere?
Need to get this fixed. I have rolled back to ver 2.7 to see if that works again.
Comment #5
jpsolero commentedI fix it with this code at date_api_argument_handler.inc
$week = date_week(date_format($now, 'Y-m-d'));
instead of
$week = date_week($now);
Seems its passing and object instead of the formated date.
Comment #6
akolahi commentedPatch in #5 fixed the issue for me
Comment #7
thedavidmeister commentedwow, this issue took me ages to find, but patch in #5 worked for me too, thanks!
Comment #8
samireez commentedPatch in #5 works great. Thanx!
Comment #9
svarco commentedsubscribe
Comment #10
jherencia commentedIt works for me too, it's been too long since @jpsolero posted this patch and no mantainer got into this, maybe it helps if we change the status to reviewed & tested by the community.
@svarco subscribe does not work anymore that way, now you can follow:
http://drupal.org/node/1306444
Comment #11
arlinsandbulte commentedThis looks correct to me.
And the same issue appears to exist in the D7 version of date too. Attached is a D7 patch.
Comment #12
arlinsandbulte commentedCommitted to D6 & D7 versions of date:
D6 commit:
http://drupalcode.org/project/date.git/commit/8f1f468
D7 commit:
http://drupalcode.org/project/date.git/commit/249e9a6