@@ -57,6 +57,13 @@ var DateTimePickerTime = React.createClass({
57
57
}
58
58
return '' ;
59
59
} ,
60
+ renderDayPart : function ( ) {
61
+ return DOM . div ( { className : 'rdtCounter' } , [
62
+ DOM . span ( { key :'up' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) } , '▲' ) ,
63
+ DOM . div ( { key : this . state . daypart , className : 'rdtCount' } , this . state . daypart ) ,
64
+ DOM . span ( { key :'do' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) } , '▼' )
65
+ ] ) ;
66
+ } ,
60
67
render : function ( ) {
61
68
var me = this ,
62
69
counters = [ ]
@@ -69,7 +76,7 @@ var DateTimePickerTime = React.createClass({
69
76
} ) ;
70
77
71
78
if ( this . state . daypart !== false ) {
72
- counters . push ( DOM . div ( { key : this . state . daypart , className : 'rdtDayPart' } , this . state . daypart ) ) ;
79
+ counters . push ( me . renderDayPart ( ) ) ;
73
80
}
74
81
75
82
if ( this . state . counters . length === 3 && this . props . timeFormat . indexOf ( 'S' ) !== - 1 ) {
@@ -168,6 +175,12 @@ var DateTimePickerTime = React.createClass({
168
175
seconds : 2 ,
169
176
milliseconds : 3
170
177
} ,
178
+ toggleDayPart : function ( type ) { // type is always 'hours'
179
+ var value = parseInt ( this . state [ type ] , 10 ) + 12 ;
180
+ if ( value > this . timeConstraints [ type ] . max )
181
+ value = this . timeConstraints [ type ] . min + ( value - ( this . timeConstraints [ type ] . max + 1 ) ) ;
182
+ return this . pad ( type , value ) ;
183
+ } ,
171
184
increase : function ( type ) {
172
185
var value = parseInt ( this . state [ type ] , 10 ) + this . timeConstraints [ type ] . step ;
173
186
if ( value > this . timeConstraints [ type ] . max )
0 commit comments