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

QDateTime asserts when set timezone "Australia/Sydney" and set year 1 or 2 in QDate

    XMLWordPrintable

Details

    • Windows
    • 8286daba038d3c90d2bc06785ffcf9c0c603cb83 (qt/qtbase/5.14) 3a71e387d9759d87241c0c69b2c54f67ca547e10 (qt/qtbase/5.12)

    Description

      QDateTime asserts when set timezone "Australia/Sydney" and set year 1 or 2 in QDate

          QDate date(1,1,1);
          QTime time(0,0,0);
          QTimeZone timeZone = QTimeZone("Australia/Sydney");
          QDateTime dateTime(date, time, timeZone); //<-- Assert here
      

      Assert message:

      Program: C:\Qt\5.13.0\msvc2017_64\bin\Qt5Cored.dll
      Module: 5.13.0 File: tools\qtimezoneprivate_win.cpp
      Line: 388
      
      ASSERT: "date.month() == rule.wMonth" in file tools\qtimezoneprivate_win.cpp, line 388
      

       

      However here is instruction: "Years 1 to 99 are interpreted as is. Year 0 is invalid"
      https://doc.qt.io/qt-5/qdate.html#QDate-2

      If year is set 3 or above, it's no problem. Also it's no problem on macOS even set 1.

      Please check attached sample and backtrace.

      Attachments

        Activity

          People

            Eddy Edward Welbourne
            akizawa Akihito Izawa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: