diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2017-10-27 06:36:47 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2017-10-27 08:40:10 +0200 |
commit | e9bddf38e829184c3e569c4c666901e7b29f2e43 (patch) | |
tree | e5c252552a92517844c90a4090c5481cffa7674b /src | |
parent | 301f240881428e95954b10fc4d61b31720067160 (diff) | |
download | calcurse-e9bddf38e829184c3e569c4c666901e7b29f2e43.tar.gz calcurse-e9bddf38e829184c3e569c4c666901e7b29f2e43.zip |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c index 706484f..f3739ea 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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) { |