4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-picker-Date'>/**
19 </span> * A date picker. This class is used by the Ext.form.field.Date field to allow browsing and selection of valid
20 * dates in a popup next to the field, but may also be used with other components.
22 * Typically you will need to implement a handler function to be notified when the user chooses a date from the picker;
23 * you can register the handler using the {@link #select} event, or by implementing the {@link #handler} method.
25 * By default the user will be allowed to pick any date; this can be changed by using the {@link #minDate},
26 * {@link #maxDate}, {@link #disabledDays}, {@link #disabledDatesRE}, and/or {@link #disabledDates} configs.
28 * All the string values documented below may be overridden by including an Ext locale file in your page.
31 * Ext.create('Ext.panel.Panel', {
32 * title: 'Choose a future date:',
35 * renderTo: Ext.getBody(),
37 * xtype: 'datepicker',
38 * minDate: new Date(),
39 * handler: function(picker, date) {
40 * // do something with the selected date
45 Ext.define('Ext.picker.Date', {
46 extend: 'Ext.Component',
51 'Ext.util.ClickRepeater',
57 alias: 'widget.datepicker',
58 alternateClassName: 'Ext.DatePicker',
61 '<div class="{cls}" id="{id}" role="grid" title="{ariaTitle} {value:this.longDay}">',
62 '<div role="presentation" class="{baseCls}-header">',
63 '<div class="{baseCls}-prev"><a id="{id}-prevEl" href="#" role="button" title="{prevText}"></a></div>',
64 '<div class="{baseCls}-month" id="{id}-middleBtnEl"></div>',
65 '<div class="{baseCls}-next"><a id="{id}-nextEl" href="#" role="button" title="{nextText}"></a></div>',
67 '<table id="{id}-eventEl" class="{baseCls}-inner" cellspacing="0" role="presentation">',
68 '<thead role="presentation"><tr role="presentation">',
69 '<tpl for="dayNames">',
70 '<th role="columnheader" title="{.}"><span>{.:this.firstInitial}</span></th>',
72 '</tr></thead>',
73 '<tbody role="presentation"><tr role="presentation">',
74 '<tpl for="days">',
75 '{#:this.isEndOfWeek}',
76 '<td role="gridcell" id="{[Ext.id()]}">',
77 '<a role="presentation" href="#" hidefocus="on" class="{parent.baseCls}-date" tabIndex="1">',
78 '<em role="presentation"><span role="presentation"></span></em>',
82 '</tr></tbody>',
84 '<tpl if="showToday">',
85 '<div id="{id}-footerEl" role="presentation" class="{baseCls}-footer"></div>',
89 firstInitial: function(value) {
90 return value.substr(0,1);
92 isEndOfWeek: function(value) {
93 // convert from 1 based index to 0 based
94 // by decrementing value once.
96 var end = value % 7 === 0 && value !== 0;
97 return end ? '</tr><tr role="row">' : '';
99 longDay: function(value){
100 return Ext.Date.format(value, this.longDayFormat);
105 ariaTitle: 'Date Picker',
107 <span id='Ext-picker-Date-cfg-todayText'> /**
108 </span> * @cfg {String} todayText
109 * The text to display on the button that selects the current date
113 <span id='Ext-picker-Date-cfg-handler'> /**
114 </span> * @cfg {Function} handler
115 * Optional. A function that will handle the select event of this picker. The handler is passed the following
118 * - `picker` : Ext.picker.Date
127 <span id='Ext-picker-Date-cfg-scope'> /**
128 </span> * @cfg {Object} scope
129 * The scope (`this` reference) in which the `{@link #handler}` function will be called. Defaults to this
130 * DatePicker instance.
133 <span id='Ext-picker-Date-cfg-todayTip'> /**
134 </span> * @cfg {String} todayTip
135 * A string used to format the message for displaying in a tooltip over the button that selects the current date.
136 * The `{0}` token in string is replaced by today's date.
138 todayTip : '{0} (Spacebar)',
140 <span id='Ext-picker-Date-cfg-minText'> /**
141 </span> * @cfg {String} minText
142 * The error text to display if the minDate validation fails.
144 minText : 'This date is before the minimum date',
146 <span id='Ext-picker-Date-cfg-maxText'> /**
147 </span> * @cfg {String} maxText
148 * The error text to display if the maxDate validation fails.
150 maxText : 'This date is after the maximum date',
152 <span id='Ext-picker-Date-cfg-format'> /**
153 </span> * @cfg {String} format
154 * The default date format string which can be overriden for localization support. The format must be valid
155 * according to {@link Ext.Date#parse} (defaults to {@link Ext.Date#defaultFormat}).
158 <span id='Ext-picker-Date-cfg-disabledDaysText'> /**
159 </span> * @cfg {String} disabledDaysText
160 * The tooltip to display when the date falls on a disabled day.
162 disabledDaysText : 'Disabled',
164 <span id='Ext-picker-Date-cfg-disabledDatesText'> /**
165 </span> * @cfg {String} disabledDatesText
166 * The tooltip text to display when the date falls on a disabled date.
168 disabledDatesText : 'Disabled',
170 <span id='Ext-picker-Date-cfg-monthNames'> /**
171 </span> * @cfg {String[]} monthNames
172 * An array of textual month names which can be overriden for localization support (defaults to Ext.Date.monthNames)
175 <span id='Ext-picker-Date-cfg-dayNames'> /**
176 </span> * @cfg {String[]} dayNames
177 * An array of textual day names which can be overriden for localization support (defaults to Ext.Date.dayNames)
180 <span id='Ext-picker-Date-cfg-nextText'> /**
181 </span> * @cfg {String} nextText
182 * The next month navigation button tooltip
184 nextText : 'Next Month (Control+Right)',
186 <span id='Ext-picker-Date-cfg-prevText'> /**
187 </span> * @cfg {String} prevText
188 * The previous month navigation button tooltip
190 prevText : 'Previous Month (Control+Left)',
192 <span id='Ext-picker-Date-cfg-monthYearText'> /**
193 </span> * @cfg {String} monthYearText
194 * The header month selector tooltip
196 monthYearText : 'Choose a month (Control+Up/Down to move years)',
198 <span id='Ext-picker-Date-cfg-startDay'> /**
199 </span> * @cfg {Number} startDay
200 * Day index at which the week should begin, 0-based (defaults to Sunday)
204 <span id='Ext-picker-Date-cfg-showToday'> /**
205 </span> * @cfg {Boolean} showToday
206 * False to hide the footer area containing the Today button and disable the keyboard handler for spacebar that
207 * selects the current date.
211 <span id='Ext-picker-Date-cfg-minDate'> /**
212 </span> * @cfg {Date} [minDate=null]
213 * Minimum allowable date (JavaScript date object)
216 <span id='Ext-picker-Date-cfg-maxDate'> /**
217 </span> * @cfg {Date} [maxDate=null]
218 * Maximum allowable date (JavaScript date object)
221 <span id='Ext-picker-Date-cfg-disabledDays'> /**
222 </span> * @cfg {Number[]} [disabledDays=null]
223 * An array of days to disable, 0-based. For example, [0, 6] disables Sunday and Saturday.
226 <span id='Ext-picker-Date-cfg-disabledDatesRE'> /**
227 </span> * @cfg {RegExp} [disabledDatesRE=null]
228 * JavaScript regular expression used to disable a pattern of dates. The {@link #disabledDates}
229 * config will generate this regex internally, but if you specify disabledDatesRE it will take precedence over the
230 * disabledDates value.
233 <span id='Ext-picker-Date-cfg-disabledDates'> /**
234 </span> * @cfg {String[]} disabledDates
235 * An array of 'dates' to disable, as strings. These strings will be used to build a dynamic regular expression so
236 * they are very powerful. Some examples:
238 * - ['03/08/2003', '09/16/2003'] would disable those exact dates
239 * - ['03/08', '09/16'] would disable those days for every year
240 * - ['^03/08'] would only match the beginning (useful if you are using short years)
241 * - ['03/../2006'] would disable every day in March 2006
242 * - ['^03'] would disable every day in every March
244 * Note that the format of the dates included in the array should exactly match the {@link #format} config. In order
245 * to support regular expressions, if you are using a date format that has '.' in it, you will have to escape the
246 * dot when restricting dates. For example: ['03\\.08\\.03'].
249 <span id='Ext-picker-Date-cfg-disableAnim'> /**
250 </span> * @cfg {Boolean} disableAnim
251 * True to disable animations when showing the month picker.
255 <span id='Ext-picker-Date-cfg-baseCls'> /**
256 </span> * @cfg {String} [baseCls='x-datepicker']
257 * The base CSS class to apply to this components element.
259 baseCls: Ext.baseCSSPrefix + 'datepicker',
261 <span id='Ext-picker-Date-cfg-selectedCls'> /**
262 </span> * @cfg {String} [selectedCls='x-datepicker-selected']
263 * The class to apply to the selected cell.
266 <span id='Ext-picker-Date-cfg-disabledCellCls'> /**
267 </span> * @cfg {String} [disabledCellCls='x-datepicker-disabled']
268 * The class to apply to disabled cells.
271 <span id='Ext-picker-Date-cfg-longDayFormat'> /**
272 </span> * @cfg {String} longDayFormat
273 * The format for displaying a date in a longer format.
275 longDayFormat: 'F d, Y',
277 <span id='Ext-picker-Date-cfg-keyNavConfig'> /**
278 </span> * @cfg {Object} keyNavConfig
279 * Specifies optional custom key event handlers for the {@link Ext.util.KeyNav} attached to this date picker. Must
280 * conform to the config format recognized by the {@link Ext.util.KeyNav} constructor. Handlers specified in this
281 * object will replace default handlers of the same name.
284 <span id='Ext-picker-Date-cfg-focusOnShow'> /**
285 </span> * @cfg {Boolean} focusOnShow
286 * True to automatically focus the picker on show.
291 // Set by other components to stop the picker focus being updated when the value changes.
296 // default value used to initialise each date in the DatePicker
297 // (note: 12 noon was chosen because it steers well clear of all DST timezone changes)
298 initHour: 12, // 24-hour format
302 // private, inherit docs
303 initComponent : function() {
305 clearTime = Ext.Date.clearTime;
307 me.selectedCls = me.baseCls + '-selected';
308 me.disabledCellCls = me.baseCls + '-disabled';
309 me.prevCls = me.baseCls + '-prevday';
310 me.activeCls = me.baseCls + '-active';
311 me.nextCls = me.baseCls + '-prevday';
312 me.todayCls = me.baseCls + '-today';
313 me.dayNames = me.dayNames.slice(me.startDay).concat(me.dayNames.slice(0, me.startDay));
316 me.value = me.value ?
317 clearTime(me.value, true) : clearTime(new Date());
320 <span id='Ext-picker-Date-event-select'> /**
321 </span> * @event select
322 * Fires when a date is selected
323 * @param {Ext.picker.Date} this DatePicker
324 * @param {Date} date The selected date
329 me.initDisabledDays();
332 // private, inherit docs
333 onRender : function(container, position){
335 * days array for looping through 6 full weeks (6 weeks * 7 days)
336 * Note that we explicitly force the size here so the template creates
337 * all the appropriate cells.
341 days = new Array(me.numDays),
342 today = Ext.Date.format(new Date(), me.format);
348 Ext.apply(me.renderData, {
349 dayNames: me.dayNames,
350 ariaTitle: me.ariaTitle,
352 showToday: me.showToday,
353 prevText: me.prevText,
354 nextText: me.nextText,
357 me.getTpl('renderTpl').longDayFormat = me.longDayFormat;
359 me.addChildEls('eventEl', 'prevEl', 'nextEl', 'middleBtnEl', 'footerEl');
361 this.callParent(arguments);
362 me.el.unselectable();
364 me.cells = me.eventEl.select('tbody td');
365 me.textNodes = me.eventEl.query('tbody td span');
367 me.monthBtn = Ext.create('Ext.button.Split', {
369 tooltip: me.monthYearText,
370 renderTo: me.middleBtnEl
372 //~ me.middleBtnEl.down('button').addCls(Ext.baseCSSPrefix + 'btn-arrow');
375 me.todayBtn = Ext.create('Ext.button.Button', {
376 renderTo: me.footerEl,
377 text: Ext.String.format(me.todayText, today),
378 tooltip: Ext.String.format(me.todayTip, today),
379 handler: me.selectToday,
384 // private, inherit docs
385 initEvents: function(){
392 me.prevRepeater = Ext.create('Ext.util.ClickRepeater', me.prevEl, {
393 handler: me.showPrevMonth,
395 preventDefault: true,
399 me.nextRepeater = Ext.create('Ext.util.ClickRepeater', me.nextEl, {
400 handler: me.showNextMonth,
406 me.keyNav = Ext.create('Ext.util.KeyNav', me.eventEl, Ext.apply({
408 'left' : function(e){
412 me.update(eDate.add(me.activeDate, day, -1));
416 'right' : function(e){
420 me.update(eDate.add(me.activeDate, day, 1));
428 me.update(eDate.add(me.activeDate, day, -7));
432 'down' : function(e){
436 me.update(eDate.add(me.activeDate, day, 7));
439 'pageUp' : me.showNextMonth,
440 'pageDown' : me.showPrevMonth,
441 'enter' : function(e){
445 }, me.keyNavConfig));
448 me.todayKeyListener = me.eventEl.addKeyListener(Ext.EventObject.SPACE, me.selectToday, me);
450 me.mon(me.eventEl, 'mousewheel', me.handleMouseWheel, me);
451 me.mon(me.eventEl, 'click', me.handleDateClick, me, {delegate: 'a.' + me.baseCls + '-date'});
452 me.mon(me.monthBtn, 'click', me.showMonthPicker, me);
453 me.mon(me.monthBtn, 'arrowclick', me.showMonthPicker, me);
457 <span id='Ext-picker-Date-method-initDisabledDays'> /**
458 </span> * Setup the disabled dates regex based on config options
461 initDisabledDays : function(){
463 dd = me.disabledDates,
467 if(!me.disabledDatesRE && dd){
470 Ext.each(dd, function(d, i){
471 re += Ext.isDate(d) ? '^' + Ext.String.escapeRegex(Ext.Date.dateFormat(d, me.format)) + '$' : dd[i];
476 me.disabledDatesRE = new RegExp(re + ')');
480 <span id='Ext-picker-Date-method-setDisabledDates'> /**
481 </span> * Replaces any existing disabled dates with new values and refreshes the DatePicker.
482 * @param {String[]/RegExp} disabledDates An array of date strings (see the {@link #disabledDates} config for
483 * details on supported values), or a JavaScript regular expression used to disable a pattern of dates.
484 * @return {Ext.picker.Date} this
486 setDisabledDates : function(dd){
490 me.disabledDates = dd;
491 me.disabledDatesRE = null;
493 me.disabledDatesRE = dd;
495 me.initDisabledDays();
496 me.update(me.value, true);
500 <span id='Ext-picker-Date-method-setDisabledDays'> /**
501 </span> * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
502 * @param {Number[]} disabledDays An array of disabled day indexes. See the {@link #disabledDays} config for details
503 * on supported values.
504 * @return {Ext.picker.Date} this
506 setDisabledDays : function(dd){
507 this.disabledDays = dd;
508 return this.update(this.value, true);
511 <span id='Ext-picker-Date-method-setMinDate'> /**
512 </span> * Replaces any existing {@link #minDate} with the new value and refreshes the DatePicker.
513 * @param {Date} value The minimum date that can be selected
514 * @return {Ext.picker.Date} this
516 setMinDate : function(dt){
518 return this.update(this.value, true);
521 <span id='Ext-picker-Date-method-setMaxDate'> /**
522 </span> * Replaces any existing {@link #maxDate} with the new value and refreshes the DatePicker.
523 * @param {Date} value The maximum date that can be selected
524 * @return {Ext.picker.Date} this
526 setMaxDate : function(dt){
528 return this.update(this.value, true);
531 <span id='Ext-picker-Date-method-setValue'> /**
532 </span> * Sets the value of the date field
533 * @param {Date} value The date to set
534 * @return {Ext.picker.Date} this
536 setValue : function(value){
537 this.value = Ext.Date.clearTime(value, true);
538 return this.update(this.value);
541 <span id='Ext-picker-Date-method-getValue'> /**
542 </span> * Gets the current selected value of the date field
543 * @return {Date} The selected date
545 getValue : function(){
551 this.update(this.activeDate);
554 // private, inherit docs
555 onEnable: function(){
557 this.setDisabledStatus(false);
558 this.update(this.activeDate);
562 // private, inherit docs
563 onDisable : function(){
565 this.setDisabledStatus(true);
568 <span id='Ext-picker-Date-method-setDisabledStatus'> /**
569 </span> * Set the disabled state of various internal components
571 * @param {Boolean} disabled
573 setDisabledStatus : function(disabled){
576 me.keyNav.setDisabled(disabled);
577 me.prevRepeater.setDisabled(disabled);
578 me.nextRepeater.setDisabled(disabled);
580 me.todayKeyListener.setDisabled(disabled);
581 me.todayBtn.setDisabled(disabled);
585 <span id='Ext-picker-Date-method-getActive'> /**
586 </span> * Get the current active date.
588 * @return {Date} The active date
590 getActive: function(){
591 return this.activeDate || this.value;
594 <span id='Ext-picker-Date-method-runAnimation'> /**
595 </span> * Run any animation required to hide/show the month picker.
597 * @param {Boolean} isHide True if it's a hide operation
599 runAnimation: function(isHide){
600 var picker = this.monthPicker,
603 callback: function(){
613 picker.el.slideOut('t', options);
615 picker.el.slideIn('t', options);
619 <span id='Ext-picker-Date-method-hideMonthPicker'> /**
620 </span> * Hides the month picker, if it's visible.
621 * @param {Boolean} [animate] Indicates whether to animate this action. If the animate
622 * parameter is not specified, the behavior will use {@link #disableAnim} to determine
623 * whether to animate or not.
624 * @return {Ext.picker.Date} this
626 hideMonthPicker : function(animate){
628 picker = me.monthPicker;
631 if (me.shouldAnimate(animate)) {
632 me.runAnimation(true);
640 <span id='Ext-picker-Date-method-showMonthPicker'> /**
641 </span> * Show the month picker
642 * @param {Boolean} [animate] Indicates whether to animate this action. If the animate
643 * parameter is not specified, the behavior will use {@link #disableAnim} to determine
644 * whether to animate or not.
645 * @return {Ext.picker.Date} this
647 showMonthPicker : function(animate){
651 if (me.rendered && !me.disabled) {
652 picker = me.createMonthPicker();
653 picker.setValue(me.getActive());
654 picker.setSize(me.getSize());
655 picker.setPosition(-1, -1);
656 if (me.shouldAnimate(animate)) {
657 me.runAnimation(false);
665 <span id='Ext-picker-Date-method-shouldAnimate'> /**
666 </span> * Checks whether a hide/show action should animate
668 * @param {Boolean} [animate] A possible animation value
669 * @return {Boolean} Whether to animate the action
671 shouldAnimate: function(animate){
672 return Ext.isDefined(animate) ? animate : !this.disableAnim;
675 <span id='Ext-picker-Date-method-createMonthPicker'> /**
676 </span> * Create the month picker instance
678 * @return {Ext.picker.Month} picker
680 createMonthPicker: function(){
682 picker = me.monthPicker;
685 me.monthPicker = picker = Ext.create('Ext.picker.Month', {
689 small: me.showToday === false,
692 cancelclick: me.onCancelClick,
693 okclick: me.onOkClick,
694 yeardblclick: me.onOkClick,
695 monthdblclick: me.onOkClick
698 if (!me.disableAnim) {
699 // hide the element if we're animating to prevent an initial flicker
700 picker.el.setStyle('display', 'none');
702 me.on('beforehide', Ext.Function.bind(me.hideMonthPicker, me, [false]));
707 <span id='Ext-picker-Date-method-onOkClick'> /**
708 </span> * Respond to an ok click on the month picker
711 onOkClick: function(picker, value){
715 date = new Date(year, month, me.getActive().getDate());
717 if (date.getMonth() !== month) {
718 // 'fix' the JS rolling date conversion if needed
719 date = new Date(year, month, 1).getLastDateOfMonth();
722 me.hideMonthPicker();
725 <span id='Ext-picker-Date-method-onCancelClick'> /**
726 </span> * Respond to a cancel click on the month picker
729 onCancelClick: function(){
730 this.hideMonthPicker();
733 <span id='Ext-picker-Date-method-showPrevMonth'> /**
734 </span> * Show the previous month.
736 * @return {Ext.picker.Date} this
738 showPrevMonth : function(e){
739 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, -1));
742 <span id='Ext-picker-Date-method-showNextMonth'> /**
743 </span> * Show the next month.
745 * @return {Ext.picker.Date} this
747 showNextMonth : function(e){
748 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, 1));
751 <span id='Ext-picker-Date-method-showPrevYear'> /**
752 </span> * Show the previous year.
753 * @return {Ext.picker.Date} this
755 showPrevYear : function(){
756 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, -1));
759 <span id='Ext-picker-Date-method-showNextYear'> /**
760 </span> * Show the next year.
761 * @return {Ext.picker.Date} this
763 showNextYear : function(){
764 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, 1));
767 <span id='Ext-picker-Date-method-handleMouseWheel'> /**
768 </span> * Respond to the mouse wheel event
770 * @param {Ext.EventObject} e
772 handleMouseWheel : function(e){
775 var delta = e.getWheelDelta();
777 this.showPrevMonth();
778 } else if(delta < 0){
779 this.showNextMonth();
784 <span id='Ext-picker-Date-method-handleDateClick'> /**
785 </span> * Respond to a date being clicked in the picker
787 * @param {Ext.EventObject} e
788 * @param {HTMLElement} t
790 handleDateClick : function(e, t){
792 handler = me.handler;
795 if(!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)){
796 me.cancelFocus = me.focusOnSelect === false;
797 me.setValue(new Date(t.dateValue));
798 delete me.cancelFocus;
799 me.fireEvent('select', me, me.value);
801 handler.call(me.scope || me, me, me.value);
803 // event handling is turned off on hide
804 // when we are using the picker in a field
805 // therefore onSelect comes AFTER the select
811 <span id='Ext-picker-Date-method-onSelect'> /**
812 </span> * Perform any post-select actions
815 onSelect: function() {
816 if (this.hideOnSelect) {
821 <span id='Ext-picker-Date-method-selectToday'> /**
822 </span> * Sets the current value to today.
823 * @return {Ext.picker.Date} this
825 selectToday : function(){
828 handler = me.handler;
830 if(btn && !btn.disabled){
831 me.setValue(Ext.Date.clearTime(new Date()));
832 me.fireEvent('select', me, me.value);
834 handler.call(me.scope || me, me, me.value);
841 <span id='Ext-picker-Date-method-selectedUpdate'> /**
842 </span> * Update the selected cell
844 * @param {Date} date The new date
845 * @param {Date} active The active date
847 selectedUpdate: function(date, active){
851 cls = me.selectedCls;
853 cells.removeCls(cls);
854 cells.each(function(c){
855 if (c.dom.firstChild.dateValue == t) {
856 me.el.dom.setAttribute('aria-activedescendent', c.dom.id);
858 if(me.isVisible() && !me.cancelFocus){
859 Ext.fly(c.dom.firstChild).focus(50);
866 <span id='Ext-picker-Date-method-fullUpdate'> /**
867 </span> * Update the contents of the picker for a new month
869 * @param {Date} date The new date
870 * @param {Date} active The active date
872 fullUpdate: function(date, active){
874 cells = me.cells.elements,
875 textNodes = me.textNodes,
876 disabledCls = me.disabledCellCls,
880 visible = me.isVisible(),
881 sel = +eDate.clearTime(date, true),
882 today = +eDate.clearTime(new Date()),
883 min = me.minDate ? eDate.clearTime(me.minDate, true) : Number.NEGATIVE_INFINITY,
884 max = me.maxDate ? eDate.clearTime(me.maxDate, true) : Number.POSITIVE_INFINITY,
885 ddMatch = me.disabledDatesRE,
886 ddText = me.disabledDatesText,
887 ddays = me.disabledDays ? me.disabledDays.join('') : false,
888 ddaysText = me.disabledDaysText,
890 days = eDate.getDaysInMonth(date),
891 firstOfMonth = eDate.getFirstDateOfMonth(date),
892 startingPos = firstOfMonth.getDay() - me.startDay,
893 previousMonth = eDate.add(date, eDate.MONTH, -1),
894 longDayFormat = me.longDayFormat,
905 if (startingPos < 0) {
910 prevStart = eDate.getDaysInMonth(previousMonth) - startingPos;
911 current = new Date(previousMonth.getFullYear(), previousMonth.getMonth(), prevStart, me.initHour);
914 tempDate = eDate.clearTime(new Date());
915 disableToday = (tempDate < min || tempDate > max ||
916 (ddMatch && format && ddMatch.test(eDate.dateFormat(tempDate, format))) ||
917 (ddays && ddays.indexOf(tempDate.getDay()) != -1));
920 me.todayBtn.setDisabled(disableToday);
921 me.todayKeyListener.setDisabled(disableToday);
925 setCellClass = function(cell){
926 value = +eDate.clearTime(current, true);
927 cell.title = eDate.format(current, longDayFormat);
928 // store dateValue number as an expando
929 cell.firstChild.dateValue = value;
931 cell.className += ' ' + me.todayCls;
932 cell.title = me.todayText;
935 cell.className += ' ' + me.selectedCls;
936 me.el.dom.setAttribute('aria-activedescendant', cell.id);
937 if (visible && me.floating) {
938 Ext.fly(cell.firstChild).focus(50);
943 cell.className = disabledCls;
944 cell.title = me.minText;
948 cell.className = disabledCls;
949 cell.title = me.maxText;
953 if(ddays.indexOf(current.getDay()) != -1){
954 cell.title = ddaysText;
955 cell.className = disabledCls;
958 if(ddMatch && format){
959 formatValue = eDate.dateFormat(current, format);
960 if(ddMatch.test(formatValue)){
961 cell.title = ddText.replace('%0', formatValue);
962 cell.className = disabledCls;
967 for(; i < me.numDays; ++i) {
968 if (i < startingPos) {
969 html = (++prevStart);
971 } else if (i >= days) {
972 html = (++extraDays);
975 html = i - startingPos + 1;
978 textNodes[i].innerHTML = html;
979 cells[i].className = cls;
980 current.setDate(current.getDate() + 1);
981 setCellClass(cells[i]);
984 me.monthBtn.setText(me.monthNames[date.getMonth()] + ' ' + date.getFullYear());
987 <span id='Ext-picker-Date-method-update'> /**
988 </span> * Update the contents of the picker
990 * @param {Date} date The new date
991 * @param {Boolean} forceRefresh True to force a full refresh
993 update : function(date, forceRefresh){
995 active = me.activeDate;
998 me.activeDate = date;
999 if(!forceRefresh && active && me.el && active.getMonth() == date.getMonth() && active.getFullYear() == date.getFullYear()){
1000 me.selectedUpdate(date, active);
1002 me.fullUpdate(date, active);
1008 // private, inherit docs
1009 beforeDestroy : function() {
1014 me.todayKeyListener,
1022 delete me.textNodes;
1023 delete me.cells.elements;
1028 // private, inherit docs
1029 onShow: function() {
1030 this.callParent(arguments);
1031 if (this.focusOnShow) {
1037 // After dependencies have loaded:
1039 var proto = this.prototype;
1041 proto.monthNames = Ext.Date.monthNames;
1043 proto.dayNames = Ext.Date.dayNames;
1045 proto.format = Ext.Date.defaultFormat;