While editing or creating a node, I expand the "Advanced" option on a CCK "datetime" field, "Text Field with Date Pop-up and Repeat options," and get what you see in my attached image. "Day of Month" is numbered 1 to 31 then continues to -1, -2, -3... not sure where it ends because it gets cut off.

Also after saving the node, I get some horrible output formula that looks incorrect and is not needed, see bad-output image.

Comments

markDrupal’s picture

The negative numbers are coming from the following code in "date_repeat_form.inc" around line 140

  $element['advanced']['BYMONTHDAY'] = array(
    '#type' => 'select',
    '#title' => t('Day of Month'),
    '#default_value' => !empty($rrule['BYMONTHDAY']) ? $rrule['BYMONTHDAY'] : '',
    '#options' => array('' => t('-- Any')) + drupal_map_assoc(range(1, 31)) + drupal_map_assoc(range(-1, -31)),
    '#multiple' => TRUE,
    '#size' => 10,
    '#prefix' => '<div class="date-repeat-input">',
    '#suffix' => '</div>',
  );

changing :

    '#options' => array('' => t('-- Any')) + drupal_map_assoc(range(1, 31)) + drupal_map_assoc(range(-1, -31)),

to this :

    '#options' => array('' => t('-- Any')) + drupal_map_assoc(range(1, 31)),

got rid of the negative numbers, but is there some use for negative numbers that I am unaware of?

markDrupal’s picture

Turns out this module has some incompatibilities with the "better select" module which was causing that bad output (see image above), after disabling the better select module it works with nice output.

markDrupal’s picture

Title: Date Repeat field "Advanced" option show negative dates » Date Repeat field "Advanced" option show negative dates & not compatible with better select module
StatusFileSize
new1.84 KB

I managed to work out the compatibility issues for date_repeat_api and Better_Select modules for my site, but I am not sure if this patch would be worth committing. It might help you out though if you have any similar issues your self.
#362746-1: Check that #options are valid, else abort conversion to checkboxes for the same issue in the better select queue.

karens’s picture

Status: Active » Postponed (maintainer needs more info)

The negative dates are by design. That means start counting from the end of the month, so -1 means the last day, -2, the next to last day, etc.

The remaining issue would be the compatibility issue. It looks like committing the change here won't be enough unless a fix is posted to Better Select. Does the fix break any existing behavior without Better Select enabled? If not, I can still commit it.

markDrupal’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

no I wouldn't commit this, it is more a problem with betterselect, they need a way to selectively disable the conversion.