diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Wishlist: DatePicker minimum and maximum dates #216

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice to have DatePicker extended to include a "minimum date" and 
"maximum date", to indicate acceptable dates.
For example, I might only want to allow dates in the future to be selected, but 
at most 1 month into the future.

Original issue reported on code.google.com by erich.sc...@gmail.com on 28 Sep 2010 at 2:18

GoogleCodeExporter commented 8 years ago

Original comment by pall...@google.com on 26 Oct 2010 at 9:46

GoogleCodeExporter commented 8 years ago
I needed this also so I created a patch (attached).  Works like this:

picker.setAllowedDateRange(range);

Where range is a goog.date.DateRange or null for no limits.

The range can have null start or end date. This means no minimum or maximum 
dates respectivelly.

If you call setAllowedDateRange and invalidate the current selected date then 
we clear the current selected date.

Unit test also in patch.

Original comment by guido.tapia@gmail.com on 15 Dec 2010 at 9:53

GoogleCodeExporter commented 8 years ago
New patch attached.  Setting an appropriate css class and updated demo.

Original comment by guido.tapia@gmail.com on 15 Dec 2010 at 10:07

GoogleCodeExporter commented 8 years ago
Ughhh! goog.date.DateRange does not allow null values (changes them to today).  

Heres an uglier implementation without using goog.date.DateRange.  Fixing 
goog.date.DateRange would be simple but I'm sure it would break existing code 
relying on this totally unintuitive implementation.

Original comment by guido.tapia@gmail.com on 15 Dec 2010 at 10:41

Attachments: