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

Converting date from string may fail if the time zone is UTC-5

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.7.3
    • Core: Date/Time
    • None
    • Windows 10 Pro (10.0.19045 build 19045)
    • Windows

      On Windows:
      1. Set the time zone to any with negative offset from UTC.

      2. Run this code:
          QDate dt;
          dt = QDate::fromString("Oct 23 2024","MMM dd yyyy");
          qDebug() << dt;

      In debug mode:

      ~~~~~~~~~~

      ASSERT: "maximum.date().toJulianDay() == 5373484" in file C:\Users\qt\work\qt\qtbase\src\corelib\time\qdatetimeparser.cpp, line 1617
      Debug Error!

      Program: C:\Qt\6.7.3\msvc2019_64\bin\Qt6Cored.dll
      Module: 6.7.3
      File: C:\Users\qt\work\qt\qtbase\src\corelib\time\qdatetimeparser.cpp
      Line: 1617

      ASSERT: "maximum.date().toJulianDay() == 5373484" in file C:\Users\qt\work\qt\qtbase\src\corelib\time\qdatetimeparser.cpp, line 1617

      (Press Retry to debug the application)

      ~~~~~~~~~

       

      Did not test in release mode, but looking at qdatetimeparser.cpp, Line 1617 - 1619, the result would be "invalid date"

      According to the comment, there was an optimization.

      The issue: At line 1493 "maximum" is incorrectly computed by getMaximum() function, where the return value utcMax is computed from localTimeMax.toUtc(). 

      Did not look the sources in QT 6.7.2, but the example code works.

       

       I did not find similar bug related to this function. Can't believe no one notice it. Maybe QAs are sleeping ?

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

            Eddy Edward Welbourne
            smacker Vladimir Ivanov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes