diff options
Diffstat (limited to 'src/corelib/time/qdatetimeparser.cpp')
-rw-r--r-- | src/corelib/time/qdatetimeparser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 790c20004a..2a19611493 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -1539,6 +1539,14 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu text = scan.input = input; // Set spec *after* all checking, so validity is a property of the string: scan.value = scan.value.toTimeSpec(spec); + + /* + However, even with a valid string we might have ended up with an invalid datetime: + the non-existent hour during dst changes, for instance. + */ + if (!scan.value.isValid() && scan.state == Acceptable) + scan.state = Intermediate; + return scan; } |