diff --git a/tests/unit/datepicker/common.js b/tests/unit/datepicker/common.js index 84b97fa3a..6389adaec 100644 --- a/tests/unit/datepicker/common.js +++ b/tests/unit/datepicker/common.js @@ -10,6 +10,7 @@ common.testWidget( "datepicker", { buttons: [], classes: {}, disabled: false, + dateFormat: { date: "short" }, eachDay: $.noop, labels: { "datePickerRole": "date picker", diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index 32979eac8..6bad27b6a 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -45,13 +45,14 @@ test( "appendTo", function() { }); test( "Pass-through options", function() { - expect( 9 ); + expect( 11 ); var options = { buttons: { "Test": $.noop }, dateFormat: { date: "full" }, disabled: true, eachDay: function( day ) { day; }, + locale: "de", max: new Date( 2000, 0, 1 ), min: new Date( 2000, 0, 2 ), numberOfMonths: 3, @@ -72,6 +73,10 @@ test( "Pass-through options", function() { if ( key === "dateFormat" ) { equal( input.val(), "Wednesday, January 1, 2014", "option " + key + ": updated format" ); } + + if ( key === "locale" ) { + equal( input.val(), "Mittwoch, 1. Januar 2014", "option " + key + ": updated locale" ); + } }); }); diff --git a/ui/datepicker.js b/ui/datepicker.js index ba6fd7527..2056d9443 100644 --- a/ui/datepicker.js +++ b/ui/datepicker.js @@ -51,19 +51,17 @@ var widget = $.widget( "ui.datepicker", { select: null }, - calendarOptions: [ "buttons", "disabled", "eachDay", "labels", "locale", - "max", "min", "numberOfMonths", "showWeek" ], + calendarOptions: [ "buttons", "disabled", "dateFormat", "eachDay", "labels", + "locale", "max", "min", "numberOfMonths", "showWeek" ], _create: function() { this.suppressExpandOnFocus = false; - this._setLocale( this.options.locale ); - if ( $.type( this.options.max ) === "string" ) { - this.options.max = this._parseYMD( this.options.max ); + this.options.max = Globalize.parseDate( this.options.max, { raw: "yyyy-MM-dd" } ); } if ( $.type( this.options.min ) === "string" ) { - this.options.min = this._parseYMD( this.options.min ); + this.options.min = Globalize.parseDate( this.options.min, { raw: "yyyy-MM-dd" } ); } this._createCalendar(); @@ -90,7 +88,8 @@ var widget = $.widget( "ui.datepicker", { }, _createCalendar: function() { - var that = this; + var that = this, + globalize = new Globalize( this.options.locale ); this.calendar = $( "