Commit 15c909f4 authored by Oleg Yadrov's avatar Oleg Yadrov Committed by Mitch Curtis
Browse files

Calendar: fix bug when NaN is displayed instead of date

I fixed a similar issue last year on the JavaScript side:
094ad30c


At this time the same thing has been happening in C++. See QTBUG-54559
and the patch for a detailed explanation of the issue.  In short,
the problem with Calendar is that internally it uses QDate which does
not keep information about time, whereas in the JavaScript world date
is always combined with time. So, QDate(2017-10-15) is valid, but when
during QDate -> JS Date transformation we add time to it (which defaults
to midnight (00:00)), it becomes invalid in time zones where the Daylight
Saving Time -> Standard Time transition takes place at midnight.

To avoid switching the entire QQuickCalendarModel1
to using QDateTime, I modified its date(...) and dateAt(...) methods to
return QDateTime with the time part always set to 12:00.
That transformation required more changes in QQuickRangedDate1, because
Calendar::selectedDate internally is QQuickRangedDate1::selectedDate,
and I also had to fix "selected" property binding in the Base Calendar
Style as it did take into account the time part of the date, which
resulted in wrong behavior with my changes.

Task-number: QTBUG-64068
Change-Id: Ia2f7703ff4e5811ef79438c97739da1d8001a7f5
Reviewed-by: default avatarMitch Curtis <mitch.curtis@qt.io>
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@qt.io>
Showing with 52 additions and 32 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment