File tree Expand file tree Collapse file tree 1 file changed +27
-9
lines changed
Expand file tree Collapse file tree 1 file changed +27
-9
lines changed Original file line number Diff line number Diff line change 11301130 return false ;
11311131 } ;
11321132
1133+ _convert24to12 = function ( hour ) {
1134+ if ( hour > 12 ) {
1135+ hour = hour - 12 ;
1136+ }
1137+
1138+ if ( hour == 0 ) {
1139+ hour = 12 ;
1140+ }
1141+
1142+ var result ;
1143+ if ( hour < 10 ) {
1144+ result = "0" + hour ;
1145+ }
1146+ else {
1147+ result = String ( hour ) ;
1148+ }
1149+
1150+ return result ;
1151+ } ;
1152+
11331153 /*
11341154 * Public utility to format the time
11351155 * format = string format of the time
11541174 if ( options . ampm ) {
11551175 if ( hour > 11 ) {
11561176 ampmName = options . pmNames [ 0 ] ;
1157- if ( hour > 12 ) {
1158- hour = hour % 12 ;
1159- }
1160- }
1161- if ( hour === 0 ) {
1162- hour = 12 ;
11631177 }
11641178 }
1165- tmptime = tmptime . replace ( / (?: h h ? | m m ? | s s ? | [ t T ] { 1 , 2 } | [ l z ] | ' .* ?' ) / g, function ( match ) {
1166- switch ( match . toLowerCase ( ) ) {
1179+ tmptime = tmptime . replace ( / (?: H H ? | h h ? | m m ? | s s ? | [ t T ] { 1 , 2 } | [ l z ] | ( ' .* ?' | " .* ?" ) ) / g, function ( match ) {
1180+ switch ( match ) {
1181+ case 'HH' :
1182+ return _convert24to12 ( hour ) . slice ( - 2 ) ;
1183+ case 'H' :
1184+ return _convert24to12 ( hour ) ;
11671185 case 'hh' :
11681186 return ( '0' + hour ) . slice ( - 2 ) ;
11691187 case 'h' :
18471865 */
18481866 $ . timepicker . version = "1.1.0" ;
18491867
1850- } ) ( jQuery ) ;
1868+ } ) ( jQuery ) ;
You can’t perform that action at this time.
0 commit comments