Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.8.x, 5.0.0
-
None
-
75249653108ea6c722a31395357b4e7feb7cd7b1, 4cf112b641f7ea9fb1ba87cefcef7ee98b6b0831
Description
Some important information is missing from QDate::toString(Qt::DateFormat format = Qt::TextDate) function, see http://doc.qt.digia.com/qt/qdate.html#toString page.
If the format is Qt::TextDate, the string is formatted in the default way. QDate::shortDayName() and QDate::shortMonthName() are used to generate the string, so the day and month names will be localized names.
We should add that "... localized name using the default locale from the system."
Thus, below output is valid for German default locale set to system, but US locale set as default in the test application. As we can see from the Qt::TextDate case in toString() function, it is always using the month before date format, regardless of locale.
QString::fromLatin1("%0 %1 %2 %3")
.arg(shortDayName(dayOfWeek()))
.arg(shortMonthName(m))
.arg(d)
.arg(y);
------------------------------------------------------------------------ fDLShortDateString: "6/26/12" fDLShortDate: QDate("Mi Jun 26 1912") fDLShortDate.year(): 1912 fDLShortDate.toString(): "Mi Jun 26 1912" Copied from Qt::TextDate case in QDate::toString(): "Mi Jun 26 1912" fDLShortDate.toJulianDay() 2419580 ------------------------------------------------------------------------ fDLLongDateString: "Sunday, June 26, 2112" fDLLongDate: QDate("So Jun 26 2112") fDLLongDate.year(): 2112 fDLLongDate.toString(): "So Jun 26 2112" Copied from Qt::TextDate case in QDate::toString(): "So Jun 26 2112" fDLLongDate.toJulianDay() 2492629 ------------------------------------------------------------------------