Roo/bootstrap/TimeField.js
[roojs1] / Roo / bootstrap / TimeField.js
1 /*
2  * - LGPL
3  *
4  * TimeField
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.TimeField
10  * @extends Roo.bootstrap.Input
11  * Bootstrap DateField class
12  * 
13  * 
14  * @constructor
15  * Create a new TimeField
16  * @param {Object} config The config object
17  */
18
19 Roo.bootstrap.TimeField = function(config){
20     Roo.bootstrap.TimeField.superclass.constructor.call(this, config);
21 };
22
23 Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
24     
25     /**
26      * @cfg {String} format
27      * The default time format string which can be overriden for localization support.  The format must be
28      * valid according to {@link Date#parseDate} (defaults to 'H:i').
29      */
30     format : "H:i",
31     
32     
33     UTCDate: function()
34     {
35         return new Date(Date.UTC.apply(Date, arguments));
36     },
37     
38     UTCTime: function()
39     {
40         return new Date(Date.UTC.apply(Date, arguments));
41     },
42     
43     UTCToday: function()
44     {
45         var today = new Date();
46         return this.UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
47     },
48     
49     UTCTodayTime: function()
50     {
51         var today = new Date();
52         return this.UTCTime(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate(), today.getUTCHours(), today.getUTCMinutes());
53     },
54     
55     getDate: function() {
56             var d = this.getUTCDate();
57             return new Date(d.getTime() + (d.getTimezoneOffset()*60000));
58     },
59     
60     getUTCDate: function() {
61             return this.date;
62     },
63     
64     setDate: function(d) {
65             this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset()*60000)));
66     },
67     
68     setUTCDate: function(d) {
69             this.date = d;
70             this.setValue(this.formatDate(this.date));
71     },
72         
73     onRender: function(ct, position)
74     {
75         
76         Roo.bootstrap.TimeField.superclass.onRender.call(this, ct, position);
77 //        
78 //        this.language = this.language || 'en';
79 //        this.language = this.language in Roo.bootstrap.DateField.dates ? this.language : this.language.split('-')[0];
80 //        this.language = this.language in Roo.bootstrap.DateField.dates ? this.language : "en";
81 //        
82 //        this.isRTL = Roo.bootstrap.DateField.dates[this.language].rtl || false;
83 //        this.format = this.format || 'm/d/y';
84 //        this.isInline = false;
85 //        this.isInput = true;
86 //        this.component = this.el.select('.add-on', true).first() || false;
87 //        this.component = (this.component && this.component.length === 0) ? false : this.component;
88 //        this.hasInput = this.component && this.inputEL().length;
89         
90 //        if (typeof(this.minViewMode === 'string')) {
91 //            switch (this.minViewMode) {
92 //                case 'months':
93 //                    this.minViewMode = 2;
94 //                    break;
95 //                case 'years':
96 //                    this.minViewMode = 3;
97 //                    break;
98 //                case 'day':
99 //                    this.minViewMode = 1;
100 //                    break;
101 //                default:
102 //                    this.minViewMode = 0;
103 //                    break;
104 //            }
105 //        }
106         
107 //        if (typeof(this.viewMode === 'string')) {
108 //            switch (this.viewMode) {
109 //                case 'months':
110 //                    this.viewMode = 2;
111 //                    break;
112 //                case 'years':
113 //                    this.viewMode = 2;
114 //                    break;
115 //                case 'day':
116 //                    this.viewMode = 1;
117 //                    break;
118 //                default:
119 //                    this.viewMode = 0;
120 //                    break;
121 //            }
122 //        }
123                 
124         this.el.select('>.input-group', true).first().createChild(Roo.bootstrap.TimeField.template);
125         
126         this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
127         this.picker().select('>.datepicker-time',true).first().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
128         
129         this.picker().on('mousedown', this.onMousedown, this);
130         this.picker().on('click', this.onClick, this);
131         
132         this.picker().addClass('datepicker-dropdown');
133         
134 //        this.startViewMode = this.viewMode;
135         
136 //        this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
137         
138 //        this.setStartDate(this.startDate);
139 //        this.setEndDate(this.endDate);
140         
141 //        this.setDaysOfWeekDisabled(this.daysOfWeekDisabled);
142         
143 //        this.fillDow();
144 //        this.fillMonths();
145         this.fillTime();
146         this.update();
147 //        this.showMode();
148         
149 //        if(this.showTime){
150             
151 //            var dayFoot = this.picker().select('>.datepicker-days tfoot th', true).first();
152 //            var timeFoot = this.picker().select('>.datepicker-time tfoot th', true).first();
153 //
154 //            var dayFootIcon = this.picker().select('>.datepicker-days tfoot span.picker-switch-icon', true).first();
155 //            var timeFootIcon = this.picker().select('>.datepicker-time tfoot span.picker-switch-icon', true).first();
156 //            
157 //            timeFoot.addClass('switch-calendar');
158 //            dayFoot.addClass('switch-time');
159 //            
160 //            timeFootIcon.addClass('switch-calendar');
161 //            timeFootIcon.addClass('glyphicon-calendar');
162 //            
163 //            dayFootIcon.addClass('switch-time');
164 //            dayFootIcon.addClass('glyphicon-time');
165             
166         var hours_up = this.picker().select('>.datepicker-time span.hours-up', true).first();
167         var hours_down = this.picker().select('>.datepicker-time span.hours-down', true).first();
168         var minutes_up = this.picker().select('>.datepicker-time span.minutes-up', true).first();
169         var minutes_down = this.picker().select('>.datepicker-time span.minutes-down', true).first();
170
171         var period = this.picker().select('>.datepicker-time button', true).first();
172
173         hours_up.on('click', this.onIncrementHours, hours_up);
174         hours_down.on('click', this.onDecrementHours, hours_down);
175         minutes_up.on('click', this.onIncrementMinutes, minutes_up);
176         minutes_down.on('click', this.onDecrementMinutes, minutes_down);
177
178         period.on('click', this.onTogglePeriod, period);
179             
180 //        }else{
181 //            Roo.each(this.picker().select('tfoot th', true).elements, function(v){
182 //                v.remove();
183 //            });
184 //        }
185 //        
186 //        if(this.isInline) {
187 //            this.show();
188 //        }
189     },
190     
191     picker : function()
192     {
193         return this.el.select('.datepicker', true).first();
194     },
195     
196     fillTime: function()
197     {    
198         var time = this.picker().select('>.datepicker-time tbody', true).first();
199         
200         time.dom.innerHTML = '';
201         
202         time.createChild({
203             tag: 'tr',
204             cn: [
205                 {
206                     tag: 'td',
207                     cn: [
208                         {
209                             tag: 'a',
210                             href: '#',
211                             cls: 'btn',
212                             cn: [
213                                 {
214                                     tag: 'span',
215                                     cls: 'hours-up glyphicon glyphicon-chevron-up'
216                                 }
217                             ]
218                         } 
219                     ]
220                 },
221                 {
222                     tag: 'td',
223                     cls: 'separator'
224                 },
225                 {
226                     tag: 'td',
227                     cn: [
228                         {
229                             tag: 'a',
230                             href: '#',
231                             cls: 'btn',
232                             cn: [
233                                 {
234                                     tag: 'span',
235                                     cls: 'minutes-up glyphicon glyphicon-chevron-up'
236                                 }
237                             ]
238                         }
239                     ]
240                 },
241                 {
242                     tag: 'td',
243                     cls: 'separator'
244                 }
245             ]
246         });
247         
248         time.createChild({
249             tag: 'tr',
250             cn: [
251                 {
252                     tag: 'td',
253                     cn: [
254                         {
255                             tag: 'span',
256                             cls: 'timepicker-hour',
257                             html: '00'
258                         }  
259                     ]
260                 },
261                 {
262                     tag: 'td',
263                     cls: 'separator',
264                     html: ':'
265                 },
266                 {
267                     tag: 'td',
268                     cn: [
269                         {
270                             tag: 'span',
271                             cls: 'timepicker-minute',
272                             html: '00'
273                         }  
274                     ]
275                 },
276                 {
277                     tag: 'td',
278                     cls: 'separator'
279                 },
280                 {
281                     tag: 'td',
282                     cn: [
283                         {
284                             tag: 'button',
285                             type: 'button',
286                             cls: 'btn btn-primary',
287                             html: 'AM'
288                             
289                         }
290                     ]
291                 }
292             ]
293         });
294         
295         time.createChild({
296             tag: 'tr',
297             cn: [
298                 {
299                     tag: 'td',
300                     cn: [
301                         {
302                             tag: 'a',
303                             href: '#',
304                             cls: 'btn',
305                             cn: [
306                                 {
307                                     tag: 'span',
308                                     cls: 'hours-down glyphicon glyphicon-chevron-down'
309                                 }
310                             ]
311                         }
312                     ]
313                 },
314                 {
315                     tag: 'td',
316                     cls: 'separator'
317                 },
318                 {
319                     tag: 'td',
320                     cn: [
321                         {
322                             tag: 'a',
323                             href: '#',
324                             cls: 'btn',
325                             cn: [
326                                 {
327                                     tag: 'span',
328                                     cls: 'minutes-down glyphicon glyphicon-chevron-down'
329                                 }
330                             ]
331                         }
332                     ]
333                 },
334                 {
335                     tag: 'td',
336                     cls: 'separator'
337                 }
338             ]
339         });
340         
341     },
342     
343     update: function()
344     {
345         
346         this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time;
347         
348         this.fill();
349     },
350     
351     fill: function() 
352     {
353         Roo.log('fill!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1');
354         Roo.log(this.time);
355         Roo.log(this.time.getHours());
356         Roo.log(this.time.getMinutes());
357         
358     },
359 //    
360 //    showMode: function(dir) {
361 //        if (dir) {
362 //            this.viewMode = Math.max(this.minViewMode, Math.min(3, this.viewMode + dir));
363 //        }
364 //        
365 //        Roo.each(this.picker().select('>div',true).elements, function(v){
366 //            v.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
367 //            v.hide();
368 //        });
369 //        this.picker().select('>.datepicker-'+Roo.bootstrap.DateField.modes[this.viewMode].clsName, true).first().show();
370 //        
371 //    },
372     
373     place: function()
374     {
375 //        if(this.isInline) return;
376         
377         this.picker().removeClass(['bottom', 'top']);
378         
379         if((Roo.lib.Dom.getViewHeight() + Roo.get(document.body).getScroll().top) - (this.inputEl().getBottom() + this.picker().getHeight()) < 0){
380             /*
381              * place to the top of element!
382              *
383              */
384             
385             this.picker().addClass('top');
386             this.picker().setTop(0 - this.picker().getHeight()).setLeft(this.inputEl().getLeft() - this.el.getLeft());
387             
388             return;
389         }
390         
391         this.picker().addClass('bottom');
392         
393         this.picker().setTop(this.inputEl().getHeight()).setLeft(this.inputEl().getLeft() - this.el.getLeft());
394     },
395     
396 //    parseDate : function(value){
397 //        if(!value || value instanceof Date){
398 //            return value;
399 //        }
400 //        var v = Date.parseDate(value, this.format);
401 //        if (!v && this.useIso) {
402 //            v = Date.parseDate(value, 'Y-m-d');
403 //        }
404 //        if(!v && this.altFormats){
405 //            if(!this.altFormatsArray){
406 //                this.altFormatsArray = this.altFormats.split("|");
407 //            }
408 //            for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
409 //                v = Date.parseDate(value, this.altFormatsArray[i]);
410 //            }
411 //        }
412 //        return v;
413 //    },
414     
415 //    formatDate : function(date, fmt){
416 //        return (!date || !(date instanceof Date)) ?
417 //        date : date.dateFormat(fmt || this.format);
418 //    },
419     
420     onFocus : function()
421     {
422         Roo.bootstrap.TimeField.superclass.onFocus.call(this);
423         this.show();
424     },
425     
426     onBlur : function()
427     {
428         Roo.bootstrap.TimeField.superclass.onBlur.call(this);
429         this.hide();
430     },
431     
432     show : function()
433     {
434         this.picker().show();
435         this.picker().select('>.datepicker-time',true).first().show();
436         this.update();
437         this.place();
438     },
439     
440     hide : function()
441     {
442         this.picker().hide();
443         this.picker().select('>.datepicker-time',true).first().hide();
444         
445     },
446     
447     onMousedown: function(e){
448         e.stopPropagation();
449         e.preventDefault();
450     },
451 //    
452 //    keyup: function(e){
453 //        Roo.bootstrap.DateField.superclass.keyup.call(this);
454 //        this.update();
455 //        
456 //    },
457     
458 //    fireKey: function(e){
459 //        if (!this.picker().isVisible()){
460 //            if (e.keyCode == 27) // allow escape to hide and re-show picker
461 //                this.show();
462 //            return;
463 //        }
464 //        var dateChanged = false,
465 //        dir, day, month,
466 //        newDate, newViewDate;
467 //        switch(e.keyCode){
468 //            case 27: // escape
469 //                this.hide();
470 //                e.preventDefault();
471 //                break;
472 //            case 37: // left
473 //            case 39: // right
474 //                if (!this.keyboardNavigation) break;
475 //                dir = e.keyCode == 37 ? -1 : 1;
476 //                
477 //                if (e.ctrlKey){
478 //                    newDate = this.moveYear(this.date, dir);
479 //                    newViewDate = this.moveYear(this.viewDate, dir);
480 //                } else if (e.shiftKey){
481 //                    newDate = this.moveMonth(this.date, dir);
482 //                    newViewDate = this.moveMonth(this.viewDate, dir);
483 //                } else {
484 //                    newDate = new Date(this.date);
485 //                    newDate.setUTCDate(this.date.getUTCDate() + dir);
486 //                    newViewDate = new Date(this.viewDate);
487 //                    newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
488 //                }
489 //                if (this.dateWithinRange(newDate)){
490 //                    this.date = newDate;
491 //                    this.viewDate = newViewDate;
492 //                    this.setValue(this.formatDate(this.date));
493 //                    this.update();
494 //                    e.preventDefault();
495 //                    dateChanged = true;
496 //                }
497 //                break;
498 //            case 38: // up
499 //            case 40: // down
500 //                if (!this.keyboardNavigation) break;
501 //                dir = e.keyCode == 38 ? -1 : 1;
502 //                if (e.ctrlKey){
503 //                    newDate = this.moveYear(this.date, dir);
504 //                    newViewDate = this.moveYear(this.viewDate, dir);
505 //                } else if (e.shiftKey){
506 //                    newDate = this.moveMonth(this.date, dir);
507 //                    newViewDate = this.moveMonth(this.viewDate, dir);
508 //                } else {
509 //                    newDate = new Date(this.date);
510 //                    newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
511 //                    newViewDate = new Date(this.viewDate);
512 //                    newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
513 //                }
514 //                if (this.dateWithinRange(newDate)){
515 //                    this.date = newDate;
516 //                    this.viewDate = newViewDate;
517 //                    this.setValue(this.formatDate(this.date));
518 //                    this.update();
519 //                    e.preventDefault();
520 //                    dateChanged = true;
521 //                }
522 //                break;
523 //            case 13: // enter
524 //                this.setValue(this.formatDate(this.date));
525 //                this.hide();
526 //                e.preventDefault();
527 //                break;
528 //            case 9: // tab
529 //                this.setValue(this.formatDate(this.date));
530 //                this.hide();
531 //                break;
532 //        }
533 //    },
534     
535     
536     onClick: function(e) {
537         e.stopPropagation();
538         e.preventDefault();
539         
540         var target = e.getTarget();
541         
542 //        if(target.nodeName.toLowerCase() === 'i'){
543 //            target = Roo.get(target).dom.parentNode;
544 //        }
545         
546         var nodeName = target.nodeName.trim();
547         var className = target.className.trim();
548         var html = target.innerHTML;
549         
550         Roo.log('nodeName');
551         Roo.log(nodeName);
552         
553         Roo.log('className');
554         Roo.log(className);
555         
556         Roo.log('html');
557         Roo.log(html);
558         
559         
560 //        switch(nodeName.toLowerCase()) {
561 //            case 'th':
562 //                switch(className) {
563 //                    case 'switch':
564 //                        this.showMode(1);
565 //                        break;
566 //                    case 'prev':
567 //                    case 'next':
568 //                        var dir = Roo.bootstrap.DateField.modes[this.viewMode].navStep * (className == 'prev' ? -1 : 1);
569 //                        switch(this.viewMode){
570 //                                case 0:
571 //                                        this.viewDate = this.moveMonth(this.viewDate, dir);
572 //                                        break;
573 //                                case 1:
574 //                                case 2:
575 //                                        this.viewDate = this.moveYear(this.viewDate, dir);
576 //                                        break;
577 //                        }
578 //                        this.fill();
579 //                        break;
580 //                    case 'today':
581 //                        var date = new Date();
582 //                        this.date = this.UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
583 //                        this.fill()
584 //                        this.setValue(this.formatDate(this.date));
585 //                        this.hide();
586 //                        break;
587 //                     case 'switch-time':
588 //                        this.showMode(-1);
589 //                        this.fill();
590 //                        break;
591 //                     case 'switch-calendar':
592 //                         this.showMode(1);
593 //                         this.fill();
594 //                         break;
595 //                }
596 //                break;
597 //            case 'span':
598 //                if (className.indexOf('disabled') === -1) {
599 //                    this.viewDate.setUTCDate(1);
600 //                    if (className.indexOf('month') !== -1) {
601 //                        this.viewDate.setUTCMonth(Roo.bootstrap.DateField.dates[this.language].monthsShort.indexOf(html));
602 //                    } else if(className.indexOf('picker-switch-icon') !== -1){
603 //                        if(className.indexOf('switch-time') !== -1){
604 //                            this.showMode(-1);
605 //                            this.fill();
606 //                        }else{
607 //                            this.showMode(1);
608 //                            this.fill();
609 //                        }
610 //                        
611 //                        break;
612 //                        
613 //                    } else {
614 //                        var year = parseInt(html, 10) || 0;
615 //                        this.viewDate.setUTCFullYear(year);
616 //                        
617 //                    }
618 //                    this.showMode(-1);
619 //                    this.fill();
620 //                }
621 //                break;
622 //                
623 //            case 'td':
624 //                if (className.indexOf('day') !== -1 && className.indexOf('disabled') === -1){
625 //                    var day = parseInt(html, 10) || 1;
626 //                    var year = this.viewDate.getUTCFullYear(),
627 //                        month = this.viewDate.getUTCMonth();
628 //
629 //                    if (className.indexOf('old') !== -1) {
630 //                        if(month === 0 ){
631 //                            month = 11;
632 //                            year -= 1;
633 //                        }else{
634 //                            month -= 1;
635 //                        }
636 //                    } else if (className.indexOf('new') !== -1) {
637 //                        if (month == 11) {
638 //                            month = 0;
639 //                            year += 1;
640 //                        } else {
641 //                            month += 1;
642 //                        }
643 //                    }
644 //                    this.date = this.UTCDate(year, month, day,0,0,0,0);
645 //                    this.viewDate = this.UTCDate(year, month, Math.min(28, day),0,0,0,0);
646 //                    this.fill();
647 //                    this.setValue(this.formatDate(this.date));
648 //                    this.hide();
649 //                }
650 //                break;
651 //        }
652     },
653     
654 //    setStartDate: function(startDate){
655 //        this.startDate = startDate || -Infinity;
656 //        if (this.startDate !== -Infinity) {
657 //            this.startDate = this.parseDate(this.startDate);
658 //        }
659 //        this.update();
660 //        this.updateNavArrows();
661 //    },
662 //
663 //    setEndDate: function(endDate){
664 //        this.endDate = endDate || Infinity;
665 //        if (this.endDate !== Infinity) {
666 //            this.endDate = this.parseDate(this.endDate);
667 //        }
668 //        this.update();
669 //        this.updateNavArrows();
670 //    },
671 //    
672 //    setDaysOfWeekDisabled: function(daysOfWeekDisabled){
673 //        this.daysOfWeekDisabled = daysOfWeekDisabled || [];
674 //        if (typeof(this.daysOfWeekDisabled) !== 'object') {
675 //            this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
676 //        }
677 //        this.daysOfWeekDisabled = this.daysOfWeekDisabled.map(function (d) {
678 //            return parseInt(d, 10);
679 //        });
680 //        this.update();
681 //        this.updateNavArrows();
682 //    },
683 //    
684 //    updateNavArrows: function() {
685 //        var d = new Date(this.viewDate),
686 //        year = d.getUTCFullYear(),
687 //        month = d.getUTCMonth();
688 //        
689 //        Roo.each(this.picker().select('.prev', true).elements, function(v){
690 //            v.show();
691 //            switch (this.viewMode) {
692 //                case 0:
693 //
694 //                    if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
695 //                        v.hide();
696 //                    }
697 //                    break;
698 //                case 1:
699 //                case 2:
700 //                    if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
701 //                        v.hide();
702 //                    }
703 //                    break;
704 //            }
705 //        });
706 //        
707 //        Roo.each(this.picker().select('.next', true).elements, function(v){
708 //            v.show();
709 //            switch (this.viewMode) {
710 //                case 0:
711 //
712 //                    if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
713 //                        v.hide();
714 //                    }
715 //                    break;
716 //                case 1:
717 //                case 2:
718 //                    if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
719 //                        v.hide();
720 //                    }
721 //                    break;
722 //            }
723 //        })
724 //    },
725 //    
726 //    moveMonth: function(date, dir){
727 //        if (!dir) return date;
728 //        var new_date = new Date(date.valueOf()),
729 //        day = new_date.getUTCDate(),
730 //        month = new_date.getUTCMonth(),
731 //        mag = Math.abs(dir),
732 //        new_month, test;
733 //        dir = dir > 0 ? 1 : -1;
734 //        if (mag == 1){
735 //            test = dir == -1
736 //            // If going back one month, make sure month is not current month
737 //            // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
738 //            ? function(){
739 //                return new_date.getUTCMonth() == month;
740 //            }
741 //            // If going forward one month, make sure month is as expected
742 //            // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
743 //            : function(){
744 //                return new_date.getUTCMonth() != new_month;
745 //            };
746 //            new_month = month + dir;
747 //            new_date.setUTCMonth(new_month);
748 //            // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
749 //            if (new_month < 0 || new_month > 11)
750 //                new_month = (new_month + 12) % 12;
751 //        } else {
752 //            // For magnitudes >1, move one month at a time...
753 //            for (var i=0; i<mag; i++)
754 //                // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
755 //                new_date = this.moveMonth(new_date, dir);
756 //            // ...then reset the day, keeping it in the new month
757 //            new_month = new_date.getUTCMonth();
758 //            new_date.setUTCDate(day);
759 //            test = function(){
760 //                return new_month != new_date.getUTCMonth();
761 //            };
762 //        }
763 //        // Common date-resetting loop -- if date is beyond end of month, make it
764 //        // end of month
765 //        while (test()){
766 //            new_date.setUTCDate(--day);
767 //            new_date.setUTCMonth(new_month);
768 //        }
769 //        return new_date;
770 //    },
771 //
772 //    moveYear: function(date, dir){
773 //        return this.moveMonth(date, dir*12);
774 //    },
775 //
776 //    dateWithinRange: function(date){
777 //        return date >= this.startDate && date <= this.endDate;
778 //    },
779
780 //    remove: function() {
781 //        this.picker().remove();
782 //    },
783     
784     onIncrementHours: function()
785     {
786         Roo.log('onIncrementHours');
787     },
788     
789     onDecrementHours: function()
790     {
791         Roo.log('onDecrementHours');
792     },
793     
794     onIncrementMinutes: function()
795     {
796         Roo.log('onIncrementMinutes');
797     },
798     
799     onDecrementMinutes: function()
800     {
801         Roo.log('onDecrementMinutes');
802     },
803     
804     onTogglePeriod: function()
805     {
806         Roo.log('onTogglePeriod');
807     }
808     
809    
810 });
811
812 Roo.apply(Roo.bootstrap.TimeField,  {
813     
814     content : {
815         tag: 'tbody',
816         cn: [
817         {
818             tag: 'tr',
819             cn: [
820             {
821                 tag: 'td',
822                 colspan: '7'
823             }
824             ]
825         }
826         ]
827     }
828 });
829
830 Roo.apply(Roo.bootstrap.TimeField,  {
831   
832     template : {
833         tag: 'div',
834         cls: 'datepicker dropdown-menu',
835         cn: [
836             {
837                 tag: 'div',
838                 cls: 'datepicker-time',
839                 cn: [
840                 {
841                     tag: 'table',
842                     cls: 'table-condensed',
843                     cn:[
844                     Roo.bootstrap.DateField.content
845                     ]
846                 }
847                 ]
848             }
849         ]
850     }
851 });
852
853  
854
855