diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-20 14:02:42 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-09-20 15:05:36 +0200 |
commit | 7943480f0f0cf130f4ca104d7e9235bbb2ba6ec2 (patch) | |
tree | 2c0e549b57c961472eee92fbee04eb30f8ad60bf /src/corelib/time/qdatetimeparser.cpp | |
parent | a5d501000ea4eb9d282ed0a15e7c5fb1e1837712 (diff) |
Fix QDateTimeParser's handling of 't' format to match serialization
This amends commit 68f19fb630dc02463c2d61fc511de7407687795e to only
consume one 't' from the format string, to match qlocale.cpp's
serialization of time-zone specifiers, which only consumes one, so
will repeat the time-zone specifier as many times as unquoted t
appears in the format. It's hard to imagine why anyone would want this
behavior, but it's what our serialization has always done and parsing
should match serialization.
Add test-cases for double time-zone specifier.
Delete a lie in the process.
Task-number: QTBUG-95966
Change-Id: I574896040a74085dee89a4fefd8384be44ad827b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time/qdatetimeparser.cpp')
-rw-r--r-- | src/corelib/time/qdatetimeparser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 4904ac3b44..6f582ed650 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -600,7 +600,10 @@ bool QDateTimeParser::parseFormat(QStringView newFormat) break; case 't': if (parserType == QMetaType::QDateTime) { - const SectionNode sn = { TimeZoneSection, i - add, countRepeat(newFormat, i, 4), 0 }; + // TODO (in qlocale.cpp's serialization, too) QTBUG-95966: + // decide what different lengths of 't' format should do, + // instead of repetition ! + const SectionNode sn = { TimeZoneSection, i - add, 1, 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); i += sn.count - 1; |