4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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-method-constructor'><span id='Ext-picker-Date'>/**
19 </span></span> * @class Ext.picker.Date
20 * @extends Ext.Component
21 * <p>A date picker. This class is used by the {@link Ext.form.field.Date} field to allow browsing and
22 * selection of valid dates in a popup next to the field, but may also be used with other components.</p>
23 * <p>Typically you will need to implement a handler function to be notified when the user chooses a color from the
24 * picker; you can register the handler using the {@link #select} event, or by implementing the {@link #handler}
26 * <p>By default the user will be allowed to pick any date; this can be changed by using the {@link #minDate},
27 * {@link #maxDate}, {@link #disabledDays}, {@link #disabledDatesRE}, and/or {@link #disabledDates} configs.</p>
28 * <p>All the string values documented below may be overridden by including an Ext locale file in your page.</p>
29 * <p>Example usage:</p>
30 * <pre><code>new Ext.panel.Panel({
31 title: 'Choose a future date:',
34 renderTo: Ext.getBody(),
38 handler: function(picker, date) {
39 // do something with the selected date
42 });</code></pre>
43 * {@img Ext.picker.Date/Ext.picker.Date.png Ext.picker.Date component}
46 * Create a new DatePicker
47 * @param {Object} config The config object
51 Ext.define('Ext.picker.Date', {
52 extend: 'Ext.Component',
57 'Ext.util.ClickRepeater',
63 alias: 'widget.datepicker',
64 alternateClassName: 'Ext.DatePicker',
67 '<div class="{cls}" id="{id}" role="grid" title="{ariaTitle} {value:this.longDay}">',
68 '<div role="presentation" class="{baseCls}-header">',
69 '<div class="{baseCls}-prev"><a href="#" role="button" title="{prevText}"></a></div>',
70 '<div class="{baseCls}-month"></div>',
71 '<div class="{baseCls}-next"><a href="#" role="button" title="{nextText}"></a></div>',
73 '<table class="{baseCls}-inner" cellspacing="0" role="presentation">',
74 '<thead role="presentation"><tr role="presentation">',
75 '<tpl for="dayNames">',
76 '<th role="columnheader" title="{.}"><span>{.:this.firstInitial}</span></th>',
78 '</tr></thead>',
79 '<tbody role="presentation"><tr role="presentation">',
80 '<tpl for="days">',
81 '{#:this.isEndOfWeek}',
82 '<td role="gridcell" id="{[Ext.id()]}">',
83 '<a role="presentation" href="#" hidefocus="on" class="{parent.baseCls}-date" tabIndex="1">',
84 '<em role="presentation"><span role="presentation"></span></em>',
88 '</tr></tbody>',
90 '<tpl if="showToday">',
91 '<div role="presentation" class="{baseCls}-footer"></div>',
95 firstInitial: function(value) {
96 return value.substr(0,1);
98 isEndOfWeek: function(value) {
99 // convert from 1 based index to 0 based
100 // by decrementing value once.
102 var end = value % 7 === 0 && value !== 0;
103 return end ? '</tr><tr role="row">' : '';
105 longDay: function(value){
106 return Ext.Date.format(value, this.longDayFormat);
111 ariaTitle: 'Date Picker',
112 <span id='Ext-picker-Date-cfg-todayText'> /**
113 </span> * @cfg {String} todayText
114 * The text to display on the button that selects the current date (defaults to <code>'Today'</code>)
117 <span id='Ext-picker-Date-cfg-handler'> /**
118 </span> * @cfg {Function} handler
119 * Optional. A function that will handle the select event of this picker.
120 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
121 * <li><code>picker</code> : Ext.picker.Date <div class="sub-desc">This Date picker.</div></li>
122 * <li><code>date</code> : Date <div class="sub-desc">The selected date.</div></li>
123 * </ul></div>
125 <span id='Ext-picker-Date-cfg-scope'> /**
126 </span> * @cfg {Object} scope
127 * The scope (<code><b>this</b></code> reference) in which the <code>{@link #handler}</code>
128 * function will be called. Defaults to this DatePicker instance.
130 <span id='Ext-picker-Date-cfg-todayTip'> /**
131 </span> * @cfg {String} todayTip
132 * A string used to format the message for displaying in a tooltip over the button that
133 * selects the current date. Defaults to <code>'{0} (Spacebar)'</code> where
134 * the <code>{0}</code> token is replaced by today's date.
136 todayTip : '{0} (Spacebar)',
137 <span id='Ext-picker-Date-cfg-minText'> /**
138 </span> * @cfg {String} minText
139 * The error text to display if the minDate validation fails (defaults to <code>'This date is before the minimum date'</code>)
141 minText : 'This date is before the minimum date',
142 <span id='Ext-picker-Date-cfg-maxText'> /**
143 </span> * @cfg {String} maxText
144 * The error text to display if the maxDate validation fails (defaults to <code>'This date is after the maximum date'</code>)
146 maxText : 'This date is after the maximum date',
147 <span id='Ext-picker-Date-cfg-format'> /**
148 </span> * @cfg {String} format
149 * The default date format string which can be overriden for localization support. The format must be
150 * valid according to {@link Ext.Date#parse} (defaults to {@link Ext.Date#defaultFormat}).
152 <span id='Ext-picker-Date-cfg-disabledDaysText'> /**
153 </span> * @cfg {String} disabledDaysText
154 * The tooltip to display when the date falls on a disabled day (defaults to <code>'Disabled'</code>)
156 disabledDaysText : 'Disabled',
157 <span id='Ext-picker-Date-cfg-disabledDatesText'> /**
158 </span> * @cfg {String} disabledDatesText
159 * The tooltip text to display when the date falls on a disabled date (defaults to <code>'Disabled'</code>)
161 disabledDatesText : 'Disabled',
162 <span id='Ext-picker-Date-cfg-monthNames'> /**
163 </span> * @cfg {Array} monthNames
164 * An array of textual month names which can be overriden for localization support (defaults to Ext.Date.monthNames)
166 <span id='Ext-picker-Date-cfg-dayNames'> /**
167 </span> * @cfg {Array} dayNames
168 * An array of textual day names which can be overriden for localization support (defaults to Ext.Date.dayNames)
170 <span id='Ext-picker-Date-cfg-nextText'> /**
171 </span> * @cfg {String} nextText
172 * The next month navigation button tooltip (defaults to <code>'Next Month (Control+Right)'</code>)
174 nextText : 'Next Month (Control+Right)',
175 <span id='Ext-picker-Date-cfg-prevText'> /**
176 </span> * @cfg {String} prevText
177 * The previous month navigation button tooltip (defaults to <code>'Previous Month (Control+Left)'</code>)
179 prevText : 'Previous Month (Control+Left)',
180 <span id='Ext-picker-Date-cfg-monthYearText'> /**
181 </span> * @cfg {String} monthYearText
182 * The header month selector tooltip (defaults to <code>'Choose a month (Control+Up/Down to move years)'</code>)
184 monthYearText : 'Choose a month (Control+Up/Down to move years)',
185 <span id='Ext-picker-Date-cfg-startDay'> /**
186 </span> * @cfg {Number} startDay
187 * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
190 <span id='Ext-picker-Date-cfg-showToday'> /**
191 </span> * @cfg {Boolean} showToday
192 * False to hide the footer area containing the Today button and disable the keyboard handler for spacebar
193 * that selects the current date (defaults to <code>true</code>).
196 <span id='Ext-picker-Date-cfg-minDate'> /**
197 </span> * @cfg {Date} minDate
198 * Minimum allowable date (JavaScript date object, defaults to null)
200 <span id='Ext-picker-Date-cfg-maxDate'> /**
201 </span> * @cfg {Date} maxDate
202 * Maximum allowable date (JavaScript date object, defaults to null)
204 <span id='Ext-picker-Date-cfg-disabledDays'> /**
205 </span> * @cfg {Array} disabledDays
206 * An array of days to disable, 0-based. For example, [0, 6] disables Sunday and Saturday (defaults to null).
208 <span id='Ext-picker-Date-cfg-disabledDatesRE'> /**
209 </span> * @cfg {RegExp} disabledDatesRE
210 * JavaScript regular expression used to disable a pattern of dates (defaults to null). The {@link #disabledDates}
211 * config will generate this regex internally, but if you specify disabledDatesRE it will take precedence over the
212 * disabledDates value.
214 <span id='Ext-picker-Date-cfg-disabledDates'> /**
215 </span> * @cfg {Array} disabledDates
216 * An array of 'dates' to disable, as strings. These strings will be used to build a dynamic regular
217 * expression so they are very powerful. Some examples:
219 * <li>['03/08/2003', '09/16/2003'] would disable those exact dates</li>
220 * <li>['03/08', '09/16'] would disable those days for every year</li>
221 * <li>['^03/08'] would only match the beginning (useful if you are using short years)</li>
222 * <li>['03/../2006'] would disable every day in March 2006</li>
223 * <li>['^03'] would disable every day in every March</li>
225 * Note that the format of the dates included in the array should exactly match the {@link #format} config.
226 * In order to support regular expressions, if you are using a date format that has '.' in it, you will have to
227 * escape the dot when restricting dates. For example: ['03\\.08\\.03'].
230 <span id='Ext-picker-Date-cfg-disableAnim'> /**
231 </span> * @cfg {Boolean} disableAnim True to disable animations when showing the month picker. Defaults to <tt>false</tt>.
235 <span id='Ext-picker-Date-cfg-baseCls'> /**
236 </span> * @cfg {String} baseCls
237 * The base CSS class to apply to this components element (defaults to <tt>'x-datepicker'</tt>).
239 baseCls: Ext.baseCSSPrefix + 'datepicker',
241 <span id='Ext-picker-Date-cfg-selectedCls'> /**
242 </span> * @cfg {String} selectedCls
243 * The class to apply to the selected cell. Defaults to <tt>'x-datepicker-selected'</tt>
246 <span id='Ext-picker-Date-cfg-disabledCellCls'> /**
247 </span> * @cfg {String} disabledCellCls
248 * The class to apply to disabled cells. Defaults to <tt>'x-datepicker-disabled'</tt>
251 <span id='Ext-picker-Date-cfg-longDayFormat'> /**
252 </span> * @cfg {String} longDayFormat
253 * The format for displaying a date in a longer format. Defaults to <tt>'F d, Y'</tt>
255 longDayFormat: 'F d, Y',
257 <span id='Ext-picker-Date-cfg-keyNavConfig'> /**
258 </span> * @cfg {Object} keyNavConfig Specifies optional custom key event handlers for the {@link Ext.util.KeyNav}
259 * attached to this date picker. Must conform to the config format recognized by the {@link Ext.util.KeyNav}
260 * constructor. Handlers specified in this object will replace default handlers of the same name.
263 <span id='Ext-picker-Date-cfg-focusOnShow'> /**
264 </span> * @cfg {Boolean} focusOnShow
265 * True to automatically focus the picker on show. Defaults to <tt>false</tt>.
270 // Set by other components to stop the picker focus being updated when the value changes.
275 // default value used to initialise each date in the DatePicker
276 // (note: 12 noon was chosen because it steers well clear of all DST timezone changes)
277 initHour: 12, // 24-hour format
281 // private, inherit docs
282 initComponent : function() {
284 clearTime = Ext.Date.clearTime;
286 me.selectedCls = me.baseCls + '-selected';
287 me.disabledCellCls = me.baseCls + '-disabled';
288 me.prevCls = me.baseCls + '-prevday';
289 me.activeCls = me.baseCls + '-active';
290 me.nextCls = me.baseCls + '-prevday';
291 me.todayCls = me.baseCls + '-today';
292 me.dayNames = me.dayNames.slice(me.startDay).concat(me.dayNames.slice(0, me.startDay));
295 me.value = me.value ?
296 clearTime(me.value, true) : clearTime(new Date());
299 <span id='Ext-picker-Date-event-select'> /**
300 </span> * @event select
301 * Fires when a date is selected
302 * @param {DatePicker} this DatePicker
303 * @param {Date} date The selected date
308 me.initDisabledDays();
311 // private, inherit docs
312 onRender : function(container, position){
314 * days array for looping through 6 full weeks (6 weeks * 7 days)
315 * Note that we explicitly force the size here so the template creates
316 * all the appropriate cells.
320 days = new Array(me.numDays),
321 today = Ext.Date.format(new Date(), me.format);
328 Ext.apply(me.renderData, {
329 dayNames: me.dayNames,
330 ariaTitle: me.ariaTitle,
332 showToday: me.showToday,
333 prevText: me.prevText,
334 nextText: me.nextText,
337 me.getTpl('renderTpl').longDayFormat = me.longDayFormat;
339 Ext.apply(me.renderSelectors, {
340 eventEl: 'table.' + me.baseCls + '-inner',
341 prevEl: '.' + me.baseCls + '-prev a',
342 nextEl: '.' + me.baseCls + '-next a',
343 middleBtnEl: '.' + me.baseCls + '-month',
344 footerEl: '.' + me.baseCls + '-footer'
347 this.callParent(arguments);
348 me.el.unselectable();
350 me.cells = me.eventEl.select('tbody td');
351 me.textNodes = me.eventEl.query('tbody td span');
353 me.monthBtn = Ext.create('Ext.button.Split', {
355 tooltip: me.monthYearText,
356 renderTo: me.middleBtnEl
358 //~ me.middleBtnEl.down('button').addCls(Ext.baseCSSPrefix + 'btn-arrow');
361 me.todayBtn = Ext.create('Ext.button.Button', {
362 renderTo: me.footerEl,
363 text: Ext.String.format(me.todayText, today),
364 tooltip: Ext.String.format(me.todayTip, today),
365 handler: me.selectToday,
370 // private, inherit docs
371 initEvents: function(){
378 me.prevRepeater = Ext.create('Ext.util.ClickRepeater', me.prevEl, {
379 handler: me.showPrevMonth,
381 preventDefault: true,
385 me.nextRepeater = Ext.create('Ext.util.ClickRepeater', me.nextEl, {
386 handler: me.showNextMonth,
392 me.keyNav = Ext.create('Ext.util.KeyNav', me.eventEl, Ext.apply({
394 'left' : function(e){
398 me.update(eDate.add(me.activeDate, day, -1));
402 'right' : function(e){
406 me.update(eDate.add(me.activeDate, day, 1));
414 me.update(eDate.add(me.activeDate, day, -7));
418 'down' : function(e){
422 me.update(eDate.add(me.activeDate, day, 7));
425 'pageUp' : me.showNextMonth,
426 'pageDown' : me.showPrevMonth,
427 'enter' : function(e){
431 }, me.keyNavConfig));
434 me.todayKeyListener = me.eventEl.addKeyListener(Ext.EventObject.SPACE, me.selectToday, me);
436 me.mon(me.eventEl, 'mousewheel', me.handleMouseWheel, me);
437 me.mon(me.eventEl, 'click', me.handleDateClick, me, {delegate: 'a.' + me.baseCls + '-date'});
438 me.mon(me.monthBtn, 'click', me.showMonthPicker, me);
439 me.mon(me.monthBtn, 'arrowclick', me.showMonthPicker, me);
443 <span id='Ext-picker-Date-method-initDisabledDays'> /**
444 </span> * Setup the disabled dates regex based on config options
447 initDisabledDays : function(){
449 dd = me.disabledDates,
453 if(!me.disabledDatesRE && dd){
456 Ext.each(dd, function(d, i){
457 re += Ext.isDate(d) ? '^' + Ext.String.escapeRegex(Ext.Date.dateFormat(d, me.format)) + '$' : dd[i];
462 me.disabledDatesRE = new RegExp(re + ')');
466 <span id='Ext-picker-Date-method-setDisabledDates'> /**
467 </span> * Replaces any existing disabled dates with new values and refreshes the DatePicker.
468 * @param {Array/RegExp} disabledDates An array of date strings (see the {@link #disabledDates} config
469 * for details on supported values), or a JavaScript regular expression used to disable a pattern of dates.
470 * @return {Ext.picker.Date} this
472 setDisabledDates : function(dd){
476 me.disabledDates = dd;
477 me.disabledDatesRE = null;
479 me.disabledDatesRE = dd;
481 me.initDisabledDays();
482 me.update(me.value, true);
486 <span id='Ext-picker-Date-method-setDisabledDays'> /**
487 </span> * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
488 * @param {Array} disabledDays An array of disabled day indexes. See the {@link #disabledDays} config
489 * for details on supported values.
490 * @return {Ext.picker.Date} this
492 setDisabledDays : function(dd){
493 this.disabledDays = dd;
494 return this.update(this.value, true);
497 <span id='Ext-picker-Date-method-setMinDate'> /**
498 </span> * Replaces any existing {@link #minDate} with the new value and refreshes the DatePicker.
499 * @param {Date} value The minimum date that can be selected
500 * @return {Ext.picker.Date} this
502 setMinDate : function(dt){
504 return this.update(this.value, true);
507 <span id='Ext-picker-Date-method-setMaxDate'> /**
508 </span> * Replaces any existing {@link #maxDate} with the new value and refreshes the DatePicker.
509 * @param {Date} value The maximum date that can be selected
510 * @return {Ext.picker.Date} this
512 setMaxDate : function(dt){
514 return this.update(this.value, true);
517 <span id='Ext-picker-Date-method-setValue'> /**
518 </span> * Sets the value of the date field
519 * @param {Date} value The date to set
520 * @return {Ext.picker.Date} this
522 setValue : function(value){
523 this.value = Ext.Date.clearTime(value, true);
524 return this.update(this.value);
527 <span id='Ext-picker-Date-method-getValue'> /**
528 </span> * Gets the current selected value of the date field
529 * @return {Date} The selected date
531 getValue : function(){
537 this.update(this.activeDate);
540 // private, inherit docs
541 onEnable: function(){
543 this.setDisabledStatus(false);
544 this.update(this.activeDate);
548 // private, inherit docs
549 onDisable : function(){
551 this.setDisabledStatus(true);
554 <span id='Ext-picker-Date-method-setDisabledStatus'> /**
555 </span> * Set the disabled state of various internal components
557 * @param {Boolean} disabled
559 setDisabledStatus : function(disabled){
562 me.keyNav.setDisabled(disabled);
563 me.prevRepeater.setDisabled(disabled);
564 me.nextRepeater.setDisabled(disabled);
566 me.todayKeyListener.setDisabled(disabled);
567 me.todayBtn.setDisabled(disabled);
571 <span id='Ext-picker-Date-method-getActive'> /**
572 </span> * Get the current active date.
574 * @return {Date} The active date
576 getActive: function(){
577 return this.activeDate || me.value;
580 <span id='Ext-picker-Date-method-runAnimation'> /**
581 </span> * Run any animation required to hide/show the month picker.
583 * @param {Boolean} isHide True if it's a hide operation
585 runAnimation: function(isHide){
587 target: this.monthPicker,
591 Ext.fx.Manager.run();
597 Ext.create('Ext.fx.Anim', options);
600 <span id='Ext-picker-Date-method-hideMonthPicker'> /**
601 </span> * Hides the month picker, if it's visible.
602 * @return {Ext.picker.Date} this
604 hideMonthPicker : function(){
606 picker = me.monthPicker;
609 if (me.disableAnim) {
612 this.runAnimation(true);
618 <span id='Ext-picker-Date-method-showMonthPicker'> /**
619 </span> * Show the month picker
620 * @return {Ext.picker.Date} this
622 showMonthPicker : function(){
631 if (me.rendered && !me.disabled) {
633 picker = me.createMonthPicker();
635 picker.setSize(size);
636 picker.setValue(me.getActive());
638 if (me.disableAnim) {
639 picker.setPosition(-1, -1);
641 me.runAnimation(false);
647 <span id='Ext-picker-Date-method-createMonthPicker'> /**
648 </span> * Create the month picker instance
650 * @return {Ext.picker.Month} picker
652 createMonthPicker: function(){
654 picker = me.monthPicker;
657 me.monthPicker = picker = Ext.create('Ext.picker.Month', {
663 cancelclick: me.onCancelClick,
664 okclick: me.onOkClick,
665 yeardblclick: me.onOkClick,
666 monthdblclick: me.onOkClick
670 me.on('beforehide', me.hideMonthPicker, me);
675 <span id='Ext-picker-Date-method-onOkClick'> /**
676 </span> * Respond to an ok click on the month picker
679 onOkClick: function(picker, value){
683 date = new Date(year, month, me.getActive().getDate());
685 if (date.getMonth() !== month) {
686 // 'fix' the JS rolling date conversion if needed
687 date = new Date(year, month, 1).getLastDateOfMonth();
690 me.hideMonthPicker();
693 <span id='Ext-picker-Date-method-onCancelClick'> /**
694 </span> * Respond to a cancel click on the month picker
697 onCancelClick: function(){
698 this.hideMonthPicker();
701 <span id='Ext-picker-Date-method-showPrevMonth'> /**
702 </span> * Show the previous month.
703 * @return {Ext.picker.Date} this
705 showPrevMonth : function(e){
706 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, -1));
709 <span id='Ext-picker-Date-method-showNextMonth'> /**
710 </span> * Show the next month.
711 * @return {Ext.picker.Date} this
713 showNextMonth : function(e){
714 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, 1));
717 <span id='Ext-picker-Date-method-showPrevYear'> /**
718 </span> * Show the previous year.
719 * @return {Ext.picker.Date} this
721 showPrevYear : function(){
722 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, -1));
725 <span id='Ext-picker-Date-method-showNextYear'> /**
726 </span> * Show the next year.
727 * @return {Ext.picker.Date} this
729 showNextYear : function(){
730 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, 1));
733 <span id='Ext-picker-Date-method-handleMouseWheel'> /**
734 </span> * Respond to the mouse wheel event
736 * @param {Ext.EventObject} e
738 handleMouseWheel : function(e){
741 var delta = e.getWheelDelta();
743 this.showPrevMonth();
744 } else if(delta < 0){
745 this.showNextMonth();
750 <span id='Ext-picker-Date-method-handleDateClick'> /**
751 </span> * Respond to a date being clicked in the picker
753 * @param {Ext.EventObject} e
754 * @param {HTMLElement} t
756 handleDateClick : function(e, t){
758 handler = me.handler;
761 if(!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)){
762 me.cancelFocus = me.focusOnSelect === false;
763 me.setValue(new Date(t.dateValue));
764 delete me.cancelFocus;
765 me.fireEvent('select', me, me.value);
767 handler.call(me.scope || me, me, me.value);
769 // event handling is turned off on hide
770 // when we are using the picker in a field
771 // therefore onSelect comes AFTER the select
777 <span id='Ext-picker-Date-method-onSelect'> /**
778 </span> * Perform any post-select actions
781 onSelect: function() {
782 if (this.hideOnSelect) {
787 <span id='Ext-picker-Date-method-selectToday'> /**
788 </span> * Sets the current value to today.
789 * @return {Ext.picker.Date} this
791 selectToday : function(){
794 handler = me.handler;
796 if(btn && !btn.disabled){
797 me.setValue(Ext.Date.clearTime(new Date()));
798 me.fireEvent('select', me, me.value);
800 handler.call(me.scope || me, me, me.value);
807 <span id='Ext-picker-Date-method-selectedUpdate'> /**
808 </span> * Update the selected cell
810 * @param {Date} date The new date
811 * @param {Date} active The active date
813 selectedUpdate: function(date, active){
817 cls = me.selectedCls;
819 cells.removeCls(cls);
820 cells.each(function(c){
821 if (c.dom.firstChild.dateValue == t) {
822 me.el.dom.setAttribute('aria-activedescendent', c.dom.id);
824 if(me.isVisible() && !me.cancelFocus){
825 Ext.fly(c.dom.firstChild).focus(50);
832 <span id='Ext-picker-Date-method-fullUpdate'> /**
833 </span> * Update the contents of the picker for a new month
835 * @param {Date} date The new date
836 * @param {Date} active The active date
838 fullUpdate: function(date, active){
840 cells = me.cells.elements,
841 textNodes = me.textNodes,
842 disabledCls = me.disabledCellCls,
846 visible = me.isVisible(),
847 sel = +eDate.clearTime(date, true),
848 today = +eDate.clearTime(new Date()),
849 min = me.minDate ? eDate.clearTime(me.minDate, true) : Number.NEGATIVE_INFINITY,
850 max = me.maxDate ? eDate.clearTime(me.maxDate, true) : Number.POSITIVE_INFINITY,
851 ddMatch = me.disabledDatesRE,
852 ddText = me.disabledDatesText,
853 ddays = me.disabledDays ? me.disabledDays.join('') : false,
854 ddaysText = me.disabledDaysText,
856 days = eDate.getDaysInMonth(date),
857 firstOfMonth = eDate.getFirstDateOfMonth(date),
858 startingPos = firstOfMonth.getDay() - me.startDay,
859 previousMonth = eDate.add(date, eDate.MONTH, -1),
860 longDayFormat = me.longDayFormat,
871 if (startingPos < 0) {
876 prevStart = eDate.getDaysInMonth(previousMonth) - startingPos;
877 current = new Date(previousMonth.getFullYear(), previousMonth.getMonth(), prevStart, me.initHour);
880 tempDate = eDate.clearTime(new Date());
881 disableToday = (tempDate < min || tempDate > max ||
882 (ddMatch && format && ddMatch.test(eDate.dateFormat(tempDate, format))) ||
883 (ddays && ddays.indexOf(tempDate.getDay()) != -1));
886 me.todayBtn.setDisabled(disableToday);
887 me.todayKeyListener.setDisabled(disableToday);
891 setCellClass = function(cell){
892 value = +eDate.clearTime(current, true);
893 cell.title = eDate.format(current, longDayFormat);
894 // store dateValue number as an expando
895 cell.firstChild.dateValue = value;
897 cell.className += ' ' + me.todayCls;
898 cell.title = me.todayText;
901 cell.className += ' ' + me.selectedCls;
902 me.el.dom.setAttribute('aria-activedescendant', cell.id);
903 if (visible && me.floating) {
904 Ext.fly(cell.firstChild).focus(50);
909 cell.className = disabledCls;
910 cell.title = me.minText;
914 cell.className = disabledCls;
915 cell.title = me.maxText;
919 if(ddays.indexOf(current.getDay()) != -1){
920 cell.title = ddaysText;
921 cell.className = disabledCls;
924 if(ddMatch && format){
925 formatValue = eDate.dateFormat(current, format);
926 if(ddMatch.test(formatValue)){
927 cell.title = ddText.replace('%0', formatValue);
928 cell.className = disabledCls;
933 for(; i < me.numDays; ++i) {
934 if (i < startingPos) {
935 html = (++prevStart);
937 } else if (i >= days) {
938 html = (++extraDays);
941 html = i - startingPos + 1;
944 textNodes[i].innerHTML = html;
945 cells[i].className = cls;
946 current.setDate(current.getDate() + 1);
947 setCellClass(cells[i]);
950 me.monthBtn.setText(me.monthNames[date.getMonth()] + ' ' + date.getFullYear());
953 <span id='Ext-picker-Date-method-update'> /**
954 </span> * Update the contents of the picker
956 * @param {Date} date The new date
957 * @param {Boolean} forceRefresh True to force a full refresh
959 update : function(date, forceRefresh){
961 active = me.activeDate;
964 me.activeDate = date;
965 if(!forceRefresh && active && me.el && active.getMonth() == date.getMonth() && active.getFullYear() == date.getFullYear()){
966 me.selectedUpdate(date, active);
968 me.fullUpdate(date, active);
974 // private, inherit docs
975 beforeDestroy : function() {
989 delete me.cells.elements;
993 // private, inherit docs
995 this.callParent(arguments);
996 if (this.focusOnShow) {
1002 // After dependencies have loaded:
1004 var proto = this.prototype;
1006 proto.monthNames = Ext.Date.monthNames;
1008 proto.dayNames = Ext.Date.dayNames;
1010 proto.format = Ext.Date.defaultFormat;