Skip to content
Browse files

Timepicker: cleaning up a half-finished thought with the validAmPm fu…

…nction
  • Loading branch information...
1 parent e3911a6 commit 3a7693d7c799467f9b1849fd61f55597917cc92c @gnarf gnarf committed Sep 27, 2011
Showing with 15 additions and 16 deletions.
  1. +15 −16 ui/jquery.ui.timepicker.js
View
31 ui/jquery.ui.timepicker.js
@@ -47,6 +47,20 @@ function getAmPmArrays() {
}
function validAmPm( value ) {
+ var i, j, l,
+ valid = getAmPmArrays();
+
+ if ( value === "" ) {
+ return valid.pm && valid.pm[0];
+ }
+
+ for ( i in valid ) {
+ for ( j = 0, l = valid[ i ].length; j < l; j++ ) {
+ if ( valid[ i ][ j ].substr( 0, value.length ) === value ) {
+ return valid[ i ][ 0 ];
+ }
+ }
+ }
}
var rsingleh = /\b(h)(?=:)/i,
@@ -58,22 +72,7 @@ var rsingleh = /\b(h)(?=:)/i,
HH: makeBetweenMaskFunction( 0, 23, "12", "0" ),
mm: makeBetweenMaskFunction( 0, 59, "00", "0" ),
ss: makeBetweenMaskFunction( 0, 59, "00", "0" ),
- tt: function( value ) {
- var i, j, l,
- valid = getAmPmArrays();
-
- if ( value === "" ) {
- return valid.pm && valid.pm[0];
- }
-
- for ( i in valid ) {
- for ( j = 0, l = valid[ i ].length; j < l; j++ ) {
- if ( valid[ i ][ j ].substr( 0, value.length ) === value ) {
- return valid[ i ][ 0 ];
- }
- }
- }
- }
+ tt: validAmPm
};
$.widget( "ui.timepicker", {

0 comments on commit 3a7693d

Please sign in to comment.
Something went wrong with that request. Please try again.