aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2008-08-21 09:04:44 +0000
committerKeith Wood <kbwood.au@gmail.com>2008-08-21 09:04:44 +0000
commit187c97bef0a92f8840abc2f04952d8786eef0705 (patch)
tree65f8727fb79ea0f1547840193dfd661c0bf65405
parent50fae3972c46f75a68cc1f8fa64a7cf0672d40f8 (diff)
downloadjquery-ui-187c97bef0a92f8840abc2f04952d8786eef0705.tar.gz
jquery-ui-187c97bef0a92f8840abc2f04952d8786eef0705.zip
Fixed 3159 Datepicker function to do refresh/redraw
Simplified iso8601Week function
-rw-r--r--ui/ui.datepicker.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js
index da8f89cd2..fee8ed9a8 100644
--- a/ui/ui.datepicker.js
+++ b/ui/ui.datepicker.js
@@ -230,10 +230,10 @@ $.extend(Datepicker.prototype, {
/* Attach an inline date picker to a div. */
_inlineDatepicker: function(target, inst) {
- var input = $(target);
- if (input.hasClass(this.markerClassName))
+ var divSpan = $(target);
+ if (divSpan.hasClass(this.markerClassName))
return;
- input.addClass(this.markerClassName).append(inst.dpDiv).
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
bind("setData.datepicker", function(event, key, value){
inst.settings[key] = value;
}).bind("getData.datepicker", function(event, key){
@@ -416,6 +416,15 @@ $.extend(Datepicker.prototype, {
}
},
+ /* Redraw the date picker attached to an input field or division.
+ @param target element - the target input field or division or span */
+ _refreshDatepicker: function(target) {
+ var inst = $.data(target, PROP_NAME);
+ if (inst) {
+ this._updateDatepicker(inst);
+ }
+ },
+
/* Set the dates for a jQuery selection.
@param target element - the target input field or division or span
@param date Date - the new date
@@ -838,7 +847,8 @@ $.extend(Datepicker.prototype, {
@param date Date - the date to get the week for
@return number - the number of the week within the year that contains this date */
iso8601Week: function(date) {
- var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), (date.getTimezoneOffset() / -60));
+ var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(),
+ (date.getTimezoneOffset() / -60));
var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
@@ -848,8 +858,7 @@ $.extend(Datepicker.prototype, {
} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
- checkDate.setDate(checkDate.getDate() + 3); // Generate for next year
- return $.datepicker.iso8601Week(checkDate);
+ return 1;
}
}
return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date