Hi.

I tried to activate the date changer on my site, but any combination of month/day/year always results in the path being */calendar/0000-00

For example, if I change it to March 1, 2010, I'm expecting the path to be */calendar/2010-03, but it just takes me to */calendar/0000-00

Has anyone else experienced this?

My calendar is at http://www.cultureblast.ca/calendar, but I have disabled the date changer because it doesn't work for me and I don't want visitors to get frustrated with it.

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mdupont’s picture

Same issue here, every time I apply changes to the date changer (using date_select widget), the argument is always set to 0000-00 in the URL. Date argument is with month granularity, so the format is OK, but it seems the validation doesn't succeed with date_select.

mdupont’s picture

Title: Date changer always changes to 0000-00 » calendar_views_query_alter() doesn't convert the date when the date changer is a date_select element

Update : I think I nailed the culprit : the function calendar_views_query_alter() in the file calendar.views.inc.

How to reproduce : Use a calendar with, as argument, a date field not using the Date Popup. Make sure that the module Date Popup is disabled in admin/build/modules. Activate the date changer. You will see the date changer appear as a date_select element (dropdown lists) following the "short" date format. Good. Now try to change the date. The argument will always be a bunch of 0s (0000-00 on a month view, 0000-00-00 on a day view, etc).

It seems that the structure of $form['calendar_goto'] is different depending on the kind of date selector used. In the code I can see operations on $_POST['calendar_goto']['date'], which exists in a date_popup element but not in a date_select element. With date_select, the values are $_POST['calendar_goto']['year'], $_POST['calendar_goto']['month'], $_POST['calendar_goto']['day'], etc, which are the value that should be processed and converted into ISO 8601 format. As $_POST['calendar_goto']['date'] doesn't exists, the result is an ISO 8601 formatted bunch of 0s.

For the moment I made a quick and dirty hack in calendar.views.inc to get the right argument (in my case, year and month):

  $arg = $_POST['calendar_goto']['year'] . '-' . date_pad($_POST['calendar_goto']['month']);

I'll try to make a proper patch when i'll have time.

mdupont’s picture

Status: Active » Needs review
FileSize
1.03 KB

Here is a quick patch checking for $_POST['calendar_goto']['date'] and adapting the $date variable depending on the result. Works for me®, please review.

mdupont’s picture

WTF, in the rush I used array_key_exists() as isset(). Here is the fixed version.

kostajh’s picture

FileSize
1.13 KB

Patch in #4 worked, I re-rolled it against the latest 6.x-2.x code.

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Needs review » 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.