This is a carry over from #71131-45: Add popup calendar to date component.

is it possible to change the default year range of 3 years either side of the current year? The year fields already exist in the configuration for the date field but the popup seems to ignore them.

This is very similar to #301949: Add option to only allow dates in the past/future, only it just applies to years. It's also a trivial implementation, since we basically just need to allow a -/+ in front of the year and then assume that's a relative date instead of a hard date. It may also change my thinking on #301949: Add option to only allow dates in the past/future, since this would be easier generally to work with than my suggested approach over there, and it wouldn't have localization issues.

Comments

quicksketch’s picture

Title: Add relative date support to start and end dates » Add relative date support to start and end years

Updating title, this only affects years, not actual dates that include a month and day.

quicksketch’s picture

StatusFileSize
new4.48 KB

Here's the first take at this for the D6 version. It wasn't quite trivial, since as always we need to take into account timezones when dealing with anything that is relative. Fortunately we already had a nice routine for converting a relative date into month/day/years so I just moved it to a separate function and reused it here. Even though this is a bit edge-casy, it'd be rather frustrating to not have the option for the current year if you were submitting something on the evening of December 31st. ;-)

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new4.07 KB
new4.52 KB

Ported to Drupal 7 and fixed a help text typo from the last patch. I've committed these versions.

Status: Fixed » Closed (fixed)

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