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

QTimeZone::NameType doesn't work as documentated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.0
    • Core: Date/Time
    • None
    • macOS, Windows

    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

          For Gerrit Dashboard: QTBUG-84297
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change