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

Give QDateTime's zone-specifier 't' less dumb behaviour on repetition.

    XMLWordPrintable

    Details

    • Type: Task
    • Status: In Progress
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.6, 6.2
    • Fix Version/s: None
    • Component/s: Core: Date/Time
    • Labels:
      None
    • Platform/s:
      All

      Description

      Various format specifiers use different lengths to encode different ways of representing a field – e.g. 'M' for month-number (unpadded), 'MM' for two-digit (zero-padded if needed) month number, 'MMM'} for abbreviated month name and 'MMMM' for full month name.

      The 't' format specifier is currently documented as

          \row \li t \li The timezone (for example "CEST")
      

      This (given the behaviour of the other fields, when more of a specifier are given than the recognised patterns) implies repeating the zone for 'tt' and longer forms, where we could give those meaning as different forms of the zone, e.g. full name (Europe/Oslo), short name (CEST), and offset suffix (+01:00).

      The parser currently does its best to recognise both full name and various offset suffix forms; the short name form is unparseable (due to collisions, as various zones are abbreviated identically). The present serialization's use of the short-form is, consequently, severely sub-optimal.

      (Also: when parsing, only QDateTime recognises 't' but, when serializing, QTime also accepts it, somewhat questionably using localtime's zone. This behaviour dates back at least to 5.2, when QLocale was made consistent with qdatetime.cpp, ready for changing the latter to delegate to the former.)

      Resolving this will be a significant behaviour change, but hopefully few users are currently relying on repetition of 't' to produce repeated zone specification.

        Attachments

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

          Activity

            People

            Assignee:
            Eddy Edward Welbourne
            Reporter:
            Eddy Edward Welbourne
            PM Owner:
            Vladimir Minenko Vladimir Minenko
            RnD Owner:
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes