Author: francois.b
Date: 2010-05-05 12:23:50 +0200 (Wed, 05 May 2010)
New Revision: 29353

Modified:
   
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_date_picker.jquery.js
Log:
[sfUnobstrusiveWidgetPlugin] updated datepicker JS script to be able to use 
"minDate" and "maxDate" options

Modified: 
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_date_picker.jquery.js
===================================================================
--- 
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_date_picker.jquery.js
 2010-05-05 09:36:46 UTC (rev 29352)
+++ 
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_date_picker.jquery.js
 2010-05-05 10:23:50 UTC (rev 29353)
@@ -153,7 +153,7 @@
       /**
        * Prepare to show a date picker linked to 3 controls
        */
-      function readLinked()
+      function readLinked(input, inst)
       {
         var objects = false;
         var minDate = null;
@@ -166,7 +166,7 @@
         {
           objects = $rangeWidgets;
         }
-
+        
         if (objects)
         {
           $(this).val(objects.month.val() + '/' + objects.day.val() + '/' + 
objects.year.val());
@@ -189,6 +189,20 @@
             }
           }
         }
+        
+        if (inst.settings.maxDate && !maxDate)
+        {
+          maxDate = inst.settings.maxDate;
+        }
+        if (inst.settings.minDate && !minDate)
+        {
+          minDate = inst.settings.minDate;
+        }
+        
+        if (minDate > maxDate)
+        {
+          minDate = maxDate;
+        }
 
         return { minDate: minDate, maxDate: maxDate };
       }
@@ -196,7 +210,7 @@
       /**
        * Update 3 controls to match a date picker selection
        */
-      function updateLinked(date)
+      function updateLinked(dateText, inst)
       {
         var objects = false;
         if ($(this).attr('id') == $baseId)
@@ -225,9 +239,9 @@
             offsetForYear = lastYear.length;
           }
 
-          objects.month.val(date.substring(indexForMonth, indexForMonth+2));
-          objects.day.val(date.substring(indexForDay, indexForDay+2));
-          objects.year.val(date.substring(indexForYear, 
indexForYear+offsetForYear));
+          objects.month.val(dateText.substring(indexForMonth, 
indexForMonth+2));
+          objects.day.val(dateText.substring(indexForDay, indexForDay+2));
+          objects.year.val(dateText.substring(indexForYear, 
indexForYear+offsetForYear));
         }
       }
 

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to