mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Allow dateFormat
to be changed after init
This commit is contained in:
parent
13cd6c2fe5
commit
ab94999105
@ -41,7 +41,19 @@ test( "appendTo", function() {
|
||||
});
|
||||
|
||||
test( "dateFormat", function() {
|
||||
expect( 0 );
|
||||
expect( 2 );
|
||||
var input = $( "#datepicker" ).val( "1/1/2014" ).datepicker(),
|
||||
picker = input.datepicker( "widget" ),
|
||||
firstDayLink = picker.find( "td[id]:first a" );
|
||||
|
||||
input.datepicker( "open" );
|
||||
firstDayLink.trigger( "mousedown" );
|
||||
equal( input.val(), "1/1/2014", "default formatting" );
|
||||
|
||||
input.datepicker( "option", "dateFormat", "D" );
|
||||
equal( input.val(), "Wednesday, January 01, 2014", "updated formatting" );
|
||||
|
||||
input.datepicker( "destroy" );
|
||||
});
|
||||
|
||||
test( "eachDay", function() {
|
||||
|
@ -632,6 +632,13 @@ $.widget( "ui.datepicker", {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
if ( key === "dateFormat" ) {
|
||||
this.date.setFormat( this.options.dateFormat );
|
||||
if ( !this.inline ) {
|
||||
this.element.val( this.date.format() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( key === "showWeek" ) {
|
||||
this.refresh();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user