Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.8.0
-
macOS 13.5.2 (M1 CPU), Xcode 14.3, en_AU system locale
-
-
25
-
Foundation Sprint 118, Foundation Sprint 119, Foundation Sprint 120, Foundation Sprint 121, Foundation Sprint 122, Foundation Sprint 123, Foundation Sprint 124, Foundation Sprint 125, Foundation Sprint 126, Foundation Sprint 127
Description
Code
#include <QDateTime> #include <QLocale> int main() { QLocale deLocale{QLocale::German, QLocale::Germany}; const auto dt = QDateTime(QDate(2024, 05, 06), QTime(12, 34)); const auto str = deLocale.toString(dt, QLocale::LongFormat); const auto parsed = deLocale.toDateTime(str, QLocale::LongFormat); qDebug() << "Original timestamp:" << dt; qDebug() << "Long format string:" << str; qDebug() << "Parsed timestamp:" << parsed; Q_ASSERT(parsed.isValid()); }
Correct result (Qt 6.7.2, macOS)
Original timestamp: QDateTime(2024-05-06 12:34:00.000 GMT+8 Qt::LocalTime) Long format string: "Montag, 6. Mai 2024 12:34:00 GMT+8" Parsed timestamp: QDateTime(2024-05-06 12:34:00.000 GMT+8 Qt::LocalTime)
Wrong result (Qt 6.8.0, macOS)
Original timestamp: QDateTime(2024-05-06 12:34:00.000 GMT+8 Qt::LocalTime) Long format string: "Montag, 6. Mai 2024 12:34:00 Westaustralische Normalzeit" Parsed timestamp: QDateTime(Invalid)
Assertion fails
For comparison (Qt 6.7.2 and 6.8.0, Windows 10 22H2)
I'm not sure whether this is considered fully correct or not.
- The result of QLocale::toDateTime() is correct, but
- The result of QLocale::toString() contains a mixture of German and English
Original timestamp: QDateTime(2024-05-06 12:34:00.000 W. Australia Standard Time Qt::LocalTime) Long format string: "Montag, 6. Mai 2024 12:34:00 W. Australia Standard Time" Parsed timestamp: QDateTime(2024-05-06 12:34:00.000 W. Australia Standard Time Qt::LocalTime)
Attachments
Issue Links
- is blocked by
-
QTQAINFRA-6901 Please update timezone package on sles-15_sp5-minimal-static Coin config
-
- In Progress
-
- resulted in
-
QTBUG-131348 Parsing timezone long names gets the wrong IANA ID for a metazone name
-
- Closed
-
Gerrit Reviews
For Gerrit Dashboard: QTBUG-130278 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
599915,31 | Fix long-form zone parts in date-time strings | dev | qt/qtbase | Status: NEW | 0 | 0 |