aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--external/date.js9
-rw-r--r--ui/calendar.js13
2 files changed, 9 insertions, 13 deletions
diff --git a/external/date.js b/external/date.js
index 8df3f63de..fd473fbbf 100644
--- a/external/date.js
+++ b/external/date.js
@@ -32,7 +32,6 @@ $.date = function( date, globalFormat ) {
this.dateObject = this.dateObject || new Date();
this.globalFormat = globalFormat;
- this.selected = null;
};
$.date.prototype = {
@@ -153,7 +152,6 @@ $.date.prototype = {
lead: printDate.getMonth() != date.getMonth(),
date: printDate.getDate(),
timestamp: printDate.getTime(),
- current: this.selected && this.selected.equal( printDate ),
today: today.equal( printDate )
};
day.render = day.selectable = !day.lead;
@@ -180,13 +178,6 @@ $.date.prototype = {
result[ result.length - 1 ].last = true;
return result;
},
- select: function() {
- this.selected = this.clone();
- return this;
- },
- selectedDate: function() {
- return this.selected.date();
- },
clone: function() {
var date = this.dateObject;
return new $.date( new Date( date.getFullYear(), date.getMonth(),
diff --git a/ui/calendar.js b/ui/calendar.js
index ced58bc52..c1ce10b6b 100644
--- a/ui/calendar.js
+++ b/ui/calendar.js
@@ -61,8 +61,9 @@ return $.widget( "ui.calendar", {
this.labels = Globalize.translate( "datepicker" );
this.buttonClickContext = this.element[ 0 ];
- this.date = $.date( this.options.value, this.options.dateFormat ).select();
+ this.date = $.date( this.options.value, this.options.dateFormat );
this.date.eachDay = this.options.eachDay;
+ this.options.value = this.date.date();
this._on( this.element, {
"click .ui-calendar-prev": function( event ) {
@@ -332,7 +333,7 @@ return $.widget( "ui.calendar", {
var content = "",
attributes = [
"role='gridcell'",
- "aria-selected='" + ( day.current ? true : false ) + "'"
+ "aria-selected='" + ( this._isCurrent( day ) ? true : false ) + "'"
],
selectable = ( day.selectable && this._isValid( new Date( day.timestamp ) ) );
@@ -357,7 +358,7 @@ return $.widget( "ui.calendar", {
if ( day === this.date && selectable ) {
classes.push( "ui-state-focus" );
}
- if ( day.current ) {
+ if ( this._isCurrent( day ) ) {
classes.push( "ui-state-active" );
}
if ( day.today ) {
@@ -383,6 +384,10 @@ return $.widget( "ui.calendar", {
return content;
},
+ _isCurrent: function( day ) {
+ return day.timestamp === this.options.value.getTime();
+ },
+
_createButtonPane: function() {
this.buttonPane = $( "<div>" )
.addClass( "ui-calendar-buttonpane ui-widget-content ui-helper-clearfix" );
@@ -558,7 +563,7 @@ return $.widget( "ui.calendar", {
_setOption: function( key, value ) {
if ( key === "value" ) {
if ( this._isValid( value ) ) {
- this.date.setTime( value.getTime() ).select();
+ this.date.setTime( value.getTime() );
this._super( key, value );
}
return;