mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Add an isValid()
method
This commit is contained in:
parent
104f3e6be0
commit
b4fe65a134
@ -111,4 +111,17 @@ test( "valueAsDate", function() {
|
||||
inline.datepicker( "destroy" );
|
||||
});
|
||||
|
||||
test( "isValid", function() {
|
||||
expect( 2 );
|
||||
var input = $( "#datepicker" ).datepicker();
|
||||
|
||||
input.val( "1/1/14" );
|
||||
ok( input.datepicker( "isValid" ) );
|
||||
|
||||
input.val( "1/1/abc" );
|
||||
ok( !input.datepicker( "isValid" ) );
|
||||
|
||||
input.datepicker( "destroy" );
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
@ -654,6 +654,9 @@ $.widget( "ui.datepicker", {
|
||||
return this.date.date();
|
||||
}
|
||||
},
|
||||
isValid: function() {
|
||||
return Globalize.parseDate( this.element.val(), this.options.dateFormat ) !== null;
|
||||
},
|
||||
_destroy: function() {
|
||||
if ( this.inline ) {
|
||||
this.picker.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user