Use QDateTime for interfacing with QML
ClosedPublic

Authored by fvogt on May 30 2018, 7:29 PM.

Details

Summary

QDate from/to JS Date has unexpected results, so use QDateTime to have a
timezone assigned to prevent conversions. That way the date values are
consistent.

The behaviour got changed with Qt 5.11 (see the linked bug report) which
lead to plasma showing the wrong dates in the calendar.

BUG: 394423

Test Plan

Tested with and without this patch on Qt 5.10.1 and 5.11.0.
Now the correct date is displayed for -0004 and +0001 timezones.

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fvogt created this revision.May 30 2018, 7:29 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 30 2018, 7:29 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
fvogt requested review of this revision.May 30 2018, 7:29 PM
Zren added a subscriber: Zren.Jun 3 2018, 1:47 AM
ngraham added a subscriber: ngraham.Jun 3 2018, 9:46 PM

If the behavior changed in Qt 5.11, does the new code need a Qt version check, or is the patch backwards-compatible with earlier Qt versions?

fvogt added a comment.Jun 4 2018, 6:43 AM

If the behavior changed in Qt 5.11, does the new code need a Qt version check, or is the patch backwards-compatible with earlier Qt versions?

The latter, as it says in the test plan.

With this change, the bad QDate conversions aren't used anymore.

davidedmundson accepted this revision.Jun 4 2018, 8:15 AM
This revision is now accepted and ready to land.Jun 4 2018, 8:15 AM
This revision was automatically updated to reflect the committed changes.