I have a date field which includes from_date and to_date.

When I create a calendar view, I can see this date field was separated into 2 fields, one is "from date" and another is "to date".

I choose only one which is "from date". however the SQL query it generates is like

**** AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_my_date.field_my_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-03' AND DATE_FORMAT(STR_TO_DATE(node_data_field_my_date.field_my_date_value2, '%Y-%m-%dT%T'), '%Y-%m') >= '2010-03'))

You can see although I didn't select "to date" when I add the argument, the "to date" (node_data_field_my_date.field_my_date_value2) is still used in the SQL query. The views still treat this field as a "Range" instead of a single date (from date).

My intention is to get all items which has "from date" in March, but the result is the view returns more items than it supposed to. As long as "from date" - "to date" covers any day in March, the items are returned. for example, "1/1/2010 - 4/1/2010".

This might not be a bug in Calendar module. Could anyone give me any hint how I can fix this?

Should I post this to Views issues?

Thanks!

Comments

xqi’s picture

Could someone take a look on this? Thanks

arlinsandbulte’s picture

what kind of display are you using?
What sort of view do you want?

I think the calendar module might automatically insert the to date for the calendar views.
For instance, if you are showing the calendar grid for the month of march, it can only place March events in the grid, so everything else is useless.

Maybe instead, you want an upcoming events view or something?

mojzis’s picture

Version: 6.x-2.2 » 6.x-2.4

I am having the same issue. The calendar worked fine until i added the optional to date ... now the calendar view doesnt show anything, and the second column is used in the where clause, even though i opted to work with the first one only.

xqi’s picture

eventually I had to break my date into two date fields with no end date...

brenes’s picture

This is what I am doing. I've got two seperate fields for from date and to date, cause I don't want the range from from date to to date displayed in my calendar view. I only want to have one date displayed (from date) in the calendar view. Probably this issues are related to each other http://drupal.org/node/833328

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The D6 branch is no longer supported so we're closing this issue. If you think this issue still exists in D7 you can open a new one.