Ticket #6241 (closed 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: | |
| Hours estimate: | Hours done: | ||
| Depends on: | |||
| Workaround: | |||
Description
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
comment:2 Changed 23 months ago by bpeter
That feature would really be appreciated! Hoping you can look into it.
comment:3 Changed 22 months ago by Artur Signell
- Priority changed from normal to major
#7378 is a duplicate
comment:4 Changed 21 months 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 2 months ago by Jens Jansson
Specification
API
- 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.
UI
- 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
Internal
- 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
comment:6 Changed 8 weeks ago by Johan Anas
- Owner changed from ticketmaster to Johan Anas
- Status changed from new to accepted
Note: See
TracTickets for help on using
tickets.
