1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-picker.Date-method-constructor'><span id='Ext-picker.Date'>/**
2 </span></span> * @class Ext.picker.Date
3 * @extends Ext.Component
4 * <p>A date picker. This class is used by the {@link Ext.form.field.Date} field to allow browsing and
5 * selection of valid dates in a popup next to the field, but may also be used with other components.</p>
6 * <p>Typically you will need to implement a handler function to be notified when the user chooses a color from the
7 * picker; you can register the handler using the {@link #select} event, or by implementing the {@link #handler}
9 * <p>By default the user will be allowed to pick any date; this can be changed by using the {@link #minDate},
10 * {@link #maxDate}, {@link #disabledDays}, {@link #disabledDatesRE}, and/or {@link #disabledDates} configs.</p>
11 * <p>All the string values documented below may be overridden by including an Ext locale file in your page.</p>
12 * <p>Example usage:</p>
13 * <pre><code>new Ext.panel.Panel({
14 title: 'Choose a future date:',
17 renderTo: Ext.getBody(),
21 handler: function(picker, date) {
22 // do something with the selected date
25 });</code></pre>
26 * {@img Ext.picker.Date/Ext.picker.Date.png Ext.picker.Date component}
29 * Create a new DatePicker
30 * @param {Object} config The config object
34 Ext.define('Ext.picker.Date', {
35 extend: 'Ext.Component',
40 'Ext.util.ClickRepeater',
46 alias: 'widget.datepicker',
47 alternateClassName: 'Ext.DatePicker',
50 '<div class="{cls}" id="{id}" role="grid" title="{ariaTitle} {value:this.longDay}">',
51 '<div role="presentation" class="{baseCls}-header">',
52 '<div class="{baseCls}-prev"><a href="#" role="button" title="{prevText}"></a></div>',
53 '<div class="{baseCls}-month"></div>',
54 '<div class="{baseCls}-next"><a href="#" role="button" title="{nextText}"></a></div>',
56 '<table class="{baseCls}-inner" cellspacing="0" role="presentation">',
57 '<thead role="presentation"><tr role="presentation">',
58 '<tpl for="dayNames">',
59 '<th role="columnheader" title="{.}"><span>{.:this.firstInitial}</span></th>',
61 '</tr></thead>',
62 '<tbody role="presentation"><tr role="presentation">',
63 '<tpl for="days">',
64 '{#:this.isEndOfWeek}',
65 '<td role="gridcell" id="{[Ext.id()]}">',
66 '<a role="presentation" href="#" hidefocus="on" class="{parent.baseCls}-date" tabIndex="1">',
67 '<em role="presentation"><span role="presentation"></span></em>',
71 '</tr></tbody>',
73 '<tpl if="showToday">',
74 '<div role="presentation" class="{baseCls}-footer"></div>',
78 firstInitial: function(value) {
79 return value.substr(0,1);
81 isEndOfWeek: function(value) {
82 // convert from 1 based index to 0 based
83 // by decrementing value once.
85 var end = value % 7 === 0 && value !== 0;
86 return end ? '</tr><tr role="row">' : '';
88 longDay: function(value){
89 return Ext.Date.format(value, this.longDayFormat);
94 ariaTitle: 'Date Picker',
95 <span id='Ext-picker.Date-cfg-todayText'> /**
96 </span> * @cfg {String} todayText
97 * The text to display on the button that selects the current date (defaults to <code>'Today'</code>)
100 <span id='Ext-picker.Date-cfg-handler'> /**
101 </span> * @cfg {Function} handler
102 * Optional. A function that will handle the select event of this picker.
103 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
104 * <li><code>picker</code> : Ext.picker.Date <div class="sub-desc">This Date picker.</div></li>
105 * <li><code>date</code> : Date <div class="sub-desc">The selected date.</div></li>
106 * </ul></div>
108 <span id='Ext-picker.Date-cfg-scope'> /**
109 </span> * @cfg {Object} scope
110 * The scope (<code><b>this</b></code> reference) in which the <code>{@link #handler}</code>
111 * function will be called. Defaults to this DatePicker instance.
113 <span id='Ext-picker.Date-cfg-todayTip'> /**
114 </span> * @cfg {String} todayTip
115 * A string used to format the message for displaying in a tooltip over the button that
116 * selects the current date. Defaults to <code>'{0} (Spacebar)'</code> where
117 * the <code>{0}</code> token is replaced by today's date.
119 todayTip : '{0} (Spacebar)',
120 <span id='Ext-picker.Date-cfg-minText'> /**
121 </span> * @cfg {String} minText
122 * The error text to display if the minDate validation fails (defaults to <code>'This date is before the minimum date'</code>)
124 minText : 'This date is before the minimum date',
125 <span id='Ext-picker.Date-cfg-maxText'> /**
126 </span> * @cfg {String} maxText
127 * The error text to display if the maxDate validation fails (defaults to <code>'This date is after the maximum date'</code>)
129 maxText : 'This date is after the maximum date',
130 <span id='Ext-picker.Date-cfg-format'> /**
131 </span> * @cfg {String} format
132 * The default date format string which can be overriden for localization support. The format must be
133 * valid according to {@link Ext.Date#parse} (defaults to {@link Ext.Date#defaultFormat}).
135 <span id='Ext-picker.Date-cfg-disabledDaysText'> /**
136 </span> * @cfg {String} disabledDaysText
137 * The tooltip to display when the date falls on a disabled day (defaults to <code>'Disabled'</code>)
139 disabledDaysText : 'Disabled',
140 <span id='Ext-picker.Date-cfg-disabledDatesText'> /**
141 </span> * @cfg {String} disabledDatesText
142 * The tooltip text to display when the date falls on a disabled date (defaults to <code>'Disabled'</code>)
144 disabledDatesText : 'Disabled',
145 <span id='Ext-picker.Date-cfg-monthNames'> /**
146 </span> * @cfg {Array} monthNames
147 * An array of textual month names which can be overriden for localization support (defaults to Ext.Date.monthNames)
149 <span id='Ext-picker.Date-cfg-dayNames'> /**
150 </span> * @cfg {Array} dayNames
151 * An array of textual day names which can be overriden for localization support (defaults to Ext.Date.dayNames)
153 <span id='Ext-picker.Date-cfg-nextText'> /**
154 </span> * @cfg {String} nextText
155 * The next month navigation button tooltip (defaults to <code>'Next Month (Control+Right)'</code>)
157 nextText : 'Next Month (Control+Right)',
158 <span id='Ext-picker.Date-cfg-prevText'> /**
159 </span> * @cfg {String} prevText
160 * The previous month navigation button tooltip (defaults to <code>'Previous Month (Control+Left)'</code>)
162 prevText : 'Previous Month (Control+Left)',
163 <span id='Ext-picker.Date-cfg-monthYearText'> /**
164 </span> * @cfg {String} monthYearText
165 * The header month selector tooltip (defaults to <code>'Choose a month (Control+Up/Down to move years)'</code>)
167 monthYearText : 'Choose a month (Control+Up/Down to move years)',
168 <span id='Ext-picker.Date-cfg-startDay'> /**
169 </span> * @cfg {Number} startDay
170 * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
173 <span id='Ext-picker.Date-cfg-showToday'> /**
174 </span> * @cfg {Boolean} showToday
175 * False to hide the footer area containing the Today button and disable the keyboard handler for spacebar
176 * that selects the current date (defaults to <code>true</code>).
179 <span id='Ext-picker.Date-cfg-minDate'> /**
180 </span> * @cfg {Date} minDate
181 * Minimum allowable date (JavaScript date object, defaults to null)
183 <span id='Ext-picker.Date-cfg-maxDate'> /**
184 </span> * @cfg {Date} maxDate
185 * Maximum allowable date (JavaScript date object, defaults to null)
187 <span id='Ext-picker.Date-cfg-disabledDays'> /**
188 </span> * @cfg {Array} disabledDays
189 * An array of days to disable, 0-based. For example, [0, 6] disables Sunday and Saturday (defaults to null).
191 <span id='Ext-picker.Date-cfg-disabledDatesRE'> /**
192 </span> * @cfg {RegExp} disabledDatesRE
193 * JavaScript regular expression used to disable a pattern of dates (defaults to null). The {@link #disabledDates}
194 * config will generate this regex internally, but if you specify disabledDatesRE it will take precedence over the
195 * disabledDates value.
197 <span id='Ext-picker.Date-cfg-disabledDates'> /**
198 </span> * @cfg {Array} disabledDates
199 * An array of 'dates' to disable, as strings. These strings will be used to build a dynamic regular
200 * expression so they are very powerful. Some examples:
202 * <li>['03/08/2003', '09/16/2003'] would disable those exact dates</li>
203 * <li>['03/08', '09/16'] would disable those days for every year</li>
204 * <li>['^03/08'] would only match the beginning (useful if you are using short years)</li>
205 * <li>['03/../2006'] would disable every day in March 2006</li>
206 * <li>['^03'] would disable every day in every March</li>
208 * Note that the format of the dates included in the array should exactly match the {@link #format} config.
209 * In order to support regular expressions, if you are using a date format that has '.' in it, you will have to
210 * escape the dot when restricting dates. For example: ['03\\.08\\.03'].
213 <span id='Ext-picker.Date-cfg-disableAnim'> /**
214 </span> * @cfg {Boolean} disableAnim True to disable animations when showing the month picker. Defaults to <tt>false</tt>.
218 <span id='Ext-picker.Date-cfg-baseCls'> /**
219 </span> * @cfg {String} baseCls
220 * The base CSS class to apply to this components element (defaults to <tt>'x-datepicker'</tt>).
222 baseCls: Ext.baseCSSPrefix + 'datepicker',
224 <span id='Ext-picker.Date-cfg-selectedCls'> /**
225 </span> * @cfg {String} selectedCls
226 * The class to apply to the selected cell. Defaults to <tt>'x-datepicker-selected'</tt>
229 <span id='Ext-picker.Date-cfg-disabledCellCls'> /**
230 </span> * @cfg {String} disabledCellCls
231 * The class to apply to disabled cells. Defaults to <tt>'x-datepicker-disabled'</tt>
234 <span id='Ext-picker.Date-cfg-longDayFormat'> /**
235 </span> * @cfg {String} longDayFormat
236 * The format for displaying a date in a longer format. Defaults to <tt>'F d, Y'</tt>
238 longDayFormat: 'F d, Y',
240 <span id='Ext-picker.Date-cfg-keyNavConfig'> /**
241 </span> * @cfg {Object} keyNavConfig Specifies optional custom key event handlers for the {@link Ext.util.KeyNav}
242 * attached to this date picker. Must conform to the config format recognized by the {@link Ext.util.KeyNav}
243 * constructor. Handlers specified in this object will replace default handlers of the same name.
246 <span id='Ext-picker.Date-cfg-focusOnShow'> /**
247 </span> * @cfg {Boolean} focusOnShow
248 * True to automatically focus the picker on show. Defaults to <tt>false</tt>.
253 // Set by other components to stop the picker focus being updated when the value changes.
258 // default value used to initialise each date in the DatePicker
259 // (note: 12 noon was chosen because it steers well clear of all DST timezone changes)
260 initHour: 12, // 24-hour format
264 // private, inherit docs
265 initComponent : function() {
267 clearTime = Ext.Date.clearTime;
269 me.selectedCls = me.baseCls + '-selected';
270 me.disabledCellCls = me.baseCls + '-disabled';
271 me.prevCls = me.baseCls + '-prevday';
272 me.activeCls = me.baseCls + '-active';
273 me.nextCls = me.baseCls + '-prevday';
274 me.todayCls = me.baseCls + '-today';
275 me.dayNames = me.dayNames.slice(me.startDay).concat(me.dayNames.slice(0, me.startDay));
278 me.value = me.value ?
279 clearTime(me.value, true) : clearTime(new Date());
282 <span id='Ext-picker.Date-event-select'> /**
283 </span> * @event select
284 * Fires when a date is selected
285 * @param {DatePicker} this DatePicker
286 * @param {Date} date The selected date
291 me.initDisabledDays();
294 // private, inherit docs
295 onRender : function(container, position){
297 * days array for looping through 6 full weeks (6 weeks * 7 days)
298 * Note that we explicitly force the size here so the template creates
299 * all the appropriate cells.
303 days = new Array(me.numDays),
304 today = Ext.Date.format(new Date(), me.format);
311 Ext.apply(me.renderData, {
312 dayNames: me.dayNames,
313 ariaTitle: me.ariaTitle,
315 showToday: me.showToday,
316 prevText: me.prevText,
317 nextText: me.nextText,
320 me.getTpl('renderTpl').longDayFormat = me.longDayFormat;
322 Ext.apply(me.renderSelectors, {
323 eventEl: 'table.' + me.baseCls + '-inner',
324 prevEl: '.' + me.baseCls + '-prev a',
325 nextEl: '.' + me.baseCls + '-next a',
326 middleBtnEl: '.' + me.baseCls + '-month',
327 footerEl: '.' + me.baseCls + '-footer'
330 this.callParent(arguments);
331 me.el.unselectable();
333 me.cells = me.eventEl.select('tbody td');
334 me.textNodes = me.eventEl.query('tbody td span');
336 me.monthBtn = Ext.create('Ext.button.Split', {
338 tooltip: me.monthYearText,
339 renderTo: me.middleBtnEl
341 //~ me.middleBtnEl.down('button').addCls(Ext.baseCSSPrefix + 'btn-arrow');
344 me.todayBtn = Ext.create('Ext.button.Button', {
345 renderTo: me.footerEl,
346 text: Ext.String.format(me.todayText, today),
347 tooltip: Ext.String.format(me.todayTip, today),
348 handler: me.selectToday,
353 // private, inherit docs
354 initEvents: function(){
361 me.prevRepeater = Ext.create('Ext.util.ClickRepeater', me.prevEl, {
362 handler: me.showPrevMonth,
364 preventDefault: true,
368 me.nextRepeater = Ext.create('Ext.util.ClickRepeater', me.nextEl, {
369 handler: me.showNextMonth,
375 me.keyNav = Ext.create('Ext.util.KeyNav', me.eventEl, Ext.apply({
377 'left' : function(e){
381 me.update(eDate.add(me.activeDate, day, -1));
385 'right' : function(e){
389 me.update(eDate.add(me.activeDate, day, 1));
397 me.update(eDate.add(me.activeDate, day, -7));
401 'down' : function(e){
405 me.update(eDate.add(me.activeDate, day, 7));
408 'pageUp' : me.showNextMonth,
409 'pageDown' : me.showPrevMonth,
410 'enter' : function(e){
414 }, me.keyNavConfig));
417 me.todayKeyListener = me.eventEl.addKeyListener(Ext.EventObject.SPACE, me.selectToday, me);
419 me.mon(me.eventEl, 'mousewheel', me.handleMouseWheel, me);
420 me.mon(me.eventEl, 'click', me.handleDateClick, me, {delegate: 'a.' + me.baseCls + '-date'});
421 me.mon(me.monthBtn, 'click', me.showMonthPicker, me);
422 me.mon(me.monthBtn, 'arrowclick', me.showMonthPicker, me);
426 <span id='Ext-picker.Date-method-initDisabledDays'> /**
427 </span> * Setup the disabled dates regex based on config options
430 initDisabledDays : function(){
432 dd = me.disabledDates,
436 if(!me.disabledDatesRE && dd){
439 Ext.each(dd, function(d, i){
440 re += Ext.isDate(d) ? '^' + Ext.String.escapeRegex(Ext.Date.dateFormat(d, me.format)) + '$' : dd[i];
445 me.disabledDatesRE = new RegExp(re + ')');
449 <span id='Ext-picker.Date-method-setDisabledDates'> /**
450 </span> * Replaces any existing disabled dates with new values and refreshes the DatePicker.
451 * @param {Array/RegExp} disabledDates An array of date strings (see the {@link #disabledDates} config
452 * for details on supported values), or a JavaScript regular expression used to disable a pattern of dates.
453 * @return {Ext.picker.Date} this
455 setDisabledDates : function(dd){
459 me.disabledDates = dd;
460 me.disabledDatesRE = null;
462 me.disabledDatesRE = dd;
464 me.initDisabledDays();
465 me.update(me.value, true);
469 <span id='Ext-picker.Date-method-setDisabledDays'> /**
470 </span> * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
471 * @param {Array} disabledDays An array of disabled day indexes. See the {@link #disabledDays} config
472 * for details on supported values.
473 * @return {Ext.picker.Date} this
475 setDisabledDays : function(dd){
476 this.disabledDays = dd;
477 return this.update(this.value, true);
480 <span id='Ext-picker.Date-method-setMinDate'> /**
481 </span> * Replaces any existing {@link #minDate} with the new value and refreshes the DatePicker.
482 * @param {Date} value The minimum date that can be selected
483 * @return {Ext.picker.Date} this
485 setMinDate : function(dt){
487 return this.update(this.value, true);
490 <span id='Ext-picker.Date-method-setMaxDate'> /**
491 </span> * Replaces any existing {@link #maxDate} with the new value and refreshes the DatePicker.
492 * @param {Date} value The maximum date that can be selected
493 * @return {Ext.picker.Date} this
495 setMaxDate : function(dt){
497 return this.update(this.value, true);
500 <span id='Ext-picker.Date-method-setValue'> /**
501 </span> * Sets the value of the date field
502 * @param {Date} value The date to set
503 * @return {Ext.picker.Date} this
505 setValue : function(value){
506 this.value = Ext.Date.clearTime(value, true);
507 return this.update(this.value);
510 <span id='Ext-picker.Date-method-getValue'> /**
511 </span> * Gets the current selected value of the date field
512 * @return {Date} The selected date
514 getValue : function(){
520 this.update(this.activeDate);
523 // private, inherit docs
524 onEnable: function(){
526 this.setDisabledStatus(false);
527 this.update(this.activeDate);
531 // private, inherit docs
532 onDisable : function(){
534 this.setDisabledStatus(true);
537 <span id='Ext-picker.Date-method-setDisabledStatus'> /**
538 </span> * Set the disabled state of various internal components
540 * @param {Boolean} disabled
542 setDisabledStatus : function(disabled){
545 me.keyNav.setDisabled(disabled);
546 me.prevRepeater.setDisabled(disabled);
547 me.nextRepeater.setDisabled(disabled);
549 me.todayKeyListener.setDisabled(disabled);
550 me.todayBtn.setDisabled(disabled);
554 <span id='Ext-picker.Date-method-getActive'> /**
555 </span> * Get the current active date.
557 * @return {Date} The active date
559 getActive: function(){
560 return this.activeDate || me.value;
563 <span id='Ext-picker.Date-method-runAnimation'> /**
564 </span> * Run any animation required to hide/show the month picker.
566 * @param {Boolean} isHide True if it's a hide operation
568 runAnimation: function(isHide){
570 target: this.monthPicker,
574 Ext.fx.Manager.run();
580 Ext.create('Ext.fx.Anim', options);
583 <span id='Ext-picker.Date-method-hideMonthPicker'> /**
584 </span> * Hides the month picker, if it's visible.
585 * @return {Ext.picker.Date} this
587 hideMonthPicker : function(){
589 picker = me.monthPicker;
592 if (me.disableAnim) {
595 this.runAnimation(true);
601 <span id='Ext-picker.Date-method-showMonthPicker'> /**
602 </span> * Show the month picker
603 * @return {Ext.picker.Date} this
605 showMonthPicker : function(){
614 if (me.rendered && !me.disabled) {
616 picker = me.createMonthPicker();
618 picker.setSize(size);
619 picker.setValue(me.getActive());
621 if (me.disableAnim) {
622 picker.setPosition(-1, -1);
624 me.runAnimation(false);
630 <span id='Ext-picker.Date-method-createMonthPicker'> /**
631 </span> * Create the month picker instance
633 * @return {Ext.picker.Month} picker
635 createMonthPicker: function(){
637 picker = me.monthPicker;
640 me.monthPicker = picker = Ext.create('Ext.picker.Month', {
646 cancelclick: me.onCancelClick,
647 okclick: me.onOkClick,
648 yeardblclick: me.onOkClick,
649 monthdblclick: me.onOkClick
653 me.on('beforehide', me.hideMonthPicker, me);
658 <span id='Ext-picker.Date-method-onOkClick'> /**
659 </span> * Respond to an ok click on the month picker
662 onOkClick: function(picker, value){
666 date = new Date(year, month, me.getActive().getDate());
668 if (date.getMonth() !== month) {
669 // 'fix' the JS rolling date conversion if needed
670 date = new Date(year, month, 1).getLastDateOfMonth();
673 me.hideMonthPicker();
676 <span id='Ext-picker.Date-method-onCancelClick'> /**
677 </span> * Respond to a cancel click on the month picker
680 onCancelClick: function(){
681 this.hideMonthPicker();
684 <span id='Ext-picker.Date-method-showPrevMonth'> /**
685 </span> * Show the previous month.
686 * @return {Ext.picker.Date} this
688 showPrevMonth : function(e){
689 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, -1));
692 <span id='Ext-picker.Date-method-showNextMonth'> /**
693 </span> * Show the next month.
694 * @return {Ext.picker.Date} this
696 showNextMonth : function(e){
697 return this.update(Ext.Date.add(this.activeDate, Ext.Date.MONTH, 1));
700 <span id='Ext-picker.Date-method-showPrevYear'> /**
701 </span> * Show the previous year.
702 * @return {Ext.picker.Date} this
704 showPrevYear : function(){
705 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, -1));
708 <span id='Ext-picker.Date-method-showNextYear'> /**
709 </span> * Show the next year.
710 * @return {Ext.picker.Date} this
712 showNextYear : function(){
713 this.update(Ext.Date.add(this.activeDate, Ext.Date.YEAR, 1));
716 <span id='Ext-picker.Date-method-handleMouseWheel'> /**
717 </span> * Respond to the mouse wheel event
719 * @param {Ext.EventObject} e
721 handleMouseWheel : function(e){
724 var delta = e.getWheelDelta();
726 this.showPrevMonth();
727 } else if(delta < 0){
728 this.showNextMonth();
733 <span id='Ext-picker.Date-method-handleDateClick'> /**
734 </span> * Respond to a date being clicked in the picker
736 * @param {Ext.EventObject} e
737 * @param {HTMLElement} t
739 handleDateClick : function(e, t){
741 handler = me.handler;
744 if(!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)){
745 me.cancelFocus = me.focusOnSelect === false;
746 me.setValue(new Date(t.dateValue));
747 delete me.cancelFocus;
748 me.fireEvent('select', me, me.value);
750 handler.call(me.scope || me, me, me.value);
752 // event handling is turned off on hide
753 // when we are using the picker in a field
754 // therefore onSelect comes AFTER the select
760 <span id='Ext-picker.Date-method-onSelect'> /**
761 </span> * Perform any post-select actions
764 onSelect: function() {
765 if (this.hideOnSelect) {
770 <span id='Ext-picker.Date-method-selectToday'> /**
771 </span> * Sets the current value to today.
772 * @return {Ext.picker.Date} this
774 selectToday : function(){
777 handler = me.handler;
779 if(btn && !btn.disabled){
780 me.setValue(Ext.Date.clearTime(new Date()));
781 me.fireEvent('select', me, me.value);
783 handler.call(me.scope || me, me, me.value);
790 <span id='Ext-picker.Date-method-selectedUpdate'> /**
791 </span> * Update the selected cell
793 * @param {Date} date The new date
794 * @param {Date} active The active date
796 selectedUpdate: function(date, active){
800 cls = me.selectedCls;
802 cells.removeCls(cls);
803 cells.each(function(c){
804 if (c.dom.firstChild.dateValue == t) {
805 me.el.dom.setAttribute('aria-activedescendent', c.dom.id);
807 if(me.isVisible() && !me.cancelFocus){
808 Ext.fly(c.dom.firstChild).focus(50);
815 <span id='Ext-picker.Date-method-fullUpdate'> /**
816 </span> * Update the contents of the picker for a new month
818 * @param {Date} date The new date
819 * @param {Date} active The active date
821 fullUpdate: function(date, active){
823 cells = me.cells.elements,
824 textNodes = me.textNodes,
825 disabledCls = me.disabledCellCls,
829 visible = me.isVisible(),
830 sel = +eDate.clearTime(date, true),
831 today = +eDate.clearTime(new Date()),
832 min = me.minDate ? eDate.clearTime(me.minDate, true) : Number.NEGATIVE_INFINITY,
833 max = me.maxDate ? eDate.clearTime(me.maxDate, true) : Number.POSITIVE_INFINITY,
834 ddMatch = me.disabledDatesRE,
835 ddText = me.disabledDatesText,
836 ddays = me.disabledDays ? me.disabledDays.join('') : false,
837 ddaysText = me.disabledDaysText,
839 days = eDate.getDaysInMonth(date),
840 firstOfMonth = eDate.getFirstDateOfMonth(date),
841 startingPos = firstOfMonth.getDay() - me.startDay,
842 previousMonth = eDate.add(date, eDate.MONTH, -1),
843 longDayFormat = me.longDayFormat,
854 if (startingPos < 0) {
859 prevStart = eDate.getDaysInMonth(previousMonth) - startingPos;
860 current = new Date(previousMonth.getFullYear(), previousMonth.getMonth(), prevStart, me.initHour);
863 tempDate = eDate.clearTime(new Date());
864 disableToday = (tempDate < min || tempDate > max ||
865 (ddMatch && format && ddMatch.test(eDate.dateFormat(tempDate, format))) ||
866 (ddays && ddays.indexOf(tempDate.getDay()) != -1));
869 me.todayBtn.setDisabled(disableToday);
870 me.todayKeyListener.setDisabled(disableToday);
874 setCellClass = function(cell){
875 value = +eDate.clearTime(current, true);
876 cell.title = eDate.format(current, longDayFormat);
877 // store dateValue number as an expando
878 cell.firstChild.dateValue = value;
880 cell.className += ' ' + me.todayCls;
881 cell.title = me.todayText;
884 cell.className += ' ' + me.selectedCls;
885 me.el.dom.setAttribute('aria-activedescendant', cell.id);
886 if (visible && me.floating) {
887 Ext.fly(cell.firstChild).focus(50);
892 cell.className = disabledCls;
893 cell.title = me.minText;
897 cell.className = disabledCls;
898 cell.title = me.maxText;
902 if(ddays.indexOf(current.getDay()) != -1){
903 cell.title = ddaysText;
904 cell.className = disabledCls;
907 if(ddMatch && format){
908 formatValue = eDate.dateFormat(current, format);
909 if(ddMatch.test(formatValue)){
910 cell.title = ddText.replace('%0', formatValue);
911 cell.className = disabledCls;
916 for(; i < me.numDays; ++i) {
917 if (i < startingPos) {
918 html = (++prevStart);
920 } else if (i >= days) {
921 html = (++extraDays);
924 html = i - startingPos + 1;
927 textNodes[i].innerHTML = html;
928 cells[i].className = cls;
929 current.setDate(current.getDate() + 1);
930 setCellClass(cells[i]);
933 me.monthBtn.setText(me.monthNames[date.getMonth()] + ' ' + date.getFullYear());
936 <span id='Ext-picker.Date-method-update'> /**
937 </span> * Update the contents of the picker
939 * @param {Date} date The new date
940 * @param {Boolean} forceRefresh True to force a full refresh
942 update : function(date, forceRefresh){
944 active = me.activeDate;
947 me.activeDate = date;
948 if(!forceRefresh && active && me.el && active.getMonth() == date.getMonth() && active.getFullYear() == date.getFullYear()){
949 me.selectedUpdate(date, active);
951 me.fullUpdate(date, active);
957 // private, inherit docs
958 beforeDestroy : function() {
972 delete me.cells.elements;
976 // private, inherit docs
978 this.callParent(arguments);
979 if (this.focusOnShow) {
985 // After dependencies have loaded:
987 var proto = this.prototype;
989 proto.monthNames = Ext.Date.monthNames;
991 proto.dayNames = Ext.Date.dayNames;
993 proto.format = Ext.Date.defaultFormat;
995 </pre></pre></body></html>