Opened 7 years ago

Last modified 3 years ago

#6241 released enhancement (fixed)

DateField should have a way to limit its value range

Reported by: Hannu Salonen Owned by: Johan Anas
Priority: major Milestone: Vaadin 7.1.0.beta1
Component: Component Version: 6.4.8
Keywords: datefield range Cc:
Depends on:
Fv: yes Pro Account: Vote for Feature


There are many cases where a user needs to enter a date value in the past or in the future. In these cases, the DateField component should have a method to specify the range of allowed values (and displayed in the picker), eg. setRange(Date from, Date to).

Change history (10)

comment:1 Changed 7 years ago by Artur Signell

  • Milestone set to Vaadin Backlog

comment:2 Changed 7 years ago by bpeter

That feature would really be appreciated! Hoping you can look into it.

comment:3 Changed 7 years ago by Artur Signell

  • Priority changed from normal to major

#7378 is a duplicate

comment:4 Changed 7 years ago by rob.blake@…

Again echoing that this feature would be extremely useful. We have requires to limit the dates from which a user can select. Whilst we can do this with validation, it would be far simpler if we could simply restrict the range of dates from which the user can select in the first place.

comment:5 Changed 5 years ago by Jens Jansson



  • setRangeStart(Date date) and Date getRangeStart()
  • setRangeEnd(Date date) and getRangeEnd()
  • setting 'null' to methods means that there is no restriction for either start or end. Having a value in one and them and null in the other is valid
  • IllegalStateException if range end date is earlier than start date, and vice versa.


  • give style name to days and buttons for month and year switcher that are not allowed
  • give a very light theme to disallowed dates
  • remove pointer cursor
  • disable days outside range
  • disable month switcher if last/next month is totally disabled
  • disable year switcher if last/next month is totally disabled
  • when use opens date popup, and current date is outside allowed range, open up the closest year/month which is allowed by the range


  • in resolution, support year, month and day. below is not supported now.
  • include the outer dates. ie. if resolution month, and allowed start date is 20th January, allow selection of January
  • timezones should not affect the range dates
  • override validate to check that dates that are set to component are within the range
  • Should work in both PopupDateField and InlineDateField
Last edited 5 years ago by Jens Jansson (previous) (diff)

comment:6 Changed 5 years ago by Johan Anas

  • Owner changed from ticketmaster to Johan Anas
  • Status changed from new to accepted

comment:7 Changed 5 years ago by Artur Signell

  • Milestone changed from Vaadin Backlog to Vaadin 7.1.0.beta1

comment:8 Changed 5 years ago by John Ahlroos

  • Resolution set to fixed
  • Status changed from accepted to closed

Fix merged and reviewed by me.

comment:9 Changed 4 years ago by Artur Signell

  • Fv set

comment:10 Changed 3 years ago by Artur Signell

  • Status changed from closed to released
Note: See TracTickets for help on using tickets.