Fix bug in handling of WKDAY DAY YEAR date specification.

This commit is contained in:
Dianne Skoll
2021-04-15 12:29:30 -04:00
parent 5681ebdb12
commit f5a094a973
3 changed files with 10 additions and 0 deletions

View File

@@ -185,6 +185,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
while (trig->d > DaysInMonth(m2, trig->y)) m2--;
j = Julian(trig->y, m2, trig->d);
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
if (j >= startdate) return j;
}
}
@@ -192,6 +193,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
if (trig->d <= DaysInMonth(m, trig->y)) {
j = Julian(trig->y, m, trig->d);
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
if (j >= startdate) return j;
}
@@ -201,6 +203,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
while (trig->d > DaysInMonth(m, trig->d)) m++;
j = Julian(trig->y, m, trig->d);
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
return j;
case GOT_DAY+GOT_MON+GOT_WD:

View File

@@ -69,6 +69,10 @@ chmod 644 include_dir/04cantread.rem
echo "Feb 29 Bug Test" >> ../tests/test.out
echo 'REM Sun 29 Feb MSG [$T]' | ../src/remind -dt - 1 feb 2021 >> ../tests/test.out 2>&1
# Day Weekday Year out-of-year bug
echo "Mon 31 Dec Bug Test" >> ../tests/test.out
echo 'REM Mon 31 2021 MSG [$T]' | ../src/remind -dt - 31 dec 2021 >> ../tests/test.out 2>&1
echo "Color Test" >> ../tests/test.out
../src/remind -ccl ../tests/colors.rem 1 aug 2007 >> ../tests/test.out 2>&1

View File

@@ -4243,6 +4243,9 @@ September 30
Feb 29 Bug Test
-(1): Trig = Sunday, 3 March, 2024
No reminders.
Mon 31 Dec Bug Test
-(1): Expired
No reminders.
Color Test
(0lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk(B
(0x(B August 2007 (0x(B