Skip to main content

Bug Tracker

Side navigation

Ticket #2832: datepicker.patch


File datepicker.patch, 2.1 KB (added by insekticid, May 09, 2008 02:27PM UTC)

patch v2

Index: ui.datepicker.js
===================================================================
--- ui.datepicker.js	(revision 5527)
+++ ui.datepicker.js	(working copy)
@@ -251,9 +251,37 @@
 	           Date[2] - the current dates for a range */
 	_getDateDatepicker: function(target) {
 		var inst = this._getInst(target._calId);
+		
+		if ( inst )
+		{
+			inst._setDateFromField($(target));
+		}
+		
 		return (inst ? inst._getDate() : null);
 	},
-
+	
+	_isDateInRangeDatepicker: function(target) {
+		var inst = this._getInst(target._calId);
+		
+		return (inst ? inst._isInRange(this._getDateDatepicker(target)) : null);
+	},
+	
+	_isMinDateDatepicker: function(target) {
+		var inst    = this._getInst(target._calId);
+		var date    = this._getDateDatepicker(target);
+		var minDate = inst._getMinMaxDate('min', true);
+		
+		return (!minDate || date >= minDate);
+	},
+	
+	_isMaxDateDatepicker: function(target) {
+		var inst    = this._getInst(target._calId);
+		var date    = this._getDateDatepicker(target);
+		var maxDate = inst._getMinMaxDate('max', true);
+		
+		return (!maxDate || date <= maxDate);
+	},
+	
 	/* Handle keystrokes. */
 	_doKeyDown: function(e) {
 		var inst = $.datepicker._getInst(this._calId);
@@ -723,7 +751,7 @@
 	dateStatus: function(date, inst) {
 		return $.datepicker.formatDate(inst._get('dateStatus'), date, inst._getFormatConfig());
 	},
-
+	
 	/* Parse a string value into a date object.
 	   The format can be combinations of the following:
 	   d  - day of month (no leading zero)
@@ -1418,7 +1446,7 @@
    @return  jQuery object */
 $.fn.datepicker = function(options){
 	var otherArgs = Array.prototype.slice.call(arguments, 1);
-	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) {
+	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'isDateInRange' || options == 'isMinDate'|| options == 'isMaxDate' )) {
 		return $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this[0]].concat(otherArgs));
 	}
 	return this.each(function() {

Download in other formats:

Original Format