I would like to extend the year range in the jquery popup date picker.
Currently it allows me to choose between 2011 and 2017 but I need a much larger range.

I have checked all settings within Drupal but cannot see a way to do it and I'm not sure which file to look at on the sever.

Does anyone have a short answer to this? 3 years either way from the current year seems very limiting.

Thanks in advance.

Comments

nevets’s picture

Are you using it as part of a date field? If yes, when you configure a date field you can select the relative range for the year.

hallswah’s picture

Hi and thanks for the reply,

Yes I have a content type with a field that I have named 'Last Reviewed' using Date and using the datepicker widget.
If I go back into the field I only see options for formatting but not how to extend the actual year range further.

I did also change the date_popup.module file in the main Drupal 'Date' module so that the date_year_range is extended to 10 as below, but no joy:

function date_popup_element_info() {
  $timepicker = date_popup_get_preferred_timepicker();
  $type['date_popup'] = array(
    '#input' => TRUE,
    '#tree' => TRUE,
    '#date_timezone' => date_default_timezone(),
    '#date_flexible' => 0,
    '#date_format' => variable_get('date_format_short', 'm/d/Y - H:i'),
    '#datepicker_options' => array(),
    '#timepicker' => variable_get('date_popup_timepicker', $timepicker),
    '#date_increment' => 1,
    '#date_year_range' => '-10:+10',
    '#date_label_position' => 'above',
    '#process' => array('date_popup_element_process'),
    '#value_callback' => 'date_popup_element_value_callback',
    '#theme_wrappers' => array('date_popup'),
  );

Am I missing anything else ?

nevets’s picture

The date field does not allow changing its settings once the field has data.

As for modifying date_popup_element_info() all you are doing is changing the default values for the options. If they are other wise set (for example by the date field) they are not used.

hallswah’s picture

Hello again,

I deleted the original field and re-created it but I still dont see where the option is to change the year range.
I went into 'Manage Display' for the field but I only see options for formatting the display.

After doing more research, I discovered that I can change it through the 'More settings & values' option in the field settings which I have seen in other people's screen shots except that I dont seem to have this option at all.

Is there something else that I need to do to enable this?

Thanks again.

hallswah’s picture

Hi there,

I wasn't able to see any front end solution so I edited the date.field.ini file and made the year range +30 to -30.
I had to remove the original field that I had set up and create a new one but it now works after making that change.

hiramanpatil’s picture

Check 'Ending year' drop-down on your date field settings page.

You can select 'Other' option in that drop-down and enter numbers of years you want to show in drop-down. If you entered 50 then it will show till 2062 (+50 years from current year.)

Thanks

josueValRob’s picture

thanks, it was really easy

zrtech’s picture

Edit the date field you would like to extend the date on. Once you are in the Edit tab and view, at the bottom of the User Settings fieldset/section you will see a MORE SETTINGS AND VALUES link. Click on that, then choose other from the Starting year and Ending year options and you can enter your own year to begin and end at. If for some reason you do not see this option, it may be possible that installing https://www.drupal.org/project/date_range_formatter will assist you. It took me a while to figure this out for myself, so hope this helps anyone else that runs into this problem.

Good luck!
"Z" - Zahir Narsisto Rodulfo
ZRTECH - ITS/Prjct Mngr/Grphx Dsgnr
www.zrtechnologies.com

gmangones’s picture

Hello, I want change settng o value -3 + 3 default by -1000 +0, but are there information in node, I cant change.
I do i do?