Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.14
-
None
Description
QDateTime::toString()'s documentation tells the user that Qt::ISODate's handling depends on spec but neglects to mention how to change the date-time the caller has to the spec that'll give them the format they want. (Report originates with vestbo wanting the format that Qt::OffsetFromUTC provides, but having a local-time.)
The diligent reader may manage to find toTimeSpec(), but using it with Qt::OffsetFromUTC doesn't do what a reasonable client would want - which they can do, but only by calling
t.toOffsetFromUtc(t.offsetFromUtc())
which is something of a hurdle for them to work out.
The toString() doc should at least be updated to explain how to do this correctly, if only by reference to toTimeSpec(). The doc of toTimeSpec() should also mention toTimeZone().
The situation could be improved by having toOffsetFromUtc() with no argument use the instance's current offsetFromUtc(); and/or by having toTimeSpec(Qt::OffsetFromUTC) do likewise. The latter would be a behaviour change, but could perhaps be done at Qt 6.