The situation: I have a drupal 7 node which has a date field. This uses the date module and it has multiple values each with a start and end date.
The problem is that I want to query drupal for all nodes where the current date is between the start and end dates of a single delta.
The entity query I have at the moment doesn't check the same value for both start and end dates.
For example if the first date value started 1/1/2013 and ended 30/1/2013 and if there was a second value which started 1/12/2013 and ended 30/12/2013. Using the current date of today 11/10/2013 this node should NOT be fetched. However under the query below it is because there is a start date in the past and an end date in the future, even though they're not from the same field delta.
$current_date = date("Y-m-d"); $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', RD_PRIZE_DRAW_NODE_TYPE); ->fieldCondition('field_rd_prize_draw_dates', 'value', $current_date, '<=') ->fieldCondition('field_rd_prize_draw_dates', 'value2', $current_date, '>='); ->execute();