My issue seems very similar to http://drupal.org/node/401954, and if it's a duplicate, I apologize.

I recently upgraded to the newest version and ran update.php, cleared caches.

I wanted to have the years in reverse chronological order, 2011, 2010, 2009, etc., up to 10 years prior.

I was to test the validation of the dates, and was given the message in the provided screenshot. One has the configuration for the range, starting 10 years in the past and going to 10 years in the future.

While attempting to submit a previous date, such as seen in the second screenshot, it would give the validation error.

I'm not using date popup, as you can see.

I was pretty sure this wasn't the case with 2.x, as I set up the form with the intention of this date range displaying the current year and all years previously, and hadn't had any users complain of not being able to validate the date.

Do I need to just use the textfield instead, and have users enter the year?

Members fund testing for the Drupal project. Drupal Association Learn more


narcissus921’s picture

Title: Date range validation wants date from today » Date range validation wants month and date from today
jenstechs’s picture

I have this exact same problem. I originally had my dates -5 to -100 so the most recent years would appear on top, but now my users get a validation message saying they have to be WITHIN 5 years, not AT LEAST 5 years ago. I swapped the max and min to get the validation to work correctly, but now my year starts at 1911, not 2006.... and most of my users are teens...

quicksketch’s picture

Title: Date range validation wants month and date from today » Using an end date that is before start date (to flip year order) no longer allowed

I think there are actually 2 issues being described here. The initial post with the screenshots is actually showing an error in which Webform is correct. If the start date is "-10 years" and the end date is "+10 years", you should get an error if your end-user date is more than 10 years ago. The screenshot shows a good example, the date entered was in May, but its currently September. So May 10 years ago is actually 10 years and 4 months ago. It should throw an error.

Although it's a bit awkward, you can solve this problem by using a Start Date of "Jan 1 - 10 years", meaning any date in all of 2001 will be allowed, even the days before the current one. Likewise your end date would need to be "Dec 31 + 10 years".

So the subject of this post (as well as the screenshots) show one problem. But the original post and comment #2 describe another problem, which does indeed seem to be broken behavior. If your end date is before your start date, it should flip the order of the "Year" drop down list (which it does correctly), but then the form won't let you submit. Instead of flipping start and end date, it actually validate the start date (which is actually later) as the start date and the end date as the end date. Looks like our validation just needs a fix.

narcissus921’s picture

Thanks for the clarification! I wasn't sure what was going on (obviously, since I was going back more than my date range..), but that definitely makes sense. Given what you've provided about defining specific start and end dates dates, I'm going to go try those out.

narcissus921’s picture

Referring back to the issue I had originally referenced as a similar/near duplicate issue, I noticed the patch that was included on the thread (http://drupal.org/files/issues/webform_reversible_dates.patch) and didn't see this in the code anywhere.

I'm not a programmer, but I didn't see anything related to this in the date.inc file anymore?

Bartezz’s picture

Version: 6.x-3.14 » 7.x-3.13

Updated to latest version and had start date of -18 and end date of -99 which worked before the update.
Now I changed it to '18 year ago' and '99 year ago' and it has problems validating.
It only works if I reverse the order and input '99 year ago' and '18 year ago'.

Is the 'bug' mentioned in #1 back?


quicksketch’s picture

Is the 'bug' mentioned in #1 back?

Well it's not really "back", because it hasn't been fixed yet. That's why this issue is still in the "active" state. The bug exists in all versions higher than 3.12.

quicksketch’s picture

Status: Active » Fixed
1.51 KB

I've committed this patch which fixes the validation to make it so that start and end dates can be flipped.

Bartezz’s picture


Status: Fixed » Closed (fixed)

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

bcobin’s picture

Issue summary: View changes

I know this is an old issue, but this seems to the latest it's been addressed - the patch from four years ago no longer applies. Reversing the order as described above generates the "end date must be later than start date" message and the form won't validate.

Any ideas? Thanks!

DanChadwick’s picture

The start date needs to be before (or equal to) the end date during submission entry. This was added when tokens were added. For example, you might have a range from [sometoken:date] to [1/1/2016]. So you want to allow entries from the token date, ending on 1/1/2016. If the form is submitted on 2/2/2016, there should be no allowable value (because, say, the coupon has expired).

Or maybe I'm not understanding why "flipped" start/end dates are useful?

bcobin’s picture

Thanks for the response, @DanChadwick; my issue is the same as @jenstechs, some four years ago. It's a display thing, not functionality-related, so in my case, it's not a bug in any sense of the word.

This is for a site for a quasi-governmental program that's repurposing an abandoned brewery space and local craft brewers are prospective tenants. Craft brewers are required by law for visitors to attest that they are of drinking age, which I'm doing via a web form with a dropdown date selector; having to scroll all the way from 1915 to more recent years is very tedious.

So I just need to be able to display the year in descending, as opposed to ascending order. This would be much more user-friendly.

Does that make sense? Thanks for the response, or perhaps I should say... Cheers!

DanChadwick’s picture

Yeaaaah, I'd say that reversing the order of the fields for validation isn't the right way to achieve this though. I think you'll have to do some custom programming to get this feature back.

Or, gag, I guess we could consider an option to present years most-recent first.

bcobin’s picture

Or, gag, I guess we could consider an option to present years most-recent first.

There could be a beer in it for ya. If you're over 21, that is! :)

oxpros’s picture

Same problem, running 7.x-4.10. Is there any progress towards fixing this or offering a patch?
Webform is great and just what we need – but having a dropdown for years in reverse order would be very helpful.

DanChadwick’s picture

@16 - No. No one is working on this, but I would happily review a patch.

was.uthm’s picture

I have the same problem (webform 7.x-4.12) cannot get the dropdown for years in decending order.

sumachaa’s picture

A patch for this in 4x is added in here: https://www.drupal.org/project/webform/issues/2718593