summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdatetimeedit_p.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-06-01 18:27:48 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-06-23 14:04:08 +0200
commitc00ee2f31013e99c79b820a0db57003c110a5510 (patch)
treeca5469dd8254a8729ccb1a33eaaedeba21104417 /src/widgets/widgets/qdatetimeedit_p.h
parent5ad13ec57dc4829813557069806b44000dd836e2 (diff)
Use UTC when parsing only a date or only a time, not a date-time
This should reduce the amount of fall-out from DST complications. Also document the assumptions of QDateTimeParser's two fromString() methods (and fix the punctuation on the QDateTime parameter). Adjusted some tests to match. Since only QDateTime-returning methods will show the difference, and it's at least somewhat odd to be using those on QDateEdit or QTimeEdit, this should have little impact on API users. [ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now operate in UTC, to avoid spurious complications arising from time-zone transitions (e.g. DST) causing the implicit other half to combine with the part being edited to make an invalid result. Returns from their dateTime() and other methods returning QDateTime (max/min) shall thus be in UTC where previously they were in local time. QDateTimeEdit continues using local time. The default can be over-ridden by setTimeSpec(), as ever. Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit_p.h')
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 5830caaba3..550653d731 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -70,7 +70,7 @@ class Q_AUTOTEST_EXPORT QDateTimeEditPrivate : public QAbstractSpinBoxPrivate, p
{
Q_DECLARE_PUBLIC(QDateTimeEdit)
public:
- QDateTimeEditPrivate();
+ QDateTimeEditPrivate(Qt::TimeSpec timeSpec = Qt::LocalTime);
void init(const QVariant &var);
void readLocaleSettings();
@@ -153,7 +153,7 @@ public:
bool focusOnButton = false;
#endif
- Qt::TimeSpec spec = Qt::LocalTime;
+ Qt::TimeSpec spec;
};