Parse time before date in parse_datetime()

Make sure that in cases when the date and time formats conflict, such as
is the case with "0030", the input is interpreted as a time value, not a
date.

Suggested-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2017-10-27 06:36:47 +02:00
parent 301f240881
commit e9bddf38e8

View File

@ -1140,10 +1140,10 @@ int parse_datetime(const char *string, long *ts)
ret |= PARSE_DATETIME_HAS_DATE |
PARSE_DATETIME_HAS_TIME;
}
} else if (parse_date_interactive(t, &year, &month, &day)) {
ret |= PARSE_DATETIME_HAS_DATE;
} else if (parse_time(t, &hour, &minute)) {
ret |= PARSE_DATETIME_HAS_TIME;
} else if (parse_date_interactive(t, &year, &month, &day)) {
ret |= PARSE_DATETIME_HAS_DATE;
}
if (ret & PARSE_DATETIME_HAS_DATE) {