One design consideration you may want to consider is:
Since it's a date range plugin - implement each option in such a way that it returns just that - a date range. For example, in the case of 'Today', return two date objects for the same date(today).
This makes using your plugin much easier in my opinion. Most services that deliver data given a specific date range, expects just that a range - even if it's the same start and end date. Your plugin made it hard for me to decipher what mode was used, thus making it hard to determine what a nil 'to' date would be. If you always return a date range, you decouple the user selection from the handling of values. (for the most part).
Examples:
PHP Code:
text: 'After date',
iconCls: 'calendar',
menu: new Ext.menu.DateMenu({
handler: function(dp, date){
DATE_MIN = date.add(Date.DAY,1);
DATE_MAX = new Date();
}
})
PHP Code:
, '-', {
text: 'Specific date',
iconCls: 'calendar',
menu: new Ext.menu.DateMenu({
handler: function(dp, date){
DATE_MIN = date;
DATE_MAX = date.clone();
}
})
}
PHP Code:
, '-', {
text: 'Month-to-date',
handler: function() {
var d = new Date().clearTime();
DATE_MIN = Date.parse(d.format('m/01/Y'));
DATE_MAX = d;
}
}
Just an opinion though.. :-) Hope this helps and thanks for the quick response!!
fyi - DATE_MIN and DATE_MAX above are equiv to your to and from variables.