Hello, i'm trying to set the default date as today's date for my exposed filter.

But i can't find how to do it (i don't want to use relative value, so i don't see where to set the default value?)

I've attached a screenshot of the filter windows...
I want to display nodes of a certain type that have a date field called dateEvent.
The node displayed should have the date set in the dateEvent field greater or equal to today's date by default. The user can edit the date set in the filter (which is a text filter)

Files: 
CommentFileSizeAuthor
dateFilter.png25.48 KBWilliamB

Comments

My field is called datepickerHidden.

I've overloaded the form_alter method

<?php
if (empty($form_state['view']->exposed_input['datepickerHidden'])) {
   
$form_state['input']['datepickerHidden'] = array('value' => array('date' => date('d/m/Y',time())));
}            
$form['datepickerHidden']['value']['#attributes'] = Array ( 'class' => Array ('txt'));
$form['datepickerHidden']['value']['#date_format'] = 'd/m/Y';
?>

To put the date in the d/m/Y format and add a default value, however i've issue with the pager with is built: http://mysite/mypage?datepickerHidden[value]=2012-01-24&page=1

2 issues:
- the link is missing [date] after datepickerHidden[value] which makes views not take into account the value.
- The date is using the wrong format: 'Y-m-d' instead of 'd/m/Y' that i could find a work around but not the first point.

when i enter today's value manualy in the filter, the pager link is built correctly:
http://mysite/mypageagenda?datepickerHidden[value][date]=24/01/2012&page=1

The bug sorta occurs also in the backoffice.
If i enter today's date in the exposed field and i submit, the list will display the 5 first correct results.
However if i click on the pager : http://mysite/mypage#overlay=admin/structure/views/nojs/preview/agenda/p...
The list suddenly display older nodes, and the pager goes from 2 pages (6 entries should be returned, 5 by page) to 5+ pages (bringing back ALL nodes of that type regardless of the value of their date field)

Thanks in advance for any help....

Status:Active» Fixed

You don't need to write any custom code. There are two options in the filter settings: "Select a date" to select a specific date, or "Enter a relative date" which will give you a textfield where you can use things like 'now'.

Status:Fixed» Active

The thing is, it's an exposed date filter.
I want the user to be able to write another date in a dd/mm/yyyy format (not a relative date)
And i want the default date to be equal to today's date.

How can this be done?

Status:Active» Fixed

Set the default as a relative date (for 'today'). If you make it an exposed filter the user will still get the option to choose a date, the default is just the ... default.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Active» Closed (fixed)

KarenS, i'm sorry for reopening this, but even with default date being relative equal to now, the pager links still misses [date] after datepickerHidden[value] which makes views not work correctly.

If i select a date then the [date] bracket is added and works fine but by default it's missing, even in the back office:

http://www.mysite.com/mypage/#overlay=admin/structure/views/nojs/preview...

If i add [date] before [value] the page would work fine, or if i remove the value of the date after the =, 2012-05-09, it works also fine ...

Status:Closed (fixed)» Active

Status:Closed (fixed)» Active

I'm having this issue as well, with Views 3.5 and date 2.6. I have an exposed filter with a default date of "now" -- if I do not click the "apply" button however, the link to the next page does not contain the correct filters.
http://mysite.com/shows?field_show_attr_date_date_value[min][year]=2013&field_show_attr_date_date_value[min][month]=1&field_show_attr_date_date_value[min][day]=25&field_show_attr_date_date_value[max][year]=2014&field_show_attr_date_date_value[max][month]=1&field_show_attr_date_date_value[max][day]=25&field_show_attr_categories_tid=&title_1=&field_show_attr_venue_related_nid=All&title=&page=1
Is what happens if I hit "apply" and then change the pager.
http://mysite.com/shows?field_show_attr_date_date_value[min]&field_show_attr_date_date_value[max]&field_show_attr_categories_tid=&title_1=&field_show_attr_venue_related_nid=All&title=&page=1
Is what I get if I do not click the "apply" button.

Also, this issue seems similar, but I'm not sure if it is a duplicate or not...
#1271726: Issue with pager and exposed text date filter in views

I am facing the same issue, if default value is set in exposed date filter pagination don't work properly. Any solution, please help!