From f687ea1010615801d0ceda80a6a8c49980d29116 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 16 Oct 2015 11:37:34 -0400 Subject: [PATCH] TW-1715: Dates misinterpreted when no dateformat active. - To be more specific, dates were misinterpreted when an input date was could be unambiguously parsed as either ISO or dateformat, for example, if the dateformat was 'Y-M-D', it matches ISO 'Y-M-DTH:N:S', and the dateformat was considered a match which ignored the 'H:N:S', if specified. --- ChangeLog | 1 + src/ISO8601.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9824da5e0..d93f1feb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -163,6 +163,7 @@ - TW-1700 modify tags behavior changed (thanks to David Badura). - TW-1701 Some generated UUIDs deemed invalid (thanks to Wim Schuermann). - TW-1707 Context can leak into modifications (thanks to Tomas Babej). +- TW-1715 Dates misinterpreted when no dateformat active. - Prevent potential task duplication during import for non-pending tasks. - Show the active context in "context list", if any is active. - Fix "task edit" dropping annotation text after newlines. diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index aa77e805f..d420b0aef 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -564,6 +564,14 @@ bool ISO8601d::parse_formatted (Nibbler& n, const std::string& format) } } + // It is possible that the format='Y-M-D', and the input is Y-M-DTH:N:SZ, and + // this should not be considered a match. + if (! n.depleted () && ! Lexer::isWhitespace (n.next ())) + { + n.restore (); + return false; + } + // Missing values are filled in from the current date. if (year == -1) {