DevHeads.net

Review Request 127629: Fix KDateTime::isValid() for ClockTime values

Review request for kdelibs.

Bugs: 336738
<a href="https://bugs.kde.org/show_bug.cgi?id=336738" title="https://bugs.kde.org/show_bug.cgi?id=336738">https://bugs.kde.org/show_bug.cgi?id=336738</a>

Repository: kdelibs4support

Description
KDateTime::isValid() wrongly returns invalid for an instance which is specified in ClockTime, if the date/time is invalid in the local time zone. This is due to the internal QDateTime value being set to Qt::LocalTime, and unlike in Qt4, QDateTime in Qt5 uses the local time zone to validate the date/time. For ClockTime, there is no associated time zone (and choosing the local time zone to perform validation is purely arbitrary), so it should ignore the local time zone when validating.

Diffs
autotests/kdatetimetest.cpp a8e7749
src/kdecore/kdatetime.cpp c530db1

Diff: <a href="https://git.reviewboard.kde.org/r/127629/diff/" title="https://git.reviewboard.kde.org/r/127629/diff/">https://git.reviewboard.kde.org/r/127629/diff/</a>

Testing
Test added to kdatetimetest, all tests pass.

Thanks,

David Jarvie

Comments

Re: Review Request 127629: Fix KDateTime::isValid() for ClockTim

By David Jarvie at 05/05/2016 - 18:17

(Updated May 5, 2016, 10:17 p.m.)

Status
This change has been marked as submitted.

Review request for kdelibs.

Changes
Submitted with commit af320ed5599cb0737c0601e26126c39e64780de0 by David Jarvie to branch master.

Bugs: 336738
<a href="https://bugs.kde.org/show_bug.cgi?id=336738" title="https://bugs.kde.org/show_bug.cgi?id=336738">https://bugs.kde.org/show_bug.cgi?id=336738</a>

Repository: kdelibs4support

Description
KDateTime::isValid() wrongly returns invalid for an instance which is specified in ClockTime, if the date/time is invalid in the local time zone. This is due to the internal QDateTime value being set to Qt::LocalTime, and unlike in Qt4, QDateTime in Qt5 uses the local time zone to validate the date/time. For ClockTime, there is no associated time zone (and choosing the local time zone to perform validation is purely arbitrary), so it should ignore the local time zone when validating.

Diffs
autotests/kdatetimetest.cpp a8e7749
src/kdecore/kdatetime.cpp c530db1

Diff: <a href="https://git.reviewboard.kde.org/r/127629/diff/" title="https://git.reviewboard.kde.org/r/127629/diff/">https://git.reviewboard.kde.org/r/127629/diff/</a>

Testing
Test added to kdatetimetest, all tests pass.

Thanks,

David Jarvie

Re: Review Request 127629: Fix KDateTime::isValid() for ClockTim

By Michael Pyne at 05/04/2016 - 20:50

Ship it!

Ship It!

- Michael Pyne

On April 10, 2016, 6:43 p.m., David Jarvie wrote:

Re: Review Request 127629: Fix KDateTime::isValid() for ClockTim

By David Jarvie at 05/04/2016 - 19:13

Can I commit this?

- David Jarvie

On April 10, 2016, 6:43 p.m., David Jarvie wrote: