Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
5.3.2
-
None
Description
When you run the following code
Item { Component.onCompleted: console.log("DATE", (new Date()).toUTCString()) }
The result is:
qml: DATE Fri Dec 5 21:07:01 2014 GMT GMT
The problem code in qv4dateobject.cpp at line 597:
static inline QString ToUTCString(double t) { if (std::isnan(t)) return QStringLiteral("Invalid Date"); return ToDateTime(t, Qt::UTC).toString() + QStringLiteral(" GMT"); }
in qdatetime.cpp
case Qt::TextDate: { QDate dt; QTime tm; d->getDateTime(&dt, &tm); //We cant use date.toString(Qt::TextDate) as we need to insert the time before the year buf = QString::fromUtf8("%1 %2 %3 %4 %5").arg(dt.shortDayName(dt.dayOfWeek())) .arg(dt.shortMonthName(dt.month())) .arg(dt.day()) .arg(tm.toString(Qt::TextDate)) .arg(dt.year()); if (timeSpec() != Qt::LocalTime) { buf += QStringLiteral(" GMT"); if (d->m_spec == Qt::OffsetFromUTC) buf += toOffsetString(Qt::TextDate, d->m_offsetFromUtc); } return buf; }
so two functions are appending "GMT" string.
Attachments
Issue Links
- is replaced by
-
QTBUG-38448 setUTCx group of methods of QML's Date object works strange
- Closed