Closed (fixed)
Project:
Date
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2007 at 06:47 UTC
Updated:
26 Oct 2007 at 12:41 UTC
Hello
Unfortunately the year dropdown only reaches from 2004 to 2010. I need though a couple years before 2004. How could I increase the range?
Comments
Comment #1
ashtronaut commentedHey there,
I had this same problem myself and found a quick solution. I am sure there is a better way of doing it, but this is what I had come up with. . . . . .
First off, the way the module comes up with that default date range (2004 -2010) is it takes the current year and subtracts a pre-defined variable called years_back to get the lowest value, and adds a variable called years_forward to get the highest value. Essentially you need to edit those variables to adjust the range. Now there is a section of the module that allows you to edit these values, but I have not been able to find the UI for it, so I went into date.module and changed the default value manually. You will find this code under the date_widget_settings function .
'#default_value' => isset($widget['years_back']) ? $widget['years_back'] : 50,This sets the lowest year in the drop down to (Current Year) - 50
'#default_value' => isset($widget['years_forward']) ? $widget['years_forward'] : 0,This sets the max year to (Current Year) + 0
After you make these changes, save date.module and create your cck date drop-down field. . . .
Voila! There you have it.
Keep in mind that after these changes are made, it will only effect new date fields. You will have to delete the old field and re-create it for it to effect old fields. . . . . I hope that makes sense to someone. . . .
Comment #2
karens commentedNo need to hack the code. You have options for this in the field settings. Go to admin > content > content types, select the content type this field is on, select the tab to 'Manage Fields', and edit this field. You will see an option on how many years to go back and forth in the selector.
The screen and method for doing this has changed slightly in preparation for the next version of the Date API. It used to be hidden in a collapsible tab and you could select 'years back' and 'years forward'. Now it is no longer hidden, but you have a textbox where you put something like '-3:+3' for the years back and forward.
If you pick up the latest version, note that you need to do a database update.
Comment #3
(not verified) commented