Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118791

Deprecate QDate / QTime <-> Date conversions

    XMLWordPrintable

Details

    Description

      As documented https://doc.qt.io/qt-6/qtqml-cppintegration-data.html#qdate-and-javascript-date , QDate and QTime usage in QML is extremely error prone, resulting in off-by-one bugs if one isn't super careful. While some "mitigation" exists (like only calling UTC-named Date functions), formatting would still return the local time, and so on.

      I think these conversions should be outright deprecated, and removed in a ".pragma strict" QML. If the user needs to carry a

      struct Date { int year,month,day; }

      they can create their own value type. I don't see any value at having "convenience" which comes with so many traps attached.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              peppe Giuseppe D'Angelo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes