--- date_popup/date_popup.module	2010-10-21 14:42:39.000000000 -0400
+++ date_popup/date_popupNEW.module	2010-11-02 11:51:54.494660600 -0400
@@ -106,8 +106,20 @@ function date_popup_js_settings_id($id,
   // Make sure popup date selector grid is in correct year.
   if (!empty($settings['yearRange'])) {
     $parts = explode(':', $settings['yearRange']);
-    $settings += array('defaultDate' => (string) $parts[0] . 'y');
-  }
+    // Set the default date to 0 or the lowest bound if the date ranges do not include the current year
+    // Necessary for the datepicker to render and select dates correctly
+    $defaultDate = ($parts[0] > 0 || 0 > $parts[1]) ? $parts[0] : 0;
+
+    // The 1.7 version of datepicker renders the range of year options 
+    // relative to the drawn year in the popup, and will re-render the options 
+    // whenever the year changes.
+    if (strpos(jquery_ui_get_version(), '1.7') === 0 && ($parts[0] >= 0 || 0 >= $parts[1])) {
+      $range = max($parts) - min($parts);
+      $defaultDate = $parts[0];
+      $settings['yearRange'] = '-' . $range . ':' . '+' . $range;
+    }
+    $settings += array('defaultDate' => (string) $defaultDate . 'y');
+	}
 
   if (!$js_added) {
     drupal_add_js(drupal_get_path('module', 'date_popup') .'/date_popup.js');
@@ -238,12 +250,9 @@ function date_popup_process_date(&$eleme
   
   // The datepicker can't handle zero or negative values like 0:+1
   // even though the Date API can handle them, so rework the value
-  // we pass to the datepicker to use defaults it can accept.
-  $this_year = date_format(date_now(), 'Y');
+  // we pass to the datepicker to use defaults it can accept (such as +0:+1)
+  // date_range_string() adds the necessary +/- signs to the range string.
   $range = date_range_years($element['#date_year_range'], $date);
-  if ($range[0] > $this_year) {
-    $range[0] = $this_year;
-  }
   $year_range = date_range_string($range);
 
   $settings = array(
