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

JS Date constructor broken in Qt6

    XMLWordPrintable

Details

    • 43eaa77e8ed03153335c0002dcc8b660c39a0beb (qt/qtdeclarative/dev)

    Description

      Noticed while fixing QtPIM unit tests to work with Qt6.

      import QtQml 2.0
      
      QtObject {
          id: root
          Component.onCompleted: {
              var testdate = new Date("1991-08-25 20:57:08 GMT+0000")
              console.log("Constructed JS date: " + testdate)
              console.log("As UTC String: " + testdate.toUTCString())
          }
      }
      

      When run with Qt5 qmlscene we get:

      $ ../build/qt5/qtbase/bin/qmlscene testdate.qml
      qml: Constructed JS date: Mon Aug 26 06:57:08 1991 GMT+1000
      qml: As UTC String: Sun Aug 25 20:57:08 1991 GMT

      But when run with Qt6 qmlscene we get:

      $ ../build/qt6/qtbase/bin/qmlscene testdate.qml
      qml: Constructed JS date: Invalid Date
      qml: As UTC String: Invalid Date
      

      Ubuntu Linux 18.04 / gcc 7.5

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chrisadams Christopher Adams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes