- Drupal 6.19
- PHP 5.2.14
- MySQL 5.1.39
- Date 6.x-2.x-dev (August 14)
I have a node type with a CCK date field. In a View, I want to display all nodes where that date field is set to a given week. So I created an Argument with a default value of Current Date. But when the argument isn't supplied, it looks for nodes from LAST week instead of THIS week.
For instance, today, August 17, the Views query includes this:
AND ((STR_TO_DATE(node_data_field_week.field_week_value, '%Y-%m-%dT%T') <= '2010-08-15 00:00:00' AND STR_TO_DATE(node_data_field_week.field_week_value, '%Y-%m-%dT%T') >= '2010-08-08 00:00:00'))
I tried hacking a workaround by having the default argument be PHP with a value of
return date('%Y-%m-%dT%T', strtotime('next Sunday'));
but then the query is even more broken:
((DATE_FORMAT(STR_TO_DATE(node_data_field_week.field_week_value, '%Y-%m-%dT%T'), '') <= '' AND DATE_FORMAT(STR_TO_DATE(node_data_field_week.field_week_value, '%Y-%m-%dT%T'), '') >= ''))
I'm pulling my hair out over this; am I doing something wrong or is this a bug?
Comments
Comment #1
arlinsandbulte commentedDuplicate of #686394: Default of current time is off by one week for granularity of week
That is currently a Calendar issue, but it might very well actually be an issue with the date module.
Comment #2
lanny heidbreder commentedUnbelievable. I read that entire thread two days ago when looking for an answer to a completely separate problem.
Thanks for the pointer and sorry for the dupe.