adding due_date and due_time for milestones

Hello-

I'm trying to produce the pick_datetime_widget for real. Currently it just shows a textbox. My problem comes with extending it so that it doesn't ruin the get_year and other functions within the DateTimeValueLib. Does anybody know where I can find this library to see if I can extend it to work with a due date hour, minute, and second? Thanks very much!

I'm attempting to write the pick_datetime_widget function, (see line 91 in application/helpers/form.php) to simply extend the due_date for a milestone to include a time. In the database, it is a datetime field anyway, so we can just add the time to the DateTimeValueLib::make() in the controller...

This way instead of... (line 94 in application/controllers/MilestoneController.class.php)

$milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'milestone_due_date_month', 1), array_var($_POST, 'milestone_due_date_day', 1), array_var($_POST, 'milestone_due_date_year', 1970));

we could change it to something like:

$milestone_data['due_date'] = DateTimeValueLib::make(array_var($_POST, 'milestone_due_date_hour'), $_POST, 'milestone_due_date_minute'), $_POST, 'milestone_due_date_second'), array_var($_POST, 'milestone_due_date_month', 1), array_var($_POST, 'milestone_due_date_day', 1), array_var($_POST, 'milestone_due_date_year', 1970));

The Problem is, I can't make that work without destroying the "view" view. I think the problem comes in when the view controller is used by the "view" view, and tries to get the date and year to display.

Any ideas? I don't even know where to find the DateTimeValueLib definitions!

-Matt

PS-here's what I've done for the pick_datetime_widget function:

  /**
  * Return date time picker widget
  *
  * @access public
  * @param string $name Field name
  * @param string $value Date time value
  * @return string
  */
  function pick_datetime_widget($name, $value = null, $year_from = null, $year_to = null) {
    if(!($value instanceof DateTimeValue)) $value = new DateTimeValue($value);
   
    $month_options = array();
    for($i = 1; $i <= 12; $i++) {
      $option_attributes = $i == $value->getMonth() ? array('selected' => 'selected') : null;
      $month_options[] = option_tag(lang("month $i"), $i, $option_attributes);
    } // for
   
    $day_options = array();
    for($i = 1; $i <= 31; $i++) {
      $option_attributes = $i == $value->getDay() ? array('selected' => 'selected') : null;
      $day_options[] = option_tag($i, $i, $option_attributes);
    } // for
   
    $year_from = (integer) $year_from < 1 ? $value->getYear() - 10 : (integer) $year_from;
    $year_to = (integer) $year_to < 1 || ((integer) $year_to < $year_from) ? $value->getYear() + 10 : (integer) $year_to;
   
    $year_options = array();
    for($i = $year_from; $i <= $year_to; $i++) {
      $option_attributes = $i == $value->getYear() ? array('selected' => 'selected') : null;
      $year_options[] = option_tag($i, $i, $option_attributes);
    }
 
    $hour_options = array();
    for($i = 0; $i <= 23; $i++) {
      $option_attributes = $i == $hour ? array('selected' => 'selected') : null;
      $hour_options[] = option_tag($i, $i, $option_attributes);
    } // for
   
    $minute_options = array();
    for($i = 0; $i <= 59; $i+=5) {
      $option_attributes = $i == $minute ? array('selected' => 'selected') : null;
      $minute_options[] = option_tag($i, $i, $option_attributes);
    } // for
   
    $second_options = array();
    for($i = 0; $i <= 59; $i+=5) {
      $option_attributes = $i == $second ? array('selected' => 'selected') : null;
      $second_options[] = option_tag($i, $i, $option_attributes);
    } // for
   
    // (if?)
   
    return select_box($name . '_month', $month_options) . select_box($name . '_day', $day_options) . select_box($name . '_year', $year_options) . ' at ' . select_box($name . '_hour', $hour_options) . select_box($name . '_minute', $minute_options) . select_box($name . '_second', $second_options);
  } // pick_datetime_widget

which seems to work fine.