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

You cannot set years on date properties in QML

    XMLWordPrintable

Details

    Description

      Consider:

      import QtQuick 2.0
      
      Item {
          width: 360
          height: 360
      
          property date date1: new Date()
      
          Component.onCompleted: {
              console.log("date1 initial value: " + date1)
              var tmpDate = date1
              console.log("tmpDate initial value: " + tmpDate)
              date1.setUTCFullYear(1000)
              console.log("date1 1000 year value: " + date1 + " (unexpected result!)")
              tmpDate.setUTCFullYear(1000)
              console.log("tmpDate 1000 year value: " + tmpDate)
          }
      }
      

      You get:

      qml: date1 initial value: Fri Dec 12 14:06:50 2014 GMT+0100
      qml: tmpDate initial value: Fri Dec 12 14:06:50 2014 GMT+0100
      qml: date1 1000 year value: Fri Dec 12 14:06:50 2014 GMT+0100 (unexpected result!)
      qml: tmpDate 1000 year value: Fri Dec 12 14:06:50 1000 GMT+0100
      

      The third line should state something with year 1000.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              ulherman Ulf Hermann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes