This is my first time submitting a support request so please bear with me if some things do not make sense.
In date_api.module (line 2140) the helper function date_order() translates positive and negative numbers to the English text representations for the order.
function date_order() {
return array(
'+1' => 'First',
'+2' => 'Second',
'+3' => 'Third',
'+4' => 'Fourth',
'+5' => 'Fifth',
'-1' => 'Last',
'-2' => 'Next to last',
'-3' => 'Third from last',
'-4' => 'Fourth from last',
'-5' => 'Fifth from last'
);
}
The English representations are used in date_modify() functions in date_repeat_calc.inc. All representations from +1 through -1 work fine in the date_modify() function but -2 though -5 all seem to give incorrect values.
For example, each of the following lines:
date_modify($date, Next to last Tuesday);
date_modify($date, Third from last Tuesday);
date_modify($date, Fourth from last Tuesday);
date_modify($date, Fifth from last Tuesday);
Seem to always be translated to:
date_modify($date, last Tuesday);
It doesn't seem like the keywords before the word "last" are being respected. If date_order() were changed to the following the repeat options for -2 through -5 seem to work fine.
function date_order() {
return array(
'+1' => 'First',
'+2' => 'Second',
'+3' => 'Third',
'+4' => 'Fourth',
'+5' => 'Fifth',
'-1' => 'Last',
'-2' => '-2',
'-3' => '-3',
'-4' => '-4',
'-5' => '-5'
);
}
Is there any other way to fix the repeats for -2 through -5?
Comments
Comment #1
slybud commentedThanks for your solution : i had exactly the same issue on a date CCK with repeating options (2.4 version)
The fix you suggested did fix my problem and does the job without side effect as far a I know
Maybe we could submit the related patch in this issue for it to be reviewed ? (i have this patch if you want)
Best regards
Comment #2
karens commentedThat fix certainly does seem to work. Apparently the parser just doesn't understand the negative language. Thanks!