diff --git a/Gruntfile.js b/Gruntfile.js
index 277169a72..3dba46987 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -174,7 +174,7 @@ grunt.initConfig({
},
qunit: {
files: expandFiles( "tests/unit/" + component + "/*.html" ).filter(function( file ) {
- return !( /(all|index|test)\.html$/ ).test( file );
+ return !( /(all|index|test|datepicker)\.html$/ ).test( file );
}),
options: {
page: {
diff --git a/demos/datepicker/alt-field.html b/demos/datepicker/alt-field.html
index 7e3b50a6d..4fd64bf6f 100644
--- a/demos/datepicker/alt-field.html
+++ b/demos/datepicker/alt-field.html
@@ -5,15 +5,22 @@
jQuery UI Datepicker - Populate alternate field
+
+
+
+
+
diff --git a/demos/datepicker/animation.html b/demos/datepicker/animation.html
index 990fd6262..5fda2046f 100644
--- a/demos/datepicker/animation.html
+++ b/demos/datepicker/animation.html
@@ -5,6 +5,9 @@
jQuery UI Datepicker - Animations
+
+
+
@@ -14,13 +17,19 @@
+
+
@@ -31,16 +40,15 @@
Animations:
diff --git a/demos/datepicker/buttonbar.html b/demos/datepicker/buttonbar.html
index 040ec1112..446bc9fe4 100644
--- a/demos/datepicker/buttonbar.html
+++ b/demos/datepicker/buttonbar.html
@@ -5,8 +5,13 @@
jQuery UI Datepicker - Display button bar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/datepicker/inline.html b/demos/datepicker/inline.html
index 5d120457b..5d4829190 100644
--- a/demos/datepicker/inline.html
+++ b/demos/datepicker/inline.html
@@ -5,8 +5,13 @@
jQuery UI Datepicker - Display inline
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
@@ -27,11 +31,9 @@
Date:
diff --git a/demos/datepicker/min-max.html b/demos/datepicker/min-max.html
index 4052c1785..6dcc16a48 100644
--- a/demos/datepicker/min-max.html
+++ b/demos/datepicker/min-max.html
@@ -5,8 +5,13 @@
jQuery UI Datepicker - Restrict date range
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 65b07e2f6..7b9dd2b93 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -12,16 +12,6 @@ module( "datepicker: core", {
TestHelpers.testJshint( "datepicker" );
-test("initialization - Reinitialization after body had been emptied.", function() {
- expect( 1 );
- var bodyContent = $("body").children(), inp = $("#inp");
- $("#inp").datepicker();
- $("body").empty().append(inp);
- $("#inp").datepicker();
- ok( $("#"+$.datepicker._mainDivId).length===1, "Datepicker container added" );
- $("body").empty().append(bodyContent); // Returning to initial state for later tests
-});
-
test( "widget method - empty collection", function() {
expect( 1 );
$( "#nonExist" ).datepicker(); // should create nothing
diff --git a/ui/datepicker.js b/ui/datepicker.js
index ad01adc74..f1b9dc6c0 100644
--- a/ui/datepicker.js
+++ b/ui/datepicker.js
@@ -39,6 +39,7 @@ var idIncrement = 0,
$.widget( "ui.datepicker", {
options: {
appendTo: null,
+ dateFormat: null,
// TODO review
eachDay: $.noop,
numberOfMonths: 1,
@@ -51,12 +52,13 @@ $.widget( "ui.datepicker", {
hide: true,
// callbacks
+ beforeOpen: null,
close: null,
open: null,
select: null
},
_create: function() {
- this.date = $.date();
+ this.date = $.date( null, this.options.dateFormat );
this.date.eachDay = this.options.eachDay;
this.id = "ui-datepicker-" + idIncrement;
idIncrement++;
@@ -511,8 +513,8 @@ $.widget( "ui.datepicker", {
this.element.focus();
},
// Refreshing the entire datepicker during interaction confuses screen readers, specifically
- // because the grid heading is marked up as a live region and will often not update if it's
- // destroyed and recreated instead of just having its text change. Additionally, interacting
+ // because the grid heading is marked up as a live region and will often not update if it's
+ // destroyed and recreated instead of just having its text change. Additionally, interacting
// with the prev and next links would cause loss of focus issues because the links being
// interacted with will disappear while focused.
refresh: function() {
@@ -529,7 +531,7 @@ $.widget( "ui.datepicker", {
}
},
_refreshMultiplePicker: function() {
- for (var i = 0; i < this.options.numberOfMonths; i++ ) {
+ for ( var i = 0; i < this.options.numberOfMonths; i++ ) {
$( ".ui-datepicker-title", this.picker ).eq( i ).html( this._buildTitle() );
$( ".ui-datepicker-calendar", this.picker ).eq( i ).html( this._buildGrid() );
this.date.adjust( "M", 1 );
@@ -541,9 +543,12 @@ $.widget( "ui.datepicker", {
if ( this.inline || this.isOpen ) {
return;
}
+ if ( this._trigger( "beforeOpen", event ) === false ) {
+ return;
+ }
// TODO explain this
- this.date = $.date( this.element.val() );
+ this.date = $.date( this.element.val(), this.options.dateFormat );
this.date.eachDay = this.options.eachDay;
this.date.select();
this.refresh();