I'd like to create a view that displays nodes for the current academic year, ie. on 6/30/2011, it'd display everything posted 7/1/2010-6/30/2011 and then on 7/1/2011, it'd display just 7/1/2011. I'm trying to get it so that one would not need to have to edit the view every year.

Comments

malcomio’s picture

My first thought was that some PHP in a default argument would do the job, but an argument needs to only return one value.

How about a computed field returning a boolean to say whether the node was posted

You can use mktime

$start = mktime(0,0,0,7,1);
$finish = mktime(0,0,0,6,30);

You'd then need to compare your node date with start and finish, and return true if it's within that range.

Then you can filter the view on your computed field value.

Not sure if computed field only updates on node updates, though.

Also this sounds similar, but not quite: http://drupal.org/project/views_daterange

dawehner’s picture

http://drupal.org/project/views_date_range_filter is perhaps for you too.

Alternative i can recommend you #731662: Hybrid Exposed Filters

iamjon’s picture

Status: Active » Closed (fixed)

macpharmer,
did you ever find a solution for this?
please update so others may benefit.
feel free to reopen the issue with more information and to address the comments above.

closing from a lack of activity.