summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/date.c b/date.c
index 73c063b..d2a67cc 100644
--- a/date.c
+++ b/date.c
@@ -34,7 +34,7 @@ static const char *month_names[] = {
};
static const char *weekday_names[] = {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+ "Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"
};
/*
@@ -531,6 +531,22 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, int *num)
tl++;
}
+ for (i = 0; i < 7; i++) {
+ int match = match_string(date, weekday_names[i]);
+ if (match >= 3) {
+ int diff, n = *num -1;
+ *num = 0;
+
+ diff = tm->tm_wday - i;
+ if (diff <= 0)
+ n++;
+ diff += 7*n;
+
+ update_tm(tm, diff * 24 * 60 * 60);
+ return end;
+ }
+ }
+
if (match_string(date, "months") >= 5) {
int n = tm->tm_mon - *num;
*num = 0;