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

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

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P3: Somewhat important
    • 6.5.0 FF
    • 5.6, 6.2
    • Core: Date/Time
    • None
    • All
    • 8
    • qtbase/18439a449fdf7e60878329a42fdc55beca14b4c0 (dev; 6.5) qtbase/0bc92c01e364b89250b7d23ec3078563548609f8 (dev, 6.5)
    • Team 1 Foundation_Sprint 42, Team 1 Foundation_Sprint 43, Team 1 Foundation_Sprint 44, Team 1 Foundation_Sprint 45, Team 1 Foundation_Sprint 46, Foundation Sprint 61, Foundation Sprint 62, Foundation Sprint 63, Foundation Sprint 64, Foundation Sprint 65, Foundation Sprint 66, Foundation Sprint 67

    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. If a format contains more of a field character than the longest recognised, it is treated as two fields, e.g. 'MMMMMM' would be treated as 'MMMM' followed by 'MM' so a date in July would show July07 for such a field.

      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

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

        Activity

          People

            Eddy Edward Welbourne
            Eddy Edward Welbourne
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes