views exposed filter on non existent field I have a content type which has the following fields:


month: List (integer) [jan, feb, ..., dec] (non mandatory)
year: Date (only collects year - mandatory)


I can normally create two exposed views filters, one for the month and one for the year.

What I'd like to do though is have a single exposed filter which, internally, would operate on the two fields above at once.

For example if the operator is "Is Between" and the user selects Oct 2011 to Feb 2012 I'd like the filter to return only nodes which have:


2011, Oct
2011, Nov
2011, Dec
2012, NULL month
2012, Jan
2012, Feb


Note that I've used two fields (month and year) instead of one so I can have the possibility of a monthless node.

What approach should I take? I've thought of the following:


use a third field which, on hook_node_presave will store the calculated (filter specific) date on the node. I wouldn't like this field to be visible on the edit node screen though
somehow (using a hook) calculate and rewrite the view filtering query. My problem here is how to display an exposed filter for a field which does not exist
The most obvious solution to me would be to get the month data into the date field, since you are treating the date to be 1/1 when no month is given, this would fit just fine; there is no reason to create a new field for this.

You should be able to do this in a form submission handler for the node edit form.