diff options
author | Fabian Kosmale <[email protected]> | 2020-01-28 16:26:49 +0100 |
---|---|---|
committer | Fabian Kosmale <[email protected]> | 2020-01-30 09:51:44 +0100 |
commit | c5f78add12b7d33926631b6df79599df18f65068 (patch) | |
tree | 08a895aa76440a4b267b1f6f500ea11e2722e19d /src/qml/jsruntime/qv4dateobject.cpp | |
parent | e080f48f905be597b1a645f1641b2b06553df6a2 (diff) |
Reduce Qt Declarative's use of QDateTime's locale-dependent APIs
[ChangeLog][QtQml] Qt.formatDateTime, Qt.formatDate and Qt.formatTime
now support formatting according to a locale and an optional locale
format type. If locale dependent formatting is desired, this method
should be used instead of the locale-related DateFormat enum members.
Fixes: QTBUG-81631
Change-Id: I971231644ebbeaccbf54dd8f036adf4d31547301
Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4dateobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index c2f48ffeac..bebcbd7e44 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -682,17 +682,17 @@ static inline QString ToTimeString(double t) static inline QString ToLocaleString(double t) { - return ToDateTime(t, Qt::LocalTime).toString(Qt::DefaultLocaleShortDate); + return QLocale().toString(ToDateTime(t, Qt::LocalTime), QLocale::ShortFormat); } static inline QString ToLocaleDateString(double t) { - return ToDateTime(t, Qt::LocalTime).date().toString(Qt::DefaultLocaleShortDate); + return QLocale().toString(ToDateTime(t, Qt::LocalTime).date(), QLocale::ShortFormat); } static inline QString ToLocaleTimeString(double t) { - return ToDateTime(t, Qt::LocalTime).time().toString(Qt::DefaultLocaleShortDate); + return QLocale().toString(ToDateTime(t, Qt::LocalTime).time(), QLocale::ShortFormat); } static double getLocalTZA() |