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

QTimeZone::NameType doesn't work as documentated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.0 RC, 6.9.0 FF
    • 5.14.0
    • Core: Date/Time
    • None
    • macOS, Windows
    • dea91dbb5 (dev), b3a00a38a (dev), 1d725c009 (6.8)

    Description

      As stated on https://doc.qt.io/qt-5/qtimezone.html#NameType-enum - shortName should  return the short form of the time zone name, usually an abbreviation, e.g. "CET".

      I've tested this on both Mac & Win:

      • on OSX it returns "GMT+offset"
      • on Windows it returns the LongName as a timeZone, never its shortName abbreviation. e.g. "Central European Time"

       

      e.g. 

       

      QDateTime currentDateTime = QDateTime::currentDateTime(); 
      
      qDebug() << currentDateTime.timeZone().displayName(currentDateTime,QTimeZone::DefaultName) << 
      currentDateTime.timeZone().displayName(currentDateTime,QTimeZone::LongName) 
      << currentDateTime.timeZone().displayName(currentDateTime,QTimeZone::ShortName) << currentDateTime.timeZone().displayName(currentDateTime,QTimeZone::OffsetName);

       

       on MacOs returns:

      "Central European Summer Time" 
      "Central European Summer Time" 
      "GMT+2" 
      "UTC+02:00"

      & on Windows the same code returns:

      "Central Europe Daylight Time" 
      "Central Europe Daylight Time" 
      "Central Europe Daylight Time" 
      "UTC+02:00"

      Attachments

        Issue Links

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

          Activity

            People

              Eddy Edward Welbourne
              jp_ Jakub Prachar
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes