extjsextjs4.2

ExtJS4- Year and month date picker - disable all future dates


I am using a Ext.picker.Month. Setting maxDate does not disable dates which are grater than the maxDate value, but causes a validation error when selecting one.

How can I disable all future dates?

See fiddle -
1. Set maxDate to new Date()
2. Use ExtJS 4.2


Solution

  • You are instantiating a MonthPicker, not a DatePicker, yet you are using dozens of config options that are only available for a DatePicker.

    You can see here how to instantiate a MonthPicker. As you can see there and especially in the docs, MonthPicker does not provide a config option to disable anything. Also, if you check the DatePicker behaviour, you see that disabledDates option does not change anything in MonthPicker, only AFTER the month has been selected, all days in the DatePicker are disabled.

    So you would be on your own in implementing disabledDates for the MonthPicker, which I would do by looking at the code from DatePicker and MonthPicker, and trying to transfer.