I am trying to extend a year range of a popup calendar in drupal 7 but have been unable to see where I can do this.

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 don't seem to have this option at all when I go into my field settings.

I am using the date field and having it display as a popup calendar but cant find the year range setting anywhere - is there something else I need to enable to find this or has anybody else had a similar issue?

I'd be happy to even change some code in one of the files, but I havent been able to find the right one.

Many Thanks

  • Have you tried looking the js? Apr 1, 2014 at 5:33
  • Hi Prerit and thanks for the reply.I did look at the js but couldnt find the setting that I needed to change.Instead I ended up editing the dtae.field.ini file by changing the date range to -30-+30 which seems to have done the trick.
    – Simon
    Apr 2, 2014 at 21:22
  • Hi, I can elaborate this solution just a bit more. The date.field.inc file in the date module is updated as Simon suggests, above. Also, on your site, there is a corresponding update you want to make in the Calendar (Content) view. Open that view and on the right, under "Advanced", you have "Contextual Filters". Scroll down to where the same date range is given. Update it with the range you prefer. This filter is an override for Month, Week, Day, and Year views, so you have to make the same change for each. Save, and now even typing the year in the URL will send you there.
    – Diane
    Apr 17, 2018 at 18:53

2 Answers 2

  • Step 1 : Edit the file date_year_range.js located in this path : sites\all\modules\date\date_api\
  • Step 2 : Locate this line : Line 67 start = Math.min(this.getOriginal('int'), -n) n is the number you specified in your Drupal
  • Step 3 : Replace n with the value you want, for example for the field date of birth i want 60 years besfore today
  • Step 4 : Go back to your web site, edit the content type, then manage fields and change more settings and values of your date field.

Ensure that the widget type is "Select list" - then the range and increment settings appear when editing the field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.